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/encode.h"
15
16 #include "upb/port_def.inc"
17
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21
22 struct google_protobuf_Struct;
23 struct google_protobuf_Struct_FieldsEntry;
24 struct google_protobuf_Value;
25 struct google_protobuf_ListValue;
26 typedef struct google_protobuf_Struct google_protobuf_Struct;
27 typedef struct google_protobuf_Struct_FieldsEntry google_protobuf_Struct_FieldsEntry;
28 typedef struct google_protobuf_Value google_protobuf_Value;
29 typedef struct google_protobuf_ListValue google_protobuf_ListValue;
30 extern const upb_msglayout google_protobuf_Struct_msginit;
31 extern const upb_msglayout google_protobuf_Struct_FieldsEntry_msginit;
32 extern const upb_msglayout google_protobuf_Value_msginit;
33 extern const upb_msglayout google_protobuf_ListValue_msginit;
34
35 typedef enum {
36 google_protobuf_NULL_VALUE = 0
37 } google_protobuf_NullValue;
38
39
40 /* google.protobuf.Struct */
41
google_protobuf_Struct_new(upb_arena * arena)42 UPB_INLINE google_protobuf_Struct *google_protobuf_Struct_new(upb_arena *arena) {
43 return (google_protobuf_Struct *)_upb_msg_new(&google_protobuf_Struct_msginit, arena);
44 }
google_protobuf_Struct_parse(const char * buf,size_t size,upb_arena * arena)45 UPB_INLINE google_protobuf_Struct *google_protobuf_Struct_parse(const char *buf, size_t size,
46 upb_arena *arena) {
47 google_protobuf_Struct *ret = google_protobuf_Struct_new(arena);
48 return (ret && upb_decode(buf, size, ret, &google_protobuf_Struct_msginit, arena)) ? ret : NULL;
49 }
google_protobuf_Struct_serialize(const google_protobuf_Struct * msg,upb_arena * arena,size_t * len)50 UPB_INLINE char *google_protobuf_Struct_serialize(const google_protobuf_Struct *msg, upb_arena *arena, size_t *len) {
51 return upb_encode(msg, &google_protobuf_Struct_msginit, arena, len);
52 }
53
google_protobuf_Struct_has_fields(const google_protobuf_Struct * msg)54 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)55 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)56 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)57 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); }
58
google_protobuf_Struct_fields_clear(google_protobuf_Struct * msg)59 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)60 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)61 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)62 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); }
63
64 /* google.protobuf.Struct.FieldsEntry */
65
google_protobuf_Struct_FieldsEntry_key(const google_protobuf_Struct_FieldsEntry * msg)66 UPB_INLINE upb_strview google_protobuf_Struct_FieldsEntry_key(const google_protobuf_Struct_FieldsEntry *msg) {
67 upb_strview ret;
68 _upb_msg_map_key(msg, &ret, 0);
69 return ret;
70 }
google_protobuf_Struct_FieldsEntry_has_value(const google_protobuf_Struct_FieldsEntry * msg)71 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)72 UPB_INLINE const google_protobuf_Value* google_protobuf_Struct_FieldsEntry_value(const google_protobuf_Struct_FieldsEntry *msg) {
73 google_protobuf_Value* ret;
74 _upb_msg_map_value(msg, &ret, sizeof(ret));
75 return ret;
76 }
77
google_protobuf_Struct_FieldsEntry_set_value(google_protobuf_Struct_FieldsEntry * msg,google_protobuf_Value * value)78 UPB_INLINE void google_protobuf_Struct_FieldsEntry_set_value(google_protobuf_Struct_FieldsEntry *msg, google_protobuf_Value* value) {
79 _upb_msg_map_set_value(msg, &value, sizeof(google_protobuf_Value*));
80 }
81
82 /* google.protobuf.Value */
83
google_protobuf_Value_new(upb_arena * arena)84 UPB_INLINE google_protobuf_Value *google_protobuf_Value_new(upb_arena *arena) {
85 return (google_protobuf_Value *)_upb_msg_new(&google_protobuf_Value_msginit, arena);
86 }
google_protobuf_Value_parse(const char * buf,size_t size,upb_arena * arena)87 UPB_INLINE google_protobuf_Value *google_protobuf_Value_parse(const char *buf, size_t size,
88 upb_arena *arena) {
89 google_protobuf_Value *ret = google_protobuf_Value_new(arena);
90 return (ret && upb_decode(buf, size, ret, &google_protobuf_Value_msginit, arena)) ? ret : NULL;
91 }
google_protobuf_Value_serialize(const google_protobuf_Value * msg,upb_arena * arena,size_t * len)92 UPB_INLINE char *google_protobuf_Value_serialize(const google_protobuf_Value *msg, upb_arena *arena, size_t *len) {
93 return upb_encode(msg, &google_protobuf_Value_msginit, arena, len);
94 }
95
96 typedef enum {
97 google_protobuf_Value_kind_null_value = 1,
98 google_protobuf_Value_kind_number_value = 2,
99 google_protobuf_Value_kind_string_value = 3,
100 google_protobuf_Value_kind_bool_value = 4,
101 google_protobuf_Value_kind_struct_value = 5,
102 google_protobuf_Value_kind_list_value = 6,
103 google_protobuf_Value_kind_NOT_SET = 0
104 } google_protobuf_Value_kind_oneofcases;
google_protobuf_Value_kind_case(const google_protobuf_Value * msg)105 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); }
106
google_protobuf_Value_has_null_value(const google_protobuf_Value * msg)107 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)108 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, google_protobuf_NULL_VALUE); }
google_protobuf_Value_has_number_value(const google_protobuf_Value * msg)109 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)110 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)111 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)112 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)113 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)114 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)115 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)116 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)117 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)118 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); }
119
google_protobuf_Value_set_null_value(google_protobuf_Value * msg,int32_t value)120 UPB_INLINE void google_protobuf_Value_set_null_value(google_protobuf_Value *msg, int32_t value) {
121 UPB_WRITE_ONEOF(msg, int32_t, UPB_SIZE(0, 0), value, UPB_SIZE(8, 16), 1);
122 }
google_protobuf_Value_set_number_value(google_protobuf_Value * msg,double value)123 UPB_INLINE void google_protobuf_Value_set_number_value(google_protobuf_Value *msg, double value) {
124 UPB_WRITE_ONEOF(msg, double, UPB_SIZE(0, 0), value, UPB_SIZE(8, 16), 2);
125 }
google_protobuf_Value_set_string_value(google_protobuf_Value * msg,upb_strview value)126 UPB_INLINE void google_protobuf_Value_set_string_value(google_protobuf_Value *msg, upb_strview value) {
127 UPB_WRITE_ONEOF(msg, upb_strview, UPB_SIZE(0, 0), value, UPB_SIZE(8, 16), 3);
128 }
google_protobuf_Value_set_bool_value(google_protobuf_Value * msg,bool value)129 UPB_INLINE void google_protobuf_Value_set_bool_value(google_protobuf_Value *msg, bool value) {
130 UPB_WRITE_ONEOF(msg, bool, UPB_SIZE(0, 0), value, UPB_SIZE(8, 16), 4);
131 }
google_protobuf_Value_set_struct_value(google_protobuf_Value * msg,google_protobuf_Struct * value)132 UPB_INLINE void google_protobuf_Value_set_struct_value(google_protobuf_Value *msg, google_protobuf_Struct* value) {
133 UPB_WRITE_ONEOF(msg, google_protobuf_Struct*, UPB_SIZE(0, 0), value, UPB_SIZE(8, 16), 5);
134 }
google_protobuf_Value_mutable_struct_value(google_protobuf_Value * msg,upb_arena * arena)135 UPB_INLINE struct google_protobuf_Struct* google_protobuf_Value_mutable_struct_value(google_protobuf_Value *msg, upb_arena *arena) {
136 struct google_protobuf_Struct* sub = (struct google_protobuf_Struct*)google_protobuf_Value_struct_value(msg);
137 if (sub == NULL) {
138 sub = (struct google_protobuf_Struct*)_upb_msg_new(&google_protobuf_Struct_msginit, arena);
139 if (!sub) return NULL;
140 google_protobuf_Value_set_struct_value(msg, sub);
141 }
142 return sub;
143 }
google_protobuf_Value_set_list_value(google_protobuf_Value * msg,google_protobuf_ListValue * value)144 UPB_INLINE void google_protobuf_Value_set_list_value(google_protobuf_Value *msg, google_protobuf_ListValue* value) {
145 UPB_WRITE_ONEOF(msg, google_protobuf_ListValue*, UPB_SIZE(0, 0), value, UPB_SIZE(8, 16), 6);
146 }
google_protobuf_Value_mutable_list_value(google_protobuf_Value * msg,upb_arena * arena)147 UPB_INLINE struct google_protobuf_ListValue* google_protobuf_Value_mutable_list_value(google_protobuf_Value *msg, upb_arena *arena) {
148 struct google_protobuf_ListValue* sub = (struct google_protobuf_ListValue*)google_protobuf_Value_list_value(msg);
149 if (sub == NULL) {
150 sub = (struct google_protobuf_ListValue*)_upb_msg_new(&google_protobuf_ListValue_msginit, arena);
151 if (!sub) return NULL;
152 google_protobuf_Value_set_list_value(msg, sub);
153 }
154 return sub;
155 }
156
157 /* google.protobuf.ListValue */
158
google_protobuf_ListValue_new(upb_arena * arena)159 UPB_INLINE google_protobuf_ListValue *google_protobuf_ListValue_new(upb_arena *arena) {
160 return (google_protobuf_ListValue *)_upb_msg_new(&google_protobuf_ListValue_msginit, arena);
161 }
google_protobuf_ListValue_parse(const char * buf,size_t size,upb_arena * arena)162 UPB_INLINE google_protobuf_ListValue *google_protobuf_ListValue_parse(const char *buf, size_t size,
163 upb_arena *arena) {
164 google_protobuf_ListValue *ret = google_protobuf_ListValue_new(arena);
165 return (ret && upb_decode(buf, size, ret, &google_protobuf_ListValue_msginit, arena)) ? ret : NULL;
166 }
google_protobuf_ListValue_serialize(const google_protobuf_ListValue * msg,upb_arena * arena,size_t * len)167 UPB_INLINE char *google_protobuf_ListValue_serialize(const google_protobuf_ListValue *msg, upb_arena *arena, size_t *len) {
168 return upb_encode(msg, &google_protobuf_ListValue_msginit, arena, len);
169 }
170
google_protobuf_ListValue_has_values(const google_protobuf_ListValue * msg)171 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)172 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); }
173
google_protobuf_ListValue_mutable_values(google_protobuf_ListValue * msg,size_t * len)174 UPB_INLINE google_protobuf_Value** google_protobuf_ListValue_mutable_values(google_protobuf_ListValue *msg, size_t *len) {
175 return (google_protobuf_Value**)_upb_array_mutable_accessor(msg, UPB_SIZE(0, 0), len);
176 }
google_protobuf_ListValue_resize_values(google_protobuf_ListValue * msg,size_t len,upb_arena * arena)177 UPB_INLINE google_protobuf_Value** google_protobuf_ListValue_resize_values(google_protobuf_ListValue *msg, size_t len, upb_arena *arena) {
178 return (google_protobuf_Value**)_upb_array_resize_accessor(msg, UPB_SIZE(0, 0), len, UPB_TYPE_MESSAGE, arena);
179 }
google_protobuf_ListValue_add_values(google_protobuf_ListValue * msg,upb_arena * arena)180 UPB_INLINE struct google_protobuf_Value* google_protobuf_ListValue_add_values(google_protobuf_ListValue *msg, upb_arena *arena) {
181 struct google_protobuf_Value* sub = (struct google_protobuf_Value*)_upb_msg_new(&google_protobuf_Value_msginit, arena);
182 bool ok = _upb_array_append_accessor(
183 msg, UPB_SIZE(0, 0), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
184 if (!ok) return NULL;
185 return sub;
186 }
187
188 #ifdef __cplusplus
189 } /* extern "C" */
190 #endif
191
192 #include "upb/port_undef.inc"
193
194 #endif /* GOOGLE_PROTOBUF_STRUCT_PROTO_UPB_H_ */
195