Debian Codegraph @

src/core/ext/upb-generated/google/protobuf/struct.upb.h

raw
1 /* This file was generated by upbc (the upb compiler) from the input
2 * file:
3 *
4 * google/protobuf/struct.proto
5 *
6 * Do not edit -- your changes will be discarded when the file is
7 * regenerated. */
8
9 #ifndef GOOGLE_PROTOBUF_STRUCT_PROTO_UPB_H_
10 #define GOOGLE_PROTOBUF_STRUCT_PROTO_UPB_H_
11
12 #include "upb/msg_internal.h"
13 #include "upb/decode.h"
14 #include "upb/decode_fast.h"
15 #include "upb/encode.h"
16
17 #include "upb/port_def.inc"
18
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22
23 struct google_protobuf_Struct;
24 struct google_protobuf_Struct_FieldsEntry;
25 struct google_protobuf_Value;
26 struct google_protobuf_ListValue;
27 typedef struct google_protobuf_Struct google_protobuf_Struct;
28 typedef struct google_protobuf_Struct_FieldsEntry google_protobuf_Struct_FieldsEntry;
29 typedef struct google_protobuf_Value google_protobuf_Value;
30 typedef struct google_protobuf_ListValue google_protobuf_ListValue;
31 extern const upb_MiniTable google_protobuf_Struct_msginit;
32 extern const upb_MiniTable google_protobuf_Struct_FieldsEntry_msginit;
33 extern const upb_MiniTable google_protobuf_Value_msginit;
34 extern const upb_MiniTable google_protobuf_ListValue_msginit;
35
36 typedef enum {
37 google_protobuf_NULL_VALUE = 0
38 } google_protobuf_NullValue;
39
40
41
42 /* google.protobuf.Struct */
43
44 UPB_INLINE google_protobuf_Struct* google_protobuf_Struct_new(upb_Arena* arena) {
45 return (google_protobuf_Struct*)_upb_Message_New(&google_protobuf_Struct_msginit, arena);
46 }
47 UPB_INLINE google_protobuf_Struct* google_protobuf_Struct_parse(const char* buf, size_t size, upb_Arena* arena) {
48 google_protobuf_Struct* ret = google_protobuf_Struct_new(arena);
49 if (!ret) return NULL;
50 if (upb_Decode(buf, size, ret, &google_protobuf_Struct_msginit, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
51 return NULL;
52 }
53 return ret;
54 }
55 UPB_INLINE google_protobuf_Struct* google_protobuf_Struct_parse_ex(const char* buf, size_t size,
56 const upb_ExtensionRegistry* extreg,
57 int options, upb_Arena* arena) {
58 google_protobuf_Struct* ret = google_protobuf_Struct_new(arena);
59 if (!ret) return NULL;
60 if (upb_Decode(buf, size, ret, &google_protobuf_Struct_msginit, extreg, options, arena) !=
61 kUpb_DecodeStatus_Ok) {
62 return NULL;
63 }
64 return ret;
65 }
66 UPB_INLINE char* google_protobuf_Struct_serialize(const google_protobuf_Struct* msg, upb_Arena* arena, size_t* len) {
67 char* ptr;
68 (void)upb_Encode(msg, &google_protobuf_Struct_msginit, 0, arena, &ptr, len);
69 return ptr;
70 }
71 UPB_INLINE char* google_protobuf_Struct_serialize_ex(const google_protobuf_Struct* msg, int options,
72 upb_Arena* arena, size_t* len) {
73 char* ptr;
74 (void)upb_Encode(msg, &google_protobuf_Struct_msginit, options, arena, &ptr, len);
75 return ptr;
76 }
77 UPB_INLINE bool google_protobuf_Struct_has_fields(const google_protobuf_Struct* msg) {
78 return _upb_has_submsg_nohasbit(msg, UPB_SIZE(0, 0));
79 }
80 UPB_INLINE void google_protobuf_Struct_clear_fields(const google_protobuf_Struct* msg) {
81 _upb_array_detach(msg, UPB_SIZE(0, 0));
82 }
83 UPB_INLINE size_t google_protobuf_Struct_fields_size(const google_protobuf_Struct* msg) {
84 return _upb_msg_map_size(msg, UPB_SIZE(0, 0));
85 }
86 UPB_INLINE bool google_protobuf_Struct_fields_get(const google_protobuf_Struct* msg, upb_StringView key, google_protobuf_Value** val) {
87 return _upb_msg_map_get(msg, UPB_SIZE(0, 0), &key, 0, val, sizeof(*val));
88 }
89 UPB_INLINE const google_protobuf_Struct_FieldsEntry* google_protobuf_Struct_fields_next(const google_protobuf_Struct* msg, size_t* iter) {
90 return (const google_protobuf_Struct_FieldsEntry*)_upb_msg_map_next(msg, UPB_SIZE(0, 0), iter);
91 }
92
93 UPB_INLINE void google_protobuf_Struct_fields_clear(google_protobuf_Struct* msg) { _upb_msg_map_clear(msg, UPB_SIZE(0, 0)); }
94 UPB_INLINE bool google_protobuf_Struct_fields_set(google_protobuf_Struct* msg, upb_StringView key, google_protobuf_Value* val, upb_Arena* a) {
95 return _upb_msg_map_set(msg, UPB_SIZE(0, 0), &key, 0, &val, sizeof(val), a);
96 }
97 UPB_INLINE bool google_protobuf_Struct_fields_delete(google_protobuf_Struct* msg, upb_StringView key) {
98 return _upb_msg_map_delete(msg, UPB_SIZE(0, 0), &key, 0);
99 }
100 UPB_INLINE google_protobuf_Struct_FieldsEntry* google_protobuf_Struct_fields_nextmutable(google_protobuf_Struct* msg, size_t* iter) {
101 return (google_protobuf_Struct_FieldsEntry*)_upb_msg_map_next(msg, UPB_SIZE(0, 0), iter);
102 }
103
104 /* google.protobuf.Struct.FieldsEntry */
105
106 UPB_INLINE upb_StringView google_protobuf_Struct_FieldsEntry_key(const google_protobuf_Struct_FieldsEntry* msg) {
107 upb_StringView ret;
108 _upb_msg_map_key(msg, &ret, 0);
109 return ret;
110 }
111 UPB_INLINE bool google_protobuf_Struct_FieldsEntry_has_value(const google_protobuf_Struct_FieldsEntry* msg) {
112 return _upb_has_submsg_nohasbit(msg, UPB_SIZE(8, 16));
113 }
114 UPB_INLINE const google_protobuf_Value* google_protobuf_Struct_FieldsEntry_value(const google_protobuf_Struct_FieldsEntry* msg) {
115 google_protobuf_Value* ret;
116 _upb_msg_map_value(msg, &ret, sizeof(ret));
117 return ret;
118 }
119
120 UPB_INLINE void google_protobuf_Struct_FieldsEntry_set_value(google_protobuf_Struct_FieldsEntry *msg, google_protobuf_Value* value) {
121 _upb_msg_map_set_value(msg, &value, sizeof(google_protobuf_Value*));
122 }
123
124 /* google.protobuf.Value */
125
126 UPB_INLINE google_protobuf_Value* google_protobuf_Value_new(upb_Arena* arena) {
127 return (google_protobuf_Value*)_upb_Message_New(&google_protobuf_Value_msginit, arena);
128 }
129 UPB_INLINE google_protobuf_Value* google_protobuf_Value_parse(const char* buf, size_t size, upb_Arena* arena) {
130 google_protobuf_Value* ret = google_protobuf_Value_new(arena);
131 if (!ret) return NULL;
132 if (upb_Decode(buf, size, ret, &google_protobuf_Value_msginit, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
133 return NULL;
134 }
135 return ret;
136 }
137 UPB_INLINE google_protobuf_Value* google_protobuf_Value_parse_ex(const char* buf, size_t size,
138 const upb_ExtensionRegistry* extreg,
139 int options, upb_Arena* arena) {
140 google_protobuf_Value* ret = google_protobuf_Value_new(arena);
141 if (!ret) return NULL;
142 if (upb_Decode(buf, size, ret, &google_protobuf_Value_msginit, extreg, options, arena) !=
143 kUpb_DecodeStatus_Ok) {
144 return NULL;
145 }
146 return ret;
147 }
148 UPB_INLINE char* google_protobuf_Value_serialize(const google_protobuf_Value* msg, upb_Arena* arena, size_t* len) {
149 char* ptr;
150 (void)upb_Encode(msg, &google_protobuf_Value_msginit, 0, arena, &ptr, len);
151 return ptr;
152 }
153 UPB_INLINE char* google_protobuf_Value_serialize_ex(const google_protobuf_Value* msg, int options,
154 upb_Arena* arena, size_t* len) {
155 char* ptr;
156 (void)upb_Encode(msg, &google_protobuf_Value_msginit, options, arena, &ptr, len);
157 return ptr;
158 }
159 typedef enum {
160 google_protobuf_Value_kind_null_value = 1,
161 google_protobuf_Value_kind_number_value = 2,
162 google_protobuf_Value_kind_string_value = 3,
163 google_protobuf_Value_kind_bool_value = 4,
164 google_protobuf_Value_kind_struct_value = 5,
165 google_protobuf_Value_kind_list_value = 6,
166 google_protobuf_Value_kind_NOT_SET = 0
167 } google_protobuf_Value_kind_oneofcases;
168 UPB_INLINE google_protobuf_Value_kind_oneofcases google_protobuf_Value_kind_case(const google_protobuf_Value* msg) {
169 return (google_protobuf_Value_kind_oneofcases)*UPB_PTR_AT(msg, UPB_SIZE(0, 0), int32_t);
170 }
171 UPB_INLINE bool google_protobuf_Value_has_null_value(const google_protobuf_Value* msg) {
172 return _upb_getoneofcase(msg, UPB_SIZE(0, 0)) == 1;
173 }
174 UPB_INLINE void google_protobuf_Value_clear_null_value(const google_protobuf_Value* msg) {
175 UPB_WRITE_ONEOF(msg, int32_t, UPB_SIZE(8, 8), 0, UPB_SIZE(0, 0), google_protobuf_Value_kind_NOT_SET);
176 }
177 UPB_INLINE int32_t google_protobuf_Value_null_value(const google_protobuf_Value* msg) {
178 return UPB_READ_ONEOF(msg, int32_t, UPB_SIZE(8, 8), UPB_SIZE(0, 0), 1, 0);
179 }
180 UPB_INLINE bool google_protobuf_Value_has_number_value(const google_protobuf_Value* msg) {
181 return _upb_getoneofcase(msg, UPB_SIZE(0, 0)) == 2;
182 }
183 UPB_INLINE void google_protobuf_Value_clear_number_value(const google_protobuf_Value* msg) {
184 UPB_WRITE_ONEOF(msg, double, UPB_SIZE(8, 8), 0, UPB_SIZE(0, 0), google_protobuf_Value_kind_NOT_SET);
185 }
186 UPB_INLINE double google_protobuf_Value_number_value(const google_protobuf_Value* msg) {
187 return UPB_READ_ONEOF(msg, double, UPB_SIZE(8, 8), UPB_SIZE(0, 0), 2, 0);
188 }
189 UPB_INLINE bool google_protobuf_Value_has_string_value(const google_protobuf_Value* msg) {
190 return _upb_getoneofcase(msg, UPB_SIZE(0, 0)) == 3;
191 }
192 UPB_INLINE void google_protobuf_Value_clear_string_value(const google_protobuf_Value* msg) {
193 UPB_WRITE_ONEOF(msg, upb_StringView, UPB_SIZE(8, 8), upb_StringView_FromDataAndSize(NULL, 0), UPB_SIZE(0, 0), google_protobuf_Value_kind_NOT_SET);
194 }
195 UPB_INLINE upb_StringView google_protobuf_Value_string_value(const google_protobuf_Value* msg) {
196 return UPB_READ_ONEOF(msg, upb_StringView, UPB_SIZE(8, 8), UPB_SIZE(0, 0), 3, upb_StringView_FromString(""));
197 }
198 UPB_INLINE bool google_protobuf_Value_has_bool_value(const google_protobuf_Value* msg) {
199 return _upb_getoneofcase(msg, UPB_SIZE(0, 0)) == 4;
200 }
201 UPB_INLINE void google_protobuf_Value_clear_bool_value(const google_protobuf_Value* msg) {
202 UPB_WRITE_ONEOF(msg, bool, UPB_SIZE(8, 8), 0, UPB_SIZE(0, 0), google_protobuf_Value_kind_NOT_SET);
203 }
204 UPB_INLINE bool google_protobuf_Value_bool_value(const google_protobuf_Value* msg) {
205 return UPB_READ_ONEOF(msg, bool, UPB_SIZE(8, 8), UPB_SIZE(0, 0), 4, false);
206 }
207 UPB_INLINE bool google_protobuf_Value_has_struct_value(const google_protobuf_Value* msg) {
208 return _upb_getoneofcase(msg, UPB_SIZE(0, 0)) == 5;
209 }
210 UPB_INLINE void google_protobuf_Value_clear_struct_value(const google_protobuf_Value* msg) {
211 UPB_WRITE_ONEOF(msg, google_protobuf_Struct*, UPB_SIZE(8, 8), 0, UPB_SIZE(0, 0), google_protobuf_Value_kind_NOT_SET);
212 }
213 UPB_INLINE const google_protobuf_Struct* google_protobuf_Value_struct_value(const google_protobuf_Value* msg) {
214 return UPB_READ_ONEOF(msg, const google_protobuf_Struct*, UPB_SIZE(8, 8), UPB_SIZE(0, 0), 5, NULL);
215 }
216 UPB_INLINE bool google_protobuf_Value_has_list_value(const google_protobuf_Value* msg) {
217 return _upb_getoneofcase(msg, UPB_SIZE(0, 0)) == 6;
218 }
219 UPB_INLINE void google_protobuf_Value_clear_list_value(const google_protobuf_Value* msg) {
220 UPB_WRITE_ONEOF(msg, google_protobuf_ListValue*, UPB_SIZE(8, 8), 0, UPB_SIZE(0, 0), google_protobuf_Value_kind_NOT_SET);
221 }
222 UPB_INLINE const google_protobuf_ListValue* google_protobuf_Value_list_value(const google_protobuf_Value* msg) {
223 return UPB_READ_ONEOF(msg, const google_protobuf_ListValue*, UPB_SIZE(8, 8), UPB_SIZE(0, 0), 6, NULL);
224 }
225
226 UPB_INLINE void google_protobuf_Value_set_null_value(google_protobuf_Value *msg, int32_t value) {
227 UPB_WRITE_ONEOF(msg, int32_t, UPB_SIZE(8, 8), value, UPB_SIZE(0, 0), 1);
228 }
229 UPB_INLINE void google_protobuf_Value_set_number_value(google_protobuf_Value *msg, double value) {
230 UPB_WRITE_ONEOF(msg, double, UPB_SIZE(8, 8), value, UPB_SIZE(0, 0), 2);
231 }
232 UPB_INLINE void google_protobuf_Value_set_string_value(google_protobuf_Value *msg, upb_StringView value) {
233 UPB_WRITE_ONEOF(msg, upb_StringView, UPB_SIZE(8, 8), value, UPB_SIZE(0, 0), 3);
234 }
235 UPB_INLINE void google_protobuf_Value_set_bool_value(google_protobuf_Value *msg, bool value) {
236 UPB_WRITE_ONEOF(msg, bool, UPB_SIZE(8, 8), value, UPB_SIZE(0, 0), 4);
237 }
238 UPB_INLINE void google_protobuf_Value_set_struct_value(google_protobuf_Value *msg, google_protobuf_Struct* value) {
239 UPB_WRITE_ONEOF(msg, google_protobuf_Struct*, UPB_SIZE(8, 8), value, UPB_SIZE(0, 0), 5);
240 }
241 UPB_INLINE struct google_protobuf_Struct* google_protobuf_Value_mutable_struct_value(google_protobuf_Value* msg, upb_Arena* arena) {
242 struct google_protobuf_Struct* sub = (struct google_protobuf_Struct*)google_protobuf_Value_struct_value(msg);
243 if (sub == NULL) {
244 sub = (struct google_protobuf_Struct*)_upb_Message_New(&google_protobuf_Struct_msginit, arena);
245 if (!sub) return NULL;
246 google_protobuf_Value_set_struct_value(msg, sub);
247 }
248 return sub;
249 }
250 UPB_INLINE void google_protobuf_Value_set_list_value(google_protobuf_Value *msg, google_protobuf_ListValue* value) {
251 UPB_WRITE_ONEOF(msg, google_protobuf_ListValue*, UPB_SIZE(8, 8), value, UPB_SIZE(0, 0), 6);
252 }
253 UPB_INLINE struct google_protobuf_ListValue* google_protobuf_Value_mutable_list_value(google_protobuf_Value* msg, upb_Arena* arena) {
254 struct google_protobuf_ListValue* sub = (struct google_protobuf_ListValue*)google_protobuf_Value_list_value(msg);
255 if (sub == NULL) {
256 sub = (struct google_protobuf_ListValue*)_upb_Message_New(&google_protobuf_ListValue_msginit, arena);
257 if (!sub) return NULL;
258 google_protobuf_Value_set_list_value(msg, sub);
259 }
260 return sub;
261 }
262
263 /* google.protobuf.ListValue */
264
265 UPB_INLINE google_protobuf_ListValue* google_protobuf_ListValue_new(upb_Arena* arena) {
266 return (google_protobuf_ListValue*)_upb_Message_New(&google_protobuf_ListValue_msginit, arena);
267 }
268 UPB_INLINE google_protobuf_ListValue* google_protobuf_ListValue_parse(const char* buf, size_t size, upb_Arena* arena) {
269 google_protobuf_ListValue* ret = google_protobuf_ListValue_new(arena);
270 if (!ret) return NULL;
271 if (upb_Decode(buf, size, ret, &google_protobuf_ListValue_msginit, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
272 return NULL;
273 }
274 return ret;
275 }
276 UPB_INLINE google_protobuf_ListValue* google_protobuf_ListValue_parse_ex(const char* buf, size_t size,
277 const upb_ExtensionRegistry* extreg,
278 int options, upb_Arena* arena) {
279 google_protobuf_ListValue* ret = google_protobuf_ListValue_new(arena);
280 if (!ret) return NULL;
281 if (upb_Decode(buf, size, ret, &google_protobuf_ListValue_msginit, extreg, options, arena) !=
282 kUpb_DecodeStatus_Ok) {
283 return NULL;
284 }
285 return ret;
286 }
287 UPB_INLINE char* google_protobuf_ListValue_serialize(const google_protobuf_ListValue* msg, upb_Arena* arena, size_t* len) {
288 char* ptr;
289 (void)upb_Encode(msg, &google_protobuf_ListValue_msginit, 0, arena, &ptr, len);
290 return ptr;
291 }
292 UPB_INLINE char* google_protobuf_ListValue_serialize_ex(const google_protobuf_ListValue* msg, int options,
293 upb_Arena* arena, size_t* len) {
294 char* ptr;
295 (void)upb_Encode(msg, &google_protobuf_ListValue_msginit, options, arena, &ptr, len);
296 return ptr;
297 }
298 UPB_INLINE bool google_protobuf_ListValue_has_values(const google_protobuf_ListValue* msg) {
299 return _upb_has_submsg_nohasbit(msg, UPB_SIZE(0, 0));
300 }
301 UPB_INLINE void google_protobuf_ListValue_clear_values(const google_protobuf_ListValue* msg) {
302 _upb_array_detach(msg, UPB_SIZE(0, 0));
303 }
304 UPB_INLINE const google_protobuf_Value* const* google_protobuf_ListValue_values(const google_protobuf_ListValue* msg, size_t* len) {
305 return (const google_protobuf_Value* const*)_upb_array_accessor(msg, UPB_SIZE(0, 0), len);
306 }
307
308 UPB_INLINE google_protobuf_Value** google_protobuf_ListValue_mutable_values(google_protobuf_ListValue* msg, size_t* len) {
309 return (google_protobuf_Value**)_upb_array_mutable_accessor(msg, UPB_SIZE(0, 0), len);
310 }
311 UPB_INLINE google_protobuf_Value** google_protobuf_ListValue_resize_values(google_protobuf_ListValue* msg, size_t len, upb_Arena* arena) {
312 return (google_protobuf_Value**)_upb_Array_Resize_accessor2(msg, UPB_SIZE(0, 0), len, UPB_SIZE(2, 3), arena);
313 }
314 UPB_INLINE struct google_protobuf_Value* google_protobuf_ListValue_add_values(google_protobuf_ListValue* msg, upb_Arena* arena) {
315 struct google_protobuf_Value* sub = (struct google_protobuf_Value*)_upb_Message_New(&google_protobuf_Value_msginit, arena);
316 bool ok = _upb_Array_Append_accessor2(msg, UPB_SIZE(0, 0), UPB_SIZE(2, 3), &sub, arena);
317 if (!ok) return NULL;
318 return sub;
319 }
320
321 extern const upb_MiniTable_File google_protobuf_struct_proto_upb_file_layout;
322
323 #ifdef __cplusplus
324 } /* extern "C" */
325 #endif
326
327 #include "upb/port_undef.inc"
328
329 #endif /* GOOGLE_PROTOBUF_STRUCT_PROTO_UPB_H_ */