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