1 // automatically generated by the FlatBuffers compiler, do not modify
2
3
4 #ifndef FLATBUFFERS_GENERATED_TOKENIZER_LIBTEXTCLASSIFIER3_H_
5 #define FLATBUFFERS_GENERATED_TOKENIZER_LIBTEXTCLASSIFIER3_H_
6
7 #include "flatbuffers/flatbuffers.h"
8
9 // Ensure the included flatbuffers.h is the same version as when this file was
10 // generated, otherwise it may not be compatible.
11 static_assert(FLATBUFFERS_VERSION_MAJOR == 2 &&
12 FLATBUFFERS_VERSION_MINOR == 0 &&
13 FLATBUFFERS_VERSION_REVISION == 7,
14 "Non-compatible flatbuffers version included");
15
16 namespace libtextclassifier3 {
17
18 struct TokenizationCodepointRange;
19 struct TokenizationCodepointRangeBuilder;
20 struct TokenizationCodepointRangeT;
21
22 enum TokenizationType : int32_t {
23 TokenizationType_INVALID_TOKENIZATION_TYPE = 0,
24 TokenizationType_INTERNAL_TOKENIZER = 1,
25 TokenizationType_ICU = 2,
26 TokenizationType_MIXED = 3,
27 TokenizationType_LETTER_DIGIT = 4,
28 TokenizationType_MIN = TokenizationType_INVALID_TOKENIZATION_TYPE,
29 TokenizationType_MAX = TokenizationType_LETTER_DIGIT
30 };
31
EnumValuesTokenizationType()32 inline const TokenizationType (&EnumValuesTokenizationType())[5] {
33 static const TokenizationType values[] = {
34 TokenizationType_INVALID_TOKENIZATION_TYPE,
35 TokenizationType_INTERNAL_TOKENIZER,
36 TokenizationType_ICU,
37 TokenizationType_MIXED,
38 TokenizationType_LETTER_DIGIT
39 };
40 return values;
41 }
42
EnumNamesTokenizationType()43 inline const char * const *EnumNamesTokenizationType() {
44 static const char * const names[6] = {
45 "INVALID_TOKENIZATION_TYPE",
46 "INTERNAL_TOKENIZER",
47 "ICU",
48 "MIXED",
49 "LETTER_DIGIT",
50 nullptr
51 };
52 return names;
53 }
54
EnumNameTokenizationType(TokenizationType e)55 inline const char *EnumNameTokenizationType(TokenizationType e) {
56 if (flatbuffers::IsOutRange(e, TokenizationType_INVALID_TOKENIZATION_TYPE, TokenizationType_LETTER_DIGIT)) return "";
57 const size_t index = static_cast<size_t>(e);
58 return EnumNamesTokenizationType()[index];
59 }
60
61 namespace TokenizationCodepointRange_ {
62
63 enum Role : int32_t {
64 Role_DEFAULT_ROLE = 0,
65 Role_SPLIT_BEFORE = 1,
66 Role_SPLIT_AFTER = 2,
67 Role_TOKEN_SEPARATOR = 3,
68 Role_DISCARD_CODEPOINT = 4,
69 Role_WHITESPACE_SEPARATOR = 7,
70 Role_MIN = Role_DEFAULT_ROLE,
71 Role_MAX = Role_WHITESPACE_SEPARATOR
72 };
73
EnumValuesRole()74 inline const Role (&EnumValuesRole())[6] {
75 static const Role values[] = {
76 Role_DEFAULT_ROLE,
77 Role_SPLIT_BEFORE,
78 Role_SPLIT_AFTER,
79 Role_TOKEN_SEPARATOR,
80 Role_DISCARD_CODEPOINT,
81 Role_WHITESPACE_SEPARATOR
82 };
83 return values;
84 }
85
EnumNamesRole()86 inline const char * const *EnumNamesRole() {
87 static const char * const names[9] = {
88 "DEFAULT_ROLE",
89 "SPLIT_BEFORE",
90 "SPLIT_AFTER",
91 "TOKEN_SEPARATOR",
92 "DISCARD_CODEPOINT",
93 "",
94 "",
95 "WHITESPACE_SEPARATOR",
96 nullptr
97 };
98 return names;
99 }
100
EnumNameRole(Role e)101 inline const char *EnumNameRole(Role e) {
102 if (flatbuffers::IsOutRange(e, Role_DEFAULT_ROLE, Role_WHITESPACE_SEPARATOR)) return "";
103 const size_t index = static_cast<size_t>(e);
104 return EnumNamesRole()[index];
105 }
106
107 } // namespace TokenizationCodepointRange_
108
109 struct TokenizationCodepointRangeT : public flatbuffers::NativeTable {
110 typedef TokenizationCodepointRange TableType;
111 int32_t start = 0;
112 int32_t end = 0;
113 libtextclassifier3::TokenizationCodepointRange_::Role role = libtextclassifier3::TokenizationCodepointRange_::Role_DEFAULT_ROLE;
114 int32_t script_id = 0;
115 };
116
117 struct TokenizationCodepointRange FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
118 typedef TokenizationCodepointRangeT NativeTableType;
119 typedef TokenizationCodepointRangeBuilder Builder;
120 enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
121 VT_START = 4,
122 VT_END = 6,
123 VT_ROLE = 8,
124 VT_SCRIPT_ID = 10
125 };
startFLATBUFFERS_FINAL_CLASS126 int32_t start() const {
127 return GetField<int32_t>(VT_START, 0);
128 }
endFLATBUFFERS_FINAL_CLASS129 int32_t end() const {
130 return GetField<int32_t>(VT_END, 0);
131 }
roleFLATBUFFERS_FINAL_CLASS132 libtextclassifier3::TokenizationCodepointRange_::Role role() const {
133 return static_cast<libtextclassifier3::TokenizationCodepointRange_::Role>(GetField<int32_t>(VT_ROLE, 0));
134 }
script_idFLATBUFFERS_FINAL_CLASS135 int32_t script_id() const {
136 return GetField<int32_t>(VT_SCRIPT_ID, 0);
137 }
VerifyFLATBUFFERS_FINAL_CLASS138 bool Verify(flatbuffers::Verifier &verifier) const {
139 return VerifyTableStart(verifier) &&
140 VerifyField<int32_t>(verifier, VT_START, 4) &&
141 VerifyField<int32_t>(verifier, VT_END, 4) &&
142 VerifyField<int32_t>(verifier, VT_ROLE, 4) &&
143 VerifyField<int32_t>(verifier, VT_SCRIPT_ID, 4) &&
144 verifier.EndTable();
145 }
146 TokenizationCodepointRangeT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const;
147 void UnPackTo(TokenizationCodepointRangeT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const;
148 static flatbuffers::Offset<TokenizationCodepointRange> Pack(flatbuffers::FlatBufferBuilder &_fbb, const TokenizationCodepointRangeT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
149 };
150
151 struct TokenizationCodepointRangeBuilder {
152 typedef TokenizationCodepointRange Table;
153 flatbuffers::FlatBufferBuilder &fbb_;
154 flatbuffers::uoffset_t start_;
add_startTokenizationCodepointRangeBuilder155 void add_start(int32_t start) {
156 fbb_.AddElement<int32_t>(TokenizationCodepointRange::VT_START, start, 0);
157 }
add_endTokenizationCodepointRangeBuilder158 void add_end(int32_t end) {
159 fbb_.AddElement<int32_t>(TokenizationCodepointRange::VT_END, end, 0);
160 }
add_roleTokenizationCodepointRangeBuilder161 void add_role(libtextclassifier3::TokenizationCodepointRange_::Role role) {
162 fbb_.AddElement<int32_t>(TokenizationCodepointRange::VT_ROLE, static_cast<int32_t>(role), 0);
163 }
add_script_idTokenizationCodepointRangeBuilder164 void add_script_id(int32_t script_id) {
165 fbb_.AddElement<int32_t>(TokenizationCodepointRange::VT_SCRIPT_ID, script_id, 0);
166 }
TokenizationCodepointRangeBuilderTokenizationCodepointRangeBuilder167 explicit TokenizationCodepointRangeBuilder(flatbuffers::FlatBufferBuilder &_fbb)
168 : fbb_(_fbb) {
169 start_ = fbb_.StartTable();
170 }
FinishTokenizationCodepointRangeBuilder171 flatbuffers::Offset<TokenizationCodepointRange> Finish() {
172 const auto end = fbb_.EndTable(start_);
173 auto o = flatbuffers::Offset<TokenizationCodepointRange>(end);
174 return o;
175 }
176 };
177
178 inline flatbuffers::Offset<TokenizationCodepointRange> CreateTokenizationCodepointRange(
179 flatbuffers::FlatBufferBuilder &_fbb,
180 int32_t start = 0,
181 int32_t end = 0,
182 libtextclassifier3::TokenizationCodepointRange_::Role role = libtextclassifier3::TokenizationCodepointRange_::Role_DEFAULT_ROLE,
183 int32_t script_id = 0) {
184 TokenizationCodepointRangeBuilder builder_(_fbb);
185 builder_.add_script_id(script_id);
186 builder_.add_role(role);
187 builder_.add_end(end);
188 builder_.add_start(start);
189 return builder_.Finish();
190 }
191
192 flatbuffers::Offset<TokenizationCodepointRange> CreateTokenizationCodepointRange(flatbuffers::FlatBufferBuilder &_fbb, const TokenizationCodepointRangeT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
193
UnPack(const flatbuffers::resolver_function_t * _resolver)194 inline TokenizationCodepointRangeT *TokenizationCodepointRange::UnPack(const flatbuffers::resolver_function_t *_resolver) const {
195 auto _o = std::unique_ptr<TokenizationCodepointRangeT>(new TokenizationCodepointRangeT());
196 UnPackTo(_o.get(), _resolver);
197 return _o.release();
198 }
199
UnPackTo(TokenizationCodepointRangeT * _o,const flatbuffers::resolver_function_t * _resolver)200 inline void TokenizationCodepointRange::UnPackTo(TokenizationCodepointRangeT *_o, const flatbuffers::resolver_function_t *_resolver) const {
201 (void)_o;
202 (void)_resolver;
203 { auto _e = start(); _o->start = _e; }
204 { auto _e = end(); _o->end = _e; }
205 { auto _e = role(); _o->role = _e; }
206 { auto _e = script_id(); _o->script_id = _e; }
207 }
208
Pack(flatbuffers::FlatBufferBuilder & _fbb,const TokenizationCodepointRangeT * _o,const flatbuffers::rehasher_function_t * _rehasher)209 inline flatbuffers::Offset<TokenizationCodepointRange> TokenizationCodepointRange::Pack(flatbuffers::FlatBufferBuilder &_fbb, const TokenizationCodepointRangeT* _o, const flatbuffers::rehasher_function_t *_rehasher) {
210 return CreateTokenizationCodepointRange(_fbb, _o, _rehasher);
211 }
212
CreateTokenizationCodepointRange(flatbuffers::FlatBufferBuilder & _fbb,const TokenizationCodepointRangeT * _o,const flatbuffers::rehasher_function_t * _rehasher)213 inline flatbuffers::Offset<TokenizationCodepointRange> CreateTokenizationCodepointRange(flatbuffers::FlatBufferBuilder &_fbb, const TokenizationCodepointRangeT *_o, const flatbuffers::rehasher_function_t *_rehasher) {
214 (void)_rehasher;
215 (void)_o;
216 struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const TokenizationCodepointRangeT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va;
217 auto _start = _o->start;
218 auto _end = _o->end;
219 auto _role = _o->role;
220 auto _script_id = _o->script_id;
221 return libtextclassifier3::CreateTokenizationCodepointRange(
222 _fbb,
223 _start,
224 _end,
225 _role,
226 _script_id);
227 }
228
229 } // namespace libtextclassifier3
230
231 #endif // FLATBUFFERS_GENERATED_TOKENIZER_LIBTEXTCLASSIFIER3_H_
232