1 /* This file was generated by upbc (the upb compiler) from the input
2 * file:
3 *
4 * google/protobuf/struct.proto
5 *
6 * Do not edit -- your changes will be discarded when the file is
7 * regenerated. */
8
9 #ifndef GOOGLE_PROTOBUF_STRUCT_PROTO_UPB_H_
10 #define GOOGLE_PROTOBUF_STRUCT_PROTO_UPB_H_
11
12 #include "upb/msg.h"
13 #include "upb/decode.h"
14 #include "upb/decode_fast.h"
15 #include "upb/encode.h"
16
17 #include "upb/port_def.inc"
18
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22
23 struct google_protobuf_Struct;
24 struct google_protobuf_Struct_FieldsEntry;
25 struct google_protobuf_Value;
26 struct google_protobuf_ListValue;
27 typedef struct google_protobuf_Struct google_protobuf_Struct;
28 typedef struct google_protobuf_Struct_FieldsEntry google_protobuf_Struct_FieldsEntry;
29 typedef struct google_protobuf_Value google_protobuf_Value;
30 typedef struct google_protobuf_ListValue google_protobuf_ListValue;
31 extern const upb_msglayout google_protobuf_Struct_msginit;
32 extern const upb_msglayout google_protobuf_Struct_FieldsEntry_msginit;
33 extern const upb_msglayout google_protobuf_Value_msginit;
34 extern const upb_msglayout google_protobuf_ListValue_msginit;
35
36 typedef enum {
37 google_protobuf_NULL_VALUE = 0
38 } google_protobuf_NullValue;
39
40
41 /* google.protobuf.Struct */
42
google_protobuf_Struct_new(upb_arena * arena)43 UPB_INLINE google_protobuf_Struct *google_protobuf_Struct_new(upb_arena *arena) {
44 return (google_protobuf_Struct *)_upb_msg_new(&google_protobuf_Struct_msginit, arena);
45 }
google_protobuf_Struct_parse(const char * buf,size_t size,upb_arena * arena)46 UPB_INLINE google_protobuf_Struct *google_protobuf_Struct_parse(const char *buf, size_t size,
47 upb_arena *arena) {
48 google_protobuf_Struct *ret = google_protobuf_Struct_new(arena);
49 return (ret && upb_decode(buf, size, ret, &google_protobuf_Struct_msginit, arena)) ? ret : NULL;
50 }
google_protobuf_Struct_parse_ex(const char * buf,size_t size,upb_arena * arena,int options)51 UPB_INLINE google_protobuf_Struct *google_protobuf_Struct_parse_ex(const char *buf, size_t size,
52 upb_arena *arena, int options) {
53 google_protobuf_Struct *ret = google_protobuf_Struct_new(arena);
54 return (ret && _upb_decode(buf, size, ret, &google_protobuf_Struct_msginit, arena, options))
55 ? ret : NULL;
56 }
google_protobuf_Struct_serialize(const google_protobuf_Struct * msg,upb_arena * arena,size_t * len)57 UPB_INLINE char *google_protobuf_Struct_serialize(const google_protobuf_Struct *msg, upb_arena *arena, size_t *len) {
58 return upb_encode(msg, &google_protobuf_Struct_msginit, arena, len);
59 }
60
google_protobuf_Struct_has_fields(const google_protobuf_Struct * msg)61 UPB_INLINE bool google_protobuf_Struct_has_fields(const google_protobuf_Struct *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(0, 0)); }
google_protobuf_Struct_fields_size(const google_protobuf_Struct * msg)62 UPB_INLINE size_t google_protobuf_Struct_fields_size(const google_protobuf_Struct *msg) {return _upb_msg_map_size(msg, UPB_SIZE(0, 0)); }
google_protobuf_Struct_fields_get(const google_protobuf_Struct * msg,upb_strview key,google_protobuf_Value ** val)63 UPB_INLINE bool google_protobuf_Struct_fields_get(const google_protobuf_Struct *msg, upb_strview key, google_protobuf_Value* *val) { return _upb_msg_map_get(msg, UPB_SIZE(0, 0), &key, 0, val, sizeof(*val)); }
google_protobuf_Struct_fields_next(const google_protobuf_Struct * msg,size_t * iter)64 UPB_INLINE const google_protobuf_Struct_FieldsEntry* google_protobuf_Struct_fields_next(const google_protobuf_Struct *msg, size_t* iter) { return (const google_protobuf_Struct_FieldsEntry*)_upb_msg_map_next(msg, UPB_SIZE(0, 0), iter); }
65
google_protobuf_Struct_fields_clear(google_protobuf_Struct * msg)66 UPB_INLINE void google_protobuf_Struct_fields_clear(google_protobuf_Struct *msg) { _upb_msg_map_clear(msg, UPB_SIZE(0, 0)); }
google_protobuf_Struct_fields_set(google_protobuf_Struct * msg,upb_strview key,google_protobuf_Value * val,upb_arena * a)67 UPB_INLINE bool google_protobuf_Struct_fields_set(google_protobuf_Struct *msg, upb_strview key, google_protobuf_Value* val, upb_arena *a) { return _upb_msg_map_set(msg, UPB_SIZE(0, 0), &key, 0, &val, sizeof(val), a); }
google_protobuf_Struct_fields_delete(google_protobuf_Struct * msg,upb_strview key)68 UPB_INLINE bool google_protobuf_Struct_fields_delete(google_protobuf_Struct *msg, upb_strview key) { return _upb_msg_map_delete(msg, UPB_SIZE(0, 0), &key, 0); }
google_protobuf_Struct_fields_nextmutable(google_protobuf_Struct * msg,size_t * iter)69 UPB_INLINE google_protobuf_Struct_FieldsEntry* google_protobuf_Struct_fields_nextmutable(google_protobuf_Struct *msg, size_t* iter) { return (google_protobuf_Struct_FieldsEntry*)_upb_msg_map_next(msg, UPB_SIZE(0, 0), iter); }
70
71 /* google.protobuf.Struct.FieldsEntry */
72
google_protobuf_Struct_FieldsEntry_key(const google_protobuf_Struct_FieldsEntry * msg)73 UPB_INLINE upb_strview google_protobuf_Struct_FieldsEntry_key(const google_protobuf_Struct_FieldsEntry *msg) {
74 upb_strview ret;
75 _upb_msg_map_key(msg, &ret, 0);
76 return ret;
77 }
google_protobuf_Struct_FieldsEntry_has_value(const google_protobuf_Struct_FieldsEntry * msg)78 UPB_INLINE bool google_protobuf_Struct_FieldsEntry_has_value(const google_protobuf_Struct_FieldsEntry *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(8, 16)); }
google_protobuf_Struct_FieldsEntry_value(const google_protobuf_Struct_FieldsEntry * msg)79 UPB_INLINE const google_protobuf_Value* google_protobuf_Struct_FieldsEntry_value(const google_protobuf_Struct_FieldsEntry *msg) {
80 google_protobuf_Value* ret;
81 _upb_msg_map_value(msg, &ret, sizeof(ret));
82 return ret;
83 }
84
google_protobuf_Struct_FieldsEntry_set_value(google_protobuf_Struct_FieldsEntry * msg,google_protobuf_Value * value)85 UPB_INLINE void google_protobuf_Struct_FieldsEntry_set_value(google_protobuf_Struct_FieldsEntry *msg, google_protobuf_Value* value) {
86 _upb_msg_map_set_value(msg, &value, sizeof(google_protobuf_Value*));
87 }
88
89 /* google.protobuf.Value */
90
google_protobuf_Value_new(upb_arena * arena)91 UPB_INLINE google_protobuf_Value *google_protobuf_Value_new(upb_arena *arena) {
92 return (google_protobuf_Value *)_upb_msg_new(&google_protobuf_Value_msginit, arena);
93 }
google_protobuf_Value_parse(const char * buf,size_t size,upb_arena * arena)94 UPB_INLINE google_protobuf_Value *google_protobuf_Value_parse(const char *buf, size_t size,
95 upb_arena *arena) {
96 google_protobuf_Value *ret = google_protobuf_Value_new(arena);
97 return (ret && upb_decode(buf, size, ret, &google_protobuf_Value_msginit, arena)) ? ret : NULL;
98 }
google_protobuf_Value_parse_ex(const char * buf,size_t size,upb_arena * arena,int options)99 UPB_INLINE google_protobuf_Value *google_protobuf_Value_parse_ex(const char *buf, size_t size,
100 upb_arena *arena, int options) {
101 google_protobuf_Value *ret = google_protobuf_Value_new(arena);
102 return (ret && _upb_decode(buf, size, ret, &google_protobuf_Value_msginit, arena, options))
103 ? ret : NULL;
104 }
google_protobuf_Value_serialize(const google_protobuf_Value * msg,upb_arena * arena,size_t * len)105 UPB_INLINE char *google_protobuf_Value_serialize(const google_protobuf_Value *msg, upb_arena *arena, size_t *len) {
106 return upb_encode(msg, &google_protobuf_Value_msginit, arena, len);
107 }
108
109 typedef enum {
110 google_protobuf_Value_kind_null_value = 1,
111 google_protobuf_Value_kind_number_value = 2,
112 google_protobuf_Value_kind_string_value = 3,
113 google_protobuf_Value_kind_bool_value = 4,
114 google_protobuf_Value_kind_struct_value = 5,
115 google_protobuf_Value_kind_list_value = 6,
116 google_protobuf_Value_kind_NOT_SET = 0
117 } google_protobuf_Value_kind_oneofcases;
google_protobuf_Value_kind_case(const google_protobuf_Value * msg)118 UPB_INLINE google_protobuf_Value_kind_oneofcases google_protobuf_Value_kind_case(const google_protobuf_Value* msg) { return (google_protobuf_Value_kind_oneofcases)*UPB_PTR_AT(msg, UPB_SIZE(8, 16), int32_t); }
119
google_protobuf_Value_has_null_value(const google_protobuf_Value * msg)120 UPB_INLINE bool google_protobuf_Value_has_null_value(const google_protobuf_Value *msg) { return _upb_getoneofcase(msg, UPB_SIZE(8, 16)) == 1; }
google_protobuf_Value_null_value(const google_protobuf_Value * msg)121 UPB_INLINE int32_t google_protobuf_Value_null_value(const google_protobuf_Value *msg) { return UPB_READ_ONEOF(msg, int32_t, UPB_SIZE(0, 0), UPB_SIZE(8, 16), 1, 0); }
google_protobuf_Value_has_number_value(const google_protobuf_Value * msg)122 UPB_INLINE bool google_protobuf_Value_has_number_value(const google_protobuf_Value *msg) { return _upb_getoneofcase(msg, UPB_SIZE(8, 16)) == 2; }
google_protobuf_Value_number_value(const google_protobuf_Value * msg)123 UPB_INLINE double google_protobuf_Value_number_value(const google_protobuf_Value *msg) { return UPB_READ_ONEOF(msg, double, UPB_SIZE(0, 0), UPB_SIZE(8, 16), 2, 0); }
google_protobuf_Value_has_string_value(const google_protobuf_Value * msg)124 UPB_INLINE bool google_protobuf_Value_has_string_value(const google_protobuf_Value *msg) { return _upb_getoneofcase(msg, UPB_SIZE(8, 16)) == 3; }
google_protobuf_Value_string_value(const google_protobuf_Value * msg)125 UPB_INLINE upb_strview google_protobuf_Value_string_value(const google_protobuf_Value *msg) { return UPB_READ_ONEOF(msg, upb_strview, UPB_SIZE(0, 0), UPB_SIZE(8, 16), 3, upb_strview_make("", strlen(""))); }
google_protobuf_Value_has_bool_value(const google_protobuf_Value * msg)126 UPB_INLINE bool google_protobuf_Value_has_bool_value(const google_protobuf_Value *msg) { return _upb_getoneofcase(msg, UPB_SIZE(8, 16)) == 4; }
google_protobuf_Value_bool_value(const google_protobuf_Value * msg)127 UPB_INLINE bool google_protobuf_Value_bool_value(const google_protobuf_Value *msg) { return UPB_READ_ONEOF(msg, bool, UPB_SIZE(0, 0), UPB_SIZE(8, 16), 4, false); }
google_protobuf_Value_has_struct_value(const google_protobuf_Value * msg)128 UPB_INLINE bool google_protobuf_Value_has_struct_value(const google_protobuf_Value *msg) { return _upb_getoneofcase(msg, UPB_SIZE(8, 16)) == 5; }
google_protobuf_Value_struct_value(const google_protobuf_Value * msg)129 UPB_INLINE const google_protobuf_Struct* google_protobuf_Value_struct_value(const google_protobuf_Value *msg) { return UPB_READ_ONEOF(msg, const google_protobuf_Struct*, UPB_SIZE(0, 0), UPB_SIZE(8, 16), 5, NULL); }
google_protobuf_Value_has_list_value(const google_protobuf_Value * msg)130 UPB_INLINE bool google_protobuf_Value_has_list_value(const google_protobuf_Value *msg) { return _upb_getoneofcase(msg, UPB_SIZE(8, 16)) == 6; }
google_protobuf_Value_list_value(const google_protobuf_Value * msg)131 UPB_INLINE const google_protobuf_ListValue* google_protobuf_Value_list_value(const google_protobuf_Value *msg) { return UPB_READ_ONEOF(msg, const google_protobuf_ListValue*, UPB_SIZE(0, 0), UPB_SIZE(8, 16), 6, NULL); }
132
google_protobuf_Value_set_null_value(google_protobuf_Value * msg,int32_t value)133 UPB_INLINE void google_protobuf_Value_set_null_value(google_protobuf_Value *msg, int32_t value) {
134 UPB_WRITE_ONEOF(msg, int32_t, UPB_SIZE(0, 0), value, UPB_SIZE(8, 16), 1);
135 }
google_protobuf_Value_set_number_value(google_protobuf_Value * msg,double value)136 UPB_INLINE void google_protobuf_Value_set_number_value(google_protobuf_Value *msg, double value) {
137 UPB_WRITE_ONEOF(msg, double, UPB_SIZE(0, 0), value, UPB_SIZE(8, 16), 2);
138 }
google_protobuf_Value_set_string_value(google_protobuf_Value * msg,upb_strview value)139 UPB_INLINE void google_protobuf_Value_set_string_value(google_protobuf_Value *msg, upb_strview value) {
140 UPB_WRITE_ONEOF(msg, upb_strview, UPB_SIZE(0, 0), value, UPB_SIZE(8, 16), 3);
141 }
google_protobuf_Value_set_bool_value(google_protobuf_Value * msg,bool value)142 UPB_INLINE void google_protobuf_Value_set_bool_value(google_protobuf_Value *msg, bool value) {
143 UPB_WRITE_ONEOF(msg, bool, UPB_SIZE(0, 0), value, UPB_SIZE(8, 16), 4);
144 }
google_protobuf_Value_set_struct_value(google_protobuf_Value * msg,google_protobuf_Struct * value)145 UPB_INLINE void google_protobuf_Value_set_struct_value(google_protobuf_Value *msg, google_protobuf_Struct* value) {
146 UPB_WRITE_ONEOF(msg, google_protobuf_Struct*, UPB_SIZE(0, 0), value, UPB_SIZE(8, 16), 5);
147 }
google_protobuf_Value_mutable_struct_value(google_protobuf_Value * msg,upb_arena * arena)148 UPB_INLINE struct google_protobuf_Struct* google_protobuf_Value_mutable_struct_value(google_protobuf_Value *msg, upb_arena *arena) {
149 struct google_protobuf_Struct* sub = (struct google_protobuf_Struct*)google_protobuf_Value_struct_value(msg);
150 if (sub == NULL) {
151 sub = (struct google_protobuf_Struct*)_upb_msg_new(&google_protobuf_Struct_msginit, arena);
152 if (!sub) return NULL;
153 google_protobuf_Value_set_struct_value(msg, sub);
154 }
155 return sub;
156 }
google_protobuf_Value_set_list_value(google_protobuf_Value * msg,google_protobuf_ListValue * value)157 UPB_INLINE void google_protobuf_Value_set_list_value(google_protobuf_Value *msg, google_protobuf_ListValue* value) {
158 UPB_WRITE_ONEOF(msg, google_protobuf_ListValue*, UPB_SIZE(0, 0), value, UPB_SIZE(8, 16), 6);
159 }
google_protobuf_Value_mutable_list_value(google_protobuf_Value * msg,upb_arena * arena)160 UPB_INLINE struct google_protobuf_ListValue* google_protobuf_Value_mutable_list_value(google_protobuf_Value *msg, upb_arena *arena) {
161 struct google_protobuf_ListValue* sub = (struct google_protobuf_ListValue*)google_protobuf_Value_list_value(msg);
162 if (sub == NULL) {
163 sub = (struct google_protobuf_ListValue*)_upb_msg_new(&google_protobuf_ListValue_msginit, arena);
164 if (!sub) return NULL;
165 google_protobuf_Value_set_list_value(msg, sub);
166 }
167 return sub;
168 }
169
170 /* google.protobuf.ListValue */
171
google_protobuf_ListValue_new(upb_arena * arena)172 UPB_INLINE google_protobuf_ListValue *google_protobuf_ListValue_new(upb_arena *arena) {
173 return (google_protobuf_ListValue *)_upb_msg_new(&google_protobuf_ListValue_msginit, arena);
174 }
google_protobuf_ListValue_parse(const char * buf,size_t size,upb_arena * arena)175 UPB_INLINE google_protobuf_ListValue *google_protobuf_ListValue_parse(const char *buf, size_t size,
176 upb_arena *arena) {
177 google_protobuf_ListValue *ret = google_protobuf_ListValue_new(arena);
178 return (ret && upb_decode(buf, size, ret, &google_protobuf_ListValue_msginit, arena)) ? ret : NULL;
179 }
google_protobuf_ListValue_parse_ex(const char * buf,size_t size,upb_arena * arena,int options)180 UPB_INLINE google_protobuf_ListValue *google_protobuf_ListValue_parse_ex(const char *buf, size_t size,
181 upb_arena *arena, int options) {
182 google_protobuf_ListValue *ret = google_protobuf_ListValue_new(arena);
183 return (ret && _upb_decode(buf, size, ret, &google_protobuf_ListValue_msginit, arena, options))
184 ? ret : NULL;
185 }
google_protobuf_ListValue_serialize(const google_protobuf_ListValue * msg,upb_arena * arena,size_t * len)186 UPB_INLINE char *google_protobuf_ListValue_serialize(const google_protobuf_ListValue *msg, upb_arena *arena, size_t *len) {
187 return upb_encode(msg, &google_protobuf_ListValue_msginit, arena, len);
188 }
189
google_protobuf_ListValue_has_values(const google_protobuf_ListValue * msg)190 UPB_INLINE bool google_protobuf_ListValue_has_values(const google_protobuf_ListValue *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(0, 0)); }
google_protobuf_ListValue_values(const google_protobuf_ListValue * msg,size_t * len)191 UPB_INLINE const google_protobuf_Value* const* google_protobuf_ListValue_values(const google_protobuf_ListValue *msg, size_t *len) { return (const google_protobuf_Value* const*)_upb_array_accessor(msg, UPB_SIZE(0, 0), len); }
192
google_protobuf_ListValue_mutable_values(google_protobuf_ListValue * msg,size_t * len)193 UPB_INLINE google_protobuf_Value** google_protobuf_ListValue_mutable_values(google_protobuf_ListValue *msg, size_t *len) {
194 return (google_protobuf_Value**)_upb_array_mutable_accessor(msg, UPB_SIZE(0, 0), len);
195 }
google_protobuf_ListValue_resize_values(google_protobuf_ListValue * msg,size_t len,upb_arena * arena)196 UPB_INLINE google_protobuf_Value** google_protobuf_ListValue_resize_values(google_protobuf_ListValue *msg, size_t len, upb_arena *arena) {
197 return (google_protobuf_Value**)_upb_array_resize_accessor2(msg, UPB_SIZE(0, 0), len, UPB_SIZE(2, 3), arena);
198 }
google_protobuf_ListValue_add_values(google_protobuf_ListValue * msg,upb_arena * arena)199 UPB_INLINE struct google_protobuf_Value* google_protobuf_ListValue_add_values(google_protobuf_ListValue *msg, upb_arena *arena) {
200 struct google_protobuf_Value* sub = (struct google_protobuf_Value*)_upb_msg_new(&google_protobuf_Value_msginit, arena);
201 bool ok = _upb_array_append_accessor2(
202 msg, UPB_SIZE(0, 0), UPB_SIZE(2, 3), &sub, arena);
203 if (!ok) return NULL;
204 return sub;
205 }
206
207 #ifdef __cplusplus
208 } /* extern "C" */
209 #endif
210
211 #include "upb/port_undef.inc"
212
213 #endif /* GOOGLE_PROTOBUF_STRUCT_PROTO_UPB_H_ */
214