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