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/collections/array_internal.h"
13 #include "upb/collections/map_gencode_util.h"
14 #include "upb/message/accessors.h"
15 #include "upb/message/internal.h"
16 #include "upb/mini_table/enum_internal.h"
17 #include "upb/wire/decode.h"
18 #include "upb/wire/decode_fast.h"
19 #include "upb/wire/encode.h"
20 
21 // Must be last.
22 #include "upb/port/def.inc"
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 typedef struct google_protobuf_Struct google_protobuf_Struct;
29 typedef struct google_protobuf_Struct_FieldsEntry google_protobuf_Struct_FieldsEntry;
30 typedef struct google_protobuf_Value google_protobuf_Value;
31 typedef struct google_protobuf_ListValue google_protobuf_ListValue;
32 extern const upb_MiniTable google_protobuf_Struct_msg_init;
33 extern const upb_MiniTable google_protobuf_Struct_FieldsEntry_msg_init;
34 extern const upb_MiniTable google_protobuf_Value_msg_init;
35 extern const upb_MiniTable google_protobuf_ListValue_msg_init;
36 
37 typedef enum {
38   google_protobuf_NULL_VALUE = 0
39 } google_protobuf_NullValue;
40 
41 
42 
43 /* google.protobuf.Struct */
44 
google_protobuf_Struct_new(upb_Arena * arena)45 UPB_INLINE google_protobuf_Struct* google_protobuf_Struct_new(upb_Arena* arena) {
46   return (google_protobuf_Struct*)_upb_Message_New(&google_protobuf_Struct_msg_init, arena);
47 }
google_protobuf_Struct_parse(const char * buf,size_t size,upb_Arena * arena)48 UPB_INLINE google_protobuf_Struct* google_protobuf_Struct_parse(const char* buf, size_t size, upb_Arena* arena) {
49   google_protobuf_Struct* ret = google_protobuf_Struct_new(arena);
50   if (!ret) return NULL;
51   if (upb_Decode(buf, size, ret, &google_protobuf_Struct_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
52     return NULL;
53   }
54   return ret;
55 }
google_protobuf_Struct_parse_ex(const char * buf,size_t size,const upb_ExtensionRegistry * extreg,int options,upb_Arena * arena)56 UPB_INLINE google_protobuf_Struct* google_protobuf_Struct_parse_ex(const char* buf, size_t size,
57                            const upb_ExtensionRegistry* extreg,
58                            int options, upb_Arena* arena) {
59   google_protobuf_Struct* ret = google_protobuf_Struct_new(arena);
60   if (!ret) return NULL;
61   if (upb_Decode(buf, size, ret, &google_protobuf_Struct_msg_init, extreg, options, arena) !=
62       kUpb_DecodeStatus_Ok) {
63     return NULL;
64   }
65   return ret;
66 }
google_protobuf_Struct_serialize(const google_protobuf_Struct * msg,upb_Arena * arena,size_t * len)67 UPB_INLINE char* google_protobuf_Struct_serialize(const google_protobuf_Struct* msg, upb_Arena* arena, size_t* len) {
68   char* ptr;
69   (void)upb_Encode(msg, &google_protobuf_Struct_msg_init, 0, arena, &ptr, len);
70   return ptr;
71 }
google_protobuf_Struct_serialize_ex(const google_protobuf_Struct * msg,int options,upb_Arena * arena,size_t * len)72 UPB_INLINE char* google_protobuf_Struct_serialize_ex(const google_protobuf_Struct* msg, int options,
73                                  upb_Arena* arena, size_t* len) {
74   char* ptr;
75   (void)upb_Encode(msg, &google_protobuf_Struct_msg_init, options, arena, &ptr, len);
76   return ptr;
77 }
google_protobuf_Struct_clear_fields(google_protobuf_Struct * msg)78 UPB_INLINE void google_protobuf_Struct_clear_fields(google_protobuf_Struct* msg) {
79   const upb_MiniTableField field = {1, 0, 0, 0, 11, kUpb_FieldMode_Map | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
80   _upb_Message_ClearNonExtensionField(msg, &field);
81 }
google_protobuf_Struct_fields_size(const google_protobuf_Struct * msg)82 UPB_INLINE size_t google_protobuf_Struct_fields_size(const google_protobuf_Struct* msg) {
83   const upb_MiniTableField field = {1, 0, 0, 0, 11, kUpb_FieldMode_Map | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
84   const upb_Map* map = upb_Message_GetMap(msg, &field);
85   return map ? _upb_Map_Size(map) : 0;
86 }
google_protobuf_Struct_fields_get(const google_protobuf_Struct * msg,upb_StringView key,google_protobuf_Value ** val)87 UPB_INLINE bool google_protobuf_Struct_fields_get(const google_protobuf_Struct* msg, upb_StringView key, google_protobuf_Value** val) {
88   const upb_MiniTableField field = {1, 0, 0, 0, 11, kUpb_FieldMode_Map | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
89   const upb_Map* map = upb_Message_GetMap(msg, &field);
90   if (!map) return false;
91   return _upb_Map_Get(map, &key, 0, val, sizeof(*val));
92 }
google_protobuf_Struct_fields_next(const google_protobuf_Struct * msg,size_t * iter)93 UPB_INLINE const google_protobuf_Struct_FieldsEntry* google_protobuf_Struct_fields_next(const google_protobuf_Struct* msg, size_t* iter) {
94   const upb_MiniTableField field = {1, 0, 0, 0, 11, kUpb_FieldMode_Map | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
95   const upb_Map* map = upb_Message_GetMap(msg, &field);
96   if (!map) return NULL;
97   return (const google_protobuf_Struct_FieldsEntry*)_upb_map_next(map, iter);
98 }
99 
google_protobuf_Struct_fields_clear(google_protobuf_Struct * msg)100 UPB_INLINE void google_protobuf_Struct_fields_clear(google_protobuf_Struct* msg) {
101   const upb_MiniTableField field = {1, 0, 0, 0, 11, kUpb_FieldMode_Map | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
102   upb_Map* map = (upb_Map*)upb_Message_GetMap(msg, &field);
103   if (!map) return;
104   _upb_Map_Clear(map);
105 }
google_protobuf_Struct_fields_set(google_protobuf_Struct * msg,upb_StringView key,google_protobuf_Value * val,upb_Arena * a)106 UPB_INLINE bool google_protobuf_Struct_fields_set(google_protobuf_Struct* msg, upb_StringView key, google_protobuf_Value* val, upb_Arena* a) {
107   const upb_MiniTableField field = {1, 0, 0, 0, 11, kUpb_FieldMode_Map | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
108   upb_Map* map = _upb_Message_GetOrCreateMutableMap(msg, &field, 0, sizeof(val), a);
109   return _upb_Map_Insert(map, &key, 0, &val, sizeof(val), a) !=
110          kUpb_MapInsertStatus_OutOfMemory;
111 }
google_protobuf_Struct_fields_delete(google_protobuf_Struct * msg,upb_StringView key)112 UPB_INLINE bool google_protobuf_Struct_fields_delete(google_protobuf_Struct* msg, upb_StringView key) {
113   const upb_MiniTableField field = {1, 0, 0, 0, 11, kUpb_FieldMode_Map | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
114   upb_Map* map = (upb_Map*)upb_Message_GetMap(msg, &field);
115   if (!map) return false;
116   return _upb_Map_Delete(map, &key, 0, NULL);
117 }
google_protobuf_Struct_fields_nextmutable(google_protobuf_Struct * msg,size_t * iter)118 UPB_INLINE google_protobuf_Struct_FieldsEntry* google_protobuf_Struct_fields_nextmutable(google_protobuf_Struct* msg, size_t* iter) {
119   const upb_MiniTableField field = {1, 0, 0, 0, 11, kUpb_FieldMode_Map | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
120   upb_Map* map = (upb_Map*)upb_Message_GetMap(msg, &field);
121   if (!map) return NULL;
122   return (google_protobuf_Struct_FieldsEntry*)_upb_map_next(map, iter);
123 }
124 
125 /* google.protobuf.Struct.FieldsEntry */
126 
google_protobuf_Struct_FieldsEntry_key(const google_protobuf_Struct_FieldsEntry * msg)127 UPB_INLINE upb_StringView google_protobuf_Struct_FieldsEntry_key(const google_protobuf_Struct_FieldsEntry* msg) {
128   upb_StringView ret;
129   _upb_msg_map_key(msg, &ret, 0);
130   return ret;
131 }
google_protobuf_Struct_FieldsEntry_value(const google_protobuf_Struct_FieldsEntry * msg)132 UPB_INLINE const google_protobuf_Value* google_protobuf_Struct_FieldsEntry_value(const google_protobuf_Struct_FieldsEntry* msg) {
133   google_protobuf_Value* ret;
134   _upb_msg_map_value(msg, &ret, sizeof(ret));
135   return ret;
136 }
google_protobuf_Struct_FieldsEntry_has_value(const google_protobuf_Struct_FieldsEntry * msg)137 UPB_INLINE bool google_protobuf_Struct_FieldsEntry_has_value(const google_protobuf_Struct_FieldsEntry* msg) {
138   const upb_MiniTableField field = {2, UPB_SIZE(16, 24), 1, 0, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
139   return _upb_Message_HasNonExtensionField(msg, &field);
140 }
141 
google_protobuf_Struct_FieldsEntry_set_value(google_protobuf_Struct_FieldsEntry * msg,google_protobuf_Value * value)142 UPB_INLINE void google_protobuf_Struct_FieldsEntry_set_value(google_protobuf_Struct_FieldsEntry *msg, google_protobuf_Value* value) {
143   _upb_msg_map_set_value(msg, &value, sizeof(google_protobuf_Value*));
144 }
145 
146 /* google.protobuf.Value */
147 
google_protobuf_Value_new(upb_Arena * arena)148 UPB_INLINE google_protobuf_Value* google_protobuf_Value_new(upb_Arena* arena) {
149   return (google_protobuf_Value*)_upb_Message_New(&google_protobuf_Value_msg_init, arena);
150 }
google_protobuf_Value_parse(const char * buf,size_t size,upb_Arena * arena)151 UPB_INLINE google_protobuf_Value* google_protobuf_Value_parse(const char* buf, size_t size, upb_Arena* arena) {
152   google_protobuf_Value* ret = google_protobuf_Value_new(arena);
153   if (!ret) return NULL;
154   if (upb_Decode(buf, size, ret, &google_protobuf_Value_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
155     return NULL;
156   }
157   return ret;
158 }
google_protobuf_Value_parse_ex(const char * buf,size_t size,const upb_ExtensionRegistry * extreg,int options,upb_Arena * arena)159 UPB_INLINE google_protobuf_Value* google_protobuf_Value_parse_ex(const char* buf, size_t size,
160                            const upb_ExtensionRegistry* extreg,
161                            int options, upb_Arena* arena) {
162   google_protobuf_Value* ret = google_protobuf_Value_new(arena);
163   if (!ret) return NULL;
164   if (upb_Decode(buf, size, ret, &google_protobuf_Value_msg_init, extreg, options, arena) !=
165       kUpb_DecodeStatus_Ok) {
166     return NULL;
167   }
168   return ret;
169 }
google_protobuf_Value_serialize(const google_protobuf_Value * msg,upb_Arena * arena,size_t * len)170 UPB_INLINE char* google_protobuf_Value_serialize(const google_protobuf_Value* msg, upb_Arena* arena, size_t* len) {
171   char* ptr;
172   (void)upb_Encode(msg, &google_protobuf_Value_msg_init, 0, arena, &ptr, len);
173   return ptr;
174 }
google_protobuf_Value_serialize_ex(const google_protobuf_Value * msg,int options,upb_Arena * arena,size_t * len)175 UPB_INLINE char* google_protobuf_Value_serialize_ex(const google_protobuf_Value* msg, int options,
176                                  upb_Arena* arena, size_t* len) {
177   char* ptr;
178   (void)upb_Encode(msg, &google_protobuf_Value_msg_init, options, arena, &ptr, len);
179   return ptr;
180 }
181 typedef enum {
182   google_protobuf_Value_kind_null_value = 1,
183   google_protobuf_Value_kind_number_value = 2,
184   google_protobuf_Value_kind_string_value = 3,
185   google_protobuf_Value_kind_bool_value = 4,
186   google_protobuf_Value_kind_struct_value = 5,
187   google_protobuf_Value_kind_list_value = 6,
188   google_protobuf_Value_kind_NOT_SET = 0
189 } google_protobuf_Value_kind_oneofcases;
google_protobuf_Value_kind_case(const google_protobuf_Value * msg)190 UPB_INLINE google_protobuf_Value_kind_oneofcases google_protobuf_Value_kind_case(const google_protobuf_Value* msg) {
191   const upb_MiniTableField field = {1, 8, -1, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
192   return (google_protobuf_Value_kind_oneofcases)upb_Message_WhichOneofFieldNumber(msg, &field);
193 }
google_protobuf_Value_clear_null_value(google_protobuf_Value * msg)194 UPB_INLINE void google_protobuf_Value_clear_null_value(google_protobuf_Value* msg) {
195   const upb_MiniTableField field = {1, 8, -1, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
196   _upb_Message_ClearNonExtensionField(msg, &field);
197 }
google_protobuf_Value_null_value(const google_protobuf_Value * msg)198 UPB_INLINE int32_t google_protobuf_Value_null_value(const google_protobuf_Value* msg) {
199   int32_t default_val = 0;
200   int32_t ret;
201   const upb_MiniTableField field = {1, 8, -1, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
202   _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
203   return ret;
204 }
google_protobuf_Value_has_null_value(const google_protobuf_Value * msg)205 UPB_INLINE bool google_protobuf_Value_has_null_value(const google_protobuf_Value* msg) {
206   const upb_MiniTableField field = {1, 8, -1, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
207   return _upb_Message_HasNonExtensionField(msg, &field);
208 }
google_protobuf_Value_clear_number_value(google_protobuf_Value * msg)209 UPB_INLINE void google_protobuf_Value_clear_number_value(google_protobuf_Value* msg) {
210   const upb_MiniTableField field = {2, 8, -1, kUpb_NoSub, 1, kUpb_FieldMode_Scalar | (kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)};
211   _upb_Message_ClearNonExtensionField(msg, &field);
212 }
google_protobuf_Value_number_value(const google_protobuf_Value * msg)213 UPB_INLINE double google_protobuf_Value_number_value(const google_protobuf_Value* msg) {
214   double default_val = 0;
215   double ret;
216   const upb_MiniTableField field = {2, 8, -1, kUpb_NoSub, 1, kUpb_FieldMode_Scalar | (kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)};
217   _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
218   return ret;
219 }
google_protobuf_Value_has_number_value(const google_protobuf_Value * msg)220 UPB_INLINE bool google_protobuf_Value_has_number_value(const google_protobuf_Value* msg) {
221   const upb_MiniTableField field = {2, 8, -1, kUpb_NoSub, 1, kUpb_FieldMode_Scalar | (kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)};
222   return _upb_Message_HasNonExtensionField(msg, &field);
223 }
google_protobuf_Value_clear_string_value(google_protobuf_Value * msg)224 UPB_INLINE void google_protobuf_Value_clear_string_value(google_protobuf_Value* msg) {
225   const upb_MiniTableField field = {3, 8, -1, kUpb_NoSub, 9, kUpb_FieldMode_Scalar | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
226   _upb_Message_ClearNonExtensionField(msg, &field);
227 }
google_protobuf_Value_string_value(const google_protobuf_Value * msg)228 UPB_INLINE upb_StringView google_protobuf_Value_string_value(const google_protobuf_Value* msg) {
229   upb_StringView default_val = upb_StringView_FromString("");
230   upb_StringView ret;
231   const upb_MiniTableField field = {3, 8, -1, kUpb_NoSub, 9, kUpb_FieldMode_Scalar | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
232   _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
233   return ret;
234 }
google_protobuf_Value_has_string_value(const google_protobuf_Value * msg)235 UPB_INLINE bool google_protobuf_Value_has_string_value(const google_protobuf_Value* msg) {
236   const upb_MiniTableField field = {3, 8, -1, kUpb_NoSub, 9, kUpb_FieldMode_Scalar | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
237   return _upb_Message_HasNonExtensionField(msg, &field);
238 }
google_protobuf_Value_clear_bool_value(google_protobuf_Value * msg)239 UPB_INLINE void google_protobuf_Value_clear_bool_value(google_protobuf_Value* msg) {
240   const upb_MiniTableField field = {4, 8, -1, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
241   _upb_Message_ClearNonExtensionField(msg, &field);
242 }
google_protobuf_Value_bool_value(const google_protobuf_Value * msg)243 UPB_INLINE bool google_protobuf_Value_bool_value(const google_protobuf_Value* msg) {
244   bool default_val = false;
245   bool ret;
246   const upb_MiniTableField field = {4, 8, -1, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
247   _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
248   return ret;
249 }
google_protobuf_Value_has_bool_value(const google_protobuf_Value * msg)250 UPB_INLINE bool google_protobuf_Value_has_bool_value(const google_protobuf_Value* msg) {
251   const upb_MiniTableField field = {4, 8, -1, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
252   return _upb_Message_HasNonExtensionField(msg, &field);
253 }
google_protobuf_Value_clear_struct_value(google_protobuf_Value * msg)254 UPB_INLINE void google_protobuf_Value_clear_struct_value(google_protobuf_Value* msg) {
255   const upb_MiniTableField field = {5, 8, -1, 0, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
256   _upb_Message_ClearNonExtensionField(msg, &field);
257 }
google_protobuf_Value_struct_value(const google_protobuf_Value * msg)258 UPB_INLINE const google_protobuf_Struct* google_protobuf_Value_struct_value(const google_protobuf_Value* msg) {
259   const google_protobuf_Struct* default_val = NULL;
260   const google_protobuf_Struct* ret;
261   const upb_MiniTableField field = {5, 8, -1, 0, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
262   _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
263   return ret;
264 }
google_protobuf_Value_has_struct_value(const google_protobuf_Value * msg)265 UPB_INLINE bool google_protobuf_Value_has_struct_value(const google_protobuf_Value* msg) {
266   const upb_MiniTableField field = {5, 8, -1, 0, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
267   return _upb_Message_HasNonExtensionField(msg, &field);
268 }
google_protobuf_Value_clear_list_value(google_protobuf_Value * msg)269 UPB_INLINE void google_protobuf_Value_clear_list_value(google_protobuf_Value* msg) {
270   const upb_MiniTableField field = {6, 8, -1, 1, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
271   _upb_Message_ClearNonExtensionField(msg, &field);
272 }
google_protobuf_Value_list_value(const google_protobuf_Value * msg)273 UPB_INLINE const google_protobuf_ListValue* google_protobuf_Value_list_value(const google_protobuf_Value* msg) {
274   const google_protobuf_ListValue* default_val = NULL;
275   const google_protobuf_ListValue* ret;
276   const upb_MiniTableField field = {6, 8, -1, 1, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
277   _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
278   return ret;
279 }
google_protobuf_Value_has_list_value(const google_protobuf_Value * msg)280 UPB_INLINE bool google_protobuf_Value_has_list_value(const google_protobuf_Value* msg) {
281   const upb_MiniTableField field = {6, 8, -1, 1, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
282   return _upb_Message_HasNonExtensionField(msg, &field);
283 }
284 
google_protobuf_Value_set_null_value(google_protobuf_Value * msg,int32_t value)285 UPB_INLINE void google_protobuf_Value_set_null_value(google_protobuf_Value *msg, int32_t value) {
286   const upb_MiniTableField field = {1, 8, -1, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
287   _upb_Message_SetNonExtensionField(msg, &field, &value);
288 }
google_protobuf_Value_set_number_value(google_protobuf_Value * msg,double value)289 UPB_INLINE void google_protobuf_Value_set_number_value(google_protobuf_Value *msg, double value) {
290   const upb_MiniTableField field = {2, 8, -1, kUpb_NoSub, 1, kUpb_FieldMode_Scalar | (kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)};
291   _upb_Message_SetNonExtensionField(msg, &field, &value);
292 }
google_protobuf_Value_set_string_value(google_protobuf_Value * msg,upb_StringView value)293 UPB_INLINE void google_protobuf_Value_set_string_value(google_protobuf_Value *msg, upb_StringView value) {
294   const upb_MiniTableField field = {3, 8, -1, kUpb_NoSub, 9, kUpb_FieldMode_Scalar | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
295   _upb_Message_SetNonExtensionField(msg, &field, &value);
296 }
google_protobuf_Value_set_bool_value(google_protobuf_Value * msg,bool value)297 UPB_INLINE void google_protobuf_Value_set_bool_value(google_protobuf_Value *msg, bool value) {
298   const upb_MiniTableField field = {4, 8, -1, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
299   _upb_Message_SetNonExtensionField(msg, &field, &value);
300 }
google_protobuf_Value_set_struct_value(google_protobuf_Value * msg,google_protobuf_Struct * value)301 UPB_INLINE void google_protobuf_Value_set_struct_value(google_protobuf_Value *msg, google_protobuf_Struct* value) {
302   const upb_MiniTableField field = {5, 8, -1, 0, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
303   _upb_Message_SetNonExtensionField(msg, &field, &value);
304 }
google_protobuf_Value_mutable_struct_value(google_protobuf_Value * msg,upb_Arena * arena)305 UPB_INLINE struct google_protobuf_Struct* google_protobuf_Value_mutable_struct_value(google_protobuf_Value* msg, upb_Arena* arena) {
306   struct google_protobuf_Struct* sub = (struct google_protobuf_Struct*)google_protobuf_Value_struct_value(msg);
307   if (sub == NULL) {
308     sub = (struct google_protobuf_Struct*)_upb_Message_New(&google_protobuf_Struct_msg_init, arena);
309     if (sub) google_protobuf_Value_set_struct_value(msg, sub);
310   }
311   return sub;
312 }
google_protobuf_Value_set_list_value(google_protobuf_Value * msg,google_protobuf_ListValue * value)313 UPB_INLINE void google_protobuf_Value_set_list_value(google_protobuf_Value *msg, google_protobuf_ListValue* value) {
314   const upb_MiniTableField field = {6, 8, -1, 1, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
315   _upb_Message_SetNonExtensionField(msg, &field, &value);
316 }
google_protobuf_Value_mutable_list_value(google_protobuf_Value * msg,upb_Arena * arena)317 UPB_INLINE struct google_protobuf_ListValue* google_protobuf_Value_mutable_list_value(google_protobuf_Value* msg, upb_Arena* arena) {
318   struct google_protobuf_ListValue* sub = (struct google_protobuf_ListValue*)google_protobuf_Value_list_value(msg);
319   if (sub == NULL) {
320     sub = (struct google_protobuf_ListValue*)_upb_Message_New(&google_protobuf_ListValue_msg_init, arena);
321     if (sub) google_protobuf_Value_set_list_value(msg, sub);
322   }
323   return sub;
324 }
325 
326 /* google.protobuf.ListValue */
327 
google_protobuf_ListValue_new(upb_Arena * arena)328 UPB_INLINE google_protobuf_ListValue* google_protobuf_ListValue_new(upb_Arena* arena) {
329   return (google_protobuf_ListValue*)_upb_Message_New(&google_protobuf_ListValue_msg_init, arena);
330 }
google_protobuf_ListValue_parse(const char * buf,size_t size,upb_Arena * arena)331 UPB_INLINE google_protobuf_ListValue* google_protobuf_ListValue_parse(const char* buf, size_t size, upb_Arena* arena) {
332   google_protobuf_ListValue* ret = google_protobuf_ListValue_new(arena);
333   if (!ret) return NULL;
334   if (upb_Decode(buf, size, ret, &google_protobuf_ListValue_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
335     return NULL;
336   }
337   return ret;
338 }
google_protobuf_ListValue_parse_ex(const char * buf,size_t size,const upb_ExtensionRegistry * extreg,int options,upb_Arena * arena)339 UPB_INLINE google_protobuf_ListValue* google_protobuf_ListValue_parse_ex(const char* buf, size_t size,
340                            const upb_ExtensionRegistry* extreg,
341                            int options, upb_Arena* arena) {
342   google_protobuf_ListValue* ret = google_protobuf_ListValue_new(arena);
343   if (!ret) return NULL;
344   if (upb_Decode(buf, size, ret, &google_protobuf_ListValue_msg_init, extreg, options, arena) !=
345       kUpb_DecodeStatus_Ok) {
346     return NULL;
347   }
348   return ret;
349 }
google_protobuf_ListValue_serialize(const google_protobuf_ListValue * msg,upb_Arena * arena,size_t * len)350 UPB_INLINE char* google_protobuf_ListValue_serialize(const google_protobuf_ListValue* msg, upb_Arena* arena, size_t* len) {
351   char* ptr;
352   (void)upb_Encode(msg, &google_protobuf_ListValue_msg_init, 0, arena, &ptr, len);
353   return ptr;
354 }
google_protobuf_ListValue_serialize_ex(const google_protobuf_ListValue * msg,int options,upb_Arena * arena,size_t * len)355 UPB_INLINE char* google_protobuf_ListValue_serialize_ex(const google_protobuf_ListValue* msg, int options,
356                                  upb_Arena* arena, size_t* len) {
357   char* ptr;
358   (void)upb_Encode(msg, &google_protobuf_ListValue_msg_init, options, arena, &ptr, len);
359   return ptr;
360 }
google_protobuf_ListValue_clear_values(google_protobuf_ListValue * msg)361 UPB_INLINE void google_protobuf_ListValue_clear_values(google_protobuf_ListValue* msg) {
362   const upb_MiniTableField field = {1, 0, 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
363   _upb_Message_ClearNonExtensionField(msg, &field);
364 }
google_protobuf_ListValue_values(const google_protobuf_ListValue * msg,size_t * size)365 UPB_INLINE const google_protobuf_Value* const* google_protobuf_ListValue_values(const google_protobuf_ListValue* msg, size_t* size) {
366   const upb_MiniTableField field = {1, 0, 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
367   const upb_Array* arr = upb_Message_GetArray(msg, &field);
368   if (arr) {
369     if (size) *size = arr->size;
370     return (const google_protobuf_Value* const*)_upb_array_constptr(arr);
371   } else {
372     if (size) *size = 0;
373     return NULL;
374   }
375 }
_google_protobuf_ListValue_values_upb_array(const google_protobuf_ListValue * msg,size_t * size)376 UPB_INLINE const upb_Array* _google_protobuf_ListValue_values_upb_array(const google_protobuf_ListValue* msg, size_t* size) {
377   const upb_MiniTableField field = {1, 0, 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
378   const upb_Array* arr = upb_Message_GetArray(msg, &field);
379   if (size) {
380     *size = arr ? arr->size : 0;
381   }
382   return arr;
383 }
_google_protobuf_ListValue_values_mutable_upb_array(const google_protobuf_ListValue * msg,size_t * size,upb_Arena * arena)384 UPB_INLINE upb_Array* _google_protobuf_ListValue_values_mutable_upb_array(const google_protobuf_ListValue* msg, size_t* size, upb_Arena* arena) {
385   const upb_MiniTableField field = {1, 0, 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
386   upb_Array* arr = upb_Message_GetOrCreateMutableArray(
387       (upb_Message*)msg, &field, arena);
388   if (size) {
389     *size = arr ? arr->size : 0;
390   }
391   return arr;
392 }
google_protobuf_ListValue_has_values(const google_protobuf_ListValue * msg)393 UPB_INLINE bool google_protobuf_ListValue_has_values(const google_protobuf_ListValue* msg) {
394   size_t size;
395   google_protobuf_ListValue_values(msg, &size);
396   return size != 0;
397 }
398 
google_protobuf_ListValue_mutable_values(google_protobuf_ListValue * msg,size_t * size)399 UPB_INLINE google_protobuf_Value** google_protobuf_ListValue_mutable_values(google_protobuf_ListValue* msg, size_t* size) {
400   upb_MiniTableField field = {1, 0, 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
401   upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
402   if (arr) {
403     if (size) *size = arr->size;
404     return (google_protobuf_Value**)_upb_array_ptr(arr);
405   } else {
406     if (size) *size = 0;
407     return NULL;
408   }
409 }
google_protobuf_ListValue_resize_values(google_protobuf_ListValue * msg,size_t size,upb_Arena * arena)410 UPB_INLINE google_protobuf_Value** google_protobuf_ListValue_resize_values(google_protobuf_ListValue* msg, size_t size, upb_Arena* arena) {
411   upb_MiniTableField field = {1, 0, 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
412   return (google_protobuf_Value**)upb_Message_ResizeArray(msg, &field, size, arena);
413 }
google_protobuf_ListValue_add_values(google_protobuf_ListValue * msg,upb_Arena * arena)414 UPB_INLINE struct google_protobuf_Value* google_protobuf_ListValue_add_values(google_protobuf_ListValue* msg, upb_Arena* arena) {
415   upb_MiniTableField field = {1, 0, 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
416   upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
417   if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
418     return NULL;
419   }
420   struct google_protobuf_Value* sub = (struct google_protobuf_Value*)_upb_Message_New(&google_protobuf_Value_msg_init, arena);
421   if (!arr || !sub) return NULL;
422   _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
423   return sub;
424 }
425 
426 extern const upb_MiniTableFile google_protobuf_struct_proto_upb_file_layout;
427 
428 #ifdef __cplusplus
429 }  /* extern "C" */
430 #endif
431 
432 #include "upb/port/undef.inc"
433 
434 #endif  /* GOOGLE_PROTOBUF_STRUCT_PROTO_UPB_H_ */
435