GRPC Core  18.0.0
struct.upb.h
Go to the documentation of this file.
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 
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 {
39 
40 
41 /* google.protobuf.Struct */
42 
45 }
46 UPB_INLINE google_protobuf_Struct *google_protobuf_Struct_parse(const char *buf, size_t size,
47  upb_arena *arena) {
49  return (ret && upb_decode(buf, size, ret, &google_protobuf_Struct_msginit, arena)) ? ret : NULL;
50 }
51 UPB_INLINE google_protobuf_Struct *google_protobuf_Struct_parse_ex(const char *buf, size_t size,
52  upb_arena *arena, int options) {
54  return (ret && _upb_decode(buf, size, ret, &google_protobuf_Struct_msginit, arena, options))
55  ? ret : NULL;
56 }
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 
61 UPB_INLINE bool google_protobuf_Struct_has_fields(const google_protobuf_Struct *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(0, 0)); }
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)); }
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)); }
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 
66 UPB_INLINE void google_protobuf_Struct_fields_clear(google_protobuf_Struct *msg) { _upb_msg_map_clear(msg, UPB_SIZE(0, 0)); }
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); }
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); }
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 
74  upb_strview ret;
75  _upb_msg_map_key(msg, &ret, 0);
76  return ret;
77 }
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)); }
81  _upb_msg_map_value(msg, &ret, sizeof(ret));
82  return ret;
83 }
84 
86  _upb_msg_map_set_value(msg, &value, sizeof(google_protobuf_Value*));
87 }
88 
89 /* google.protobuf.Value */
90 
93 }
94 UPB_INLINE google_protobuf_Value *google_protobuf_Value_parse(const char *buf, size_t size,
95  upb_arena *arena) {
97  return (ret && upb_decode(buf, size, ret, &google_protobuf_Value_msginit, arena)) ? ret : NULL;
98 }
99 UPB_INLINE google_protobuf_Value *google_protobuf_Value_parse_ex(const char *buf, size_t size,
100  upb_arena *arena, int options) {
102  return (ret && _upb_decode(buf, size, ret, &google_protobuf_Value_msginit, arena, options))
103  ? ret : NULL;
104 }
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 {
119 
120 UPB_INLINE bool google_protobuf_Value_has_null_value(const google_protobuf_Value *msg) { return _upb_getoneofcase(msg, UPB_SIZE(8, 16)) == 1; }
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); }
122 UPB_INLINE bool google_protobuf_Value_has_number_value(const google_protobuf_Value *msg) { return _upb_getoneofcase(msg, UPB_SIZE(8, 16)) == 2; }
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); }
124 UPB_INLINE bool google_protobuf_Value_has_string_value(const google_protobuf_Value *msg) { return _upb_getoneofcase(msg, UPB_SIZE(8, 16)) == 3; }
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(""))); }
126 UPB_INLINE bool google_protobuf_Value_has_bool_value(const google_protobuf_Value *msg) { return _upb_getoneofcase(msg, UPB_SIZE(8, 16)) == 4; }
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); }
128 UPB_INLINE bool google_protobuf_Value_has_struct_value(const google_protobuf_Value *msg) { return _upb_getoneofcase(msg, UPB_SIZE(8, 16)) == 5; }
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); }
130 UPB_INLINE bool google_protobuf_Value_has_list_value(const google_protobuf_Value *msg) { return _upb_getoneofcase(msg, UPB_SIZE(8, 16)) == 6; }
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 
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 }
137  UPB_WRITE_ONEOF(msg, double, UPB_SIZE(0, 0), value, UPB_SIZE(8, 16), 2);
138 }
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 }
143  UPB_WRITE_ONEOF(msg, bool, UPB_SIZE(0, 0), value, UPB_SIZE(8, 16), 4);
144 }
146  UPB_WRITE_ONEOF(msg, google_protobuf_Struct*, UPB_SIZE(0, 0), value, UPB_SIZE(8, 16), 5);
147 }
150  if (sub == NULL) {
151  sub = (struct google_protobuf_Struct*)_upb_msg_new(&google_protobuf_Struct_msginit, arena);
152  if (!sub) return NULL;
154  }
155  return sub;
156 }
158  UPB_WRITE_ONEOF(msg, google_protobuf_ListValue*, UPB_SIZE(0, 0), value, UPB_SIZE(8, 16), 6);
159 }
162  if (sub == NULL) {
164  if (!sub) return NULL;
166  }
167  return sub;
168 }
169 
170 /* google.protobuf.ListValue */
171 
174 }
175 UPB_INLINE google_protobuf_ListValue *google_protobuf_ListValue_parse(const char *buf, size_t size,
176  upb_arena *arena) {
178  return (ret && upb_decode(buf, size, ret, &google_protobuf_ListValue_msginit, arena)) ? ret : NULL;
179 }
180 UPB_INLINE google_protobuf_ListValue *google_protobuf_ListValue_parse_ex(const char *buf, size_t size,
181  upb_arena *arena, int options) {
183  return (ret && _upb_decode(buf, size, ret, &google_protobuf_ListValue_msginit, arena, options))
184  ? ret : NULL;
185 }
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 
190 UPB_INLINE bool google_protobuf_ListValue_has_values(const google_protobuf_ListValue *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(0, 0)); }
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 
194  return (google_protobuf_Value**)_upb_array_mutable_accessor(msg, UPB_SIZE(0, 0), len);
195 }
197  return (google_protobuf_Value**)_upb_array_resize_accessor2(msg, UPB_SIZE(0, 0), len, UPB_SIZE(2, 3), arena);
198 }
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_ */
UPB_INLINE double google_protobuf_Value_number_value(const google_protobuf_Value *msg)
Definition: struct.upb.h:123
UPB_INLINE const google_protobuf_Struct_FieldsEntry * google_protobuf_Struct_fields_next(const google_protobuf_Struct *msg, size_t *iter)
Definition: struct.upb.h:64
UPB_INLINE google_protobuf_Struct * google_protobuf_Struct_new(upb_arena *arena)
Definition: struct.upb.h:43
UPB_INLINE void google_protobuf_Value_set_string_value(google_protobuf_Value *msg, upb_strview value)
Definition: struct.upb.h:139
UPB_INLINE struct google_protobuf_Struct * google_protobuf_Value_mutable_struct_value(google_protobuf_Value *msg, upb_arena *arena)
Definition: struct.upb.h:148
UPB_INLINE google_protobuf_Struct * google_protobuf_Struct_parse_ex(const char *buf, size_t size, upb_arena *arena, int options)
Definition: struct.upb.h:51
UPB_INLINE void google_protobuf_Value_set_list_value(google_protobuf_Value *msg, google_protobuf_ListValue *value)
Definition: struct.upb.h:157
UPB_INLINE void google_protobuf_Value_set_bool_value(google_protobuf_Value *msg, bool value)
Definition: struct.upb.h:142
UPB_INLINE char * google_protobuf_Struct_serialize(const google_protobuf_Struct *msg, upb_arena *arena, size_t *len)
Definition: struct.upb.h:57
UPB_INLINE const google_protobuf_Value * google_protobuf_Struct_FieldsEntry_value(const google_protobuf_Struct_FieldsEntry *msg)
Definition: struct.upb.h:79
UPB_INLINE google_protobuf_Value * google_protobuf_Value_parse(const char *buf, size_t size, upb_arena *arena)
Definition: struct.upb.h:94
UPB_INLINE google_protobuf_Struct * google_protobuf_Struct_parse(const char *buf, size_t size, upb_arena *arena)
Definition: struct.upb.h:46
UPB_INLINE bool google_protobuf_Value_has_string_value(const google_protobuf_Value *msg)
Definition: struct.upb.h:124
UPB_INLINE bool google_protobuf_Value_has_bool_value(const google_protobuf_Value *msg)
Definition: struct.upb.h:126
UPB_INLINE google_protobuf_ListValue * google_protobuf_ListValue_parse(const char *buf, size_t size, upb_arena *arena)
Definition: struct.upb.h:175
UPB_INLINE struct google_protobuf_ListValue * google_protobuf_Value_mutable_list_value(google_protobuf_Value *msg, upb_arena *arena)
Definition: struct.upb.h:160
UPB_INLINE bool google_protobuf_Struct_fields_delete(google_protobuf_Struct *msg, upb_strview key)
Definition: struct.upb.h:68
UPB_INLINE struct google_protobuf_Value * google_protobuf_ListValue_add_values(google_protobuf_ListValue *msg, upb_arena *arena)
Definition: struct.upb.h:199
UPB_INLINE bool google_protobuf_Value_bool_value(const google_protobuf_Value *msg)
Definition: struct.upb.h:127
const upb_msglayout google_protobuf_Value_msginit
Definition: struct.upb.c:58
UPB_INLINE bool google_protobuf_Value_has_list_value(const google_protobuf_Value *msg)
Definition: struct.upb.h:130
UPB_INLINE upb_strview google_protobuf_Value_string_value(const google_protobuf_Value *msg)
Definition: struct.upb.h:125
UPB_INLINE int32_t google_protobuf_Value_null_value(const google_protobuf_Value *msg)
Definition: struct.upb.h:121
struct google_protobuf_ListValue google_protobuf_ListValue
Definition: struct.upb.h:30
const upb_msglayout google_protobuf_Struct_FieldsEntry_msginit
Definition: struct.upb.c:38
UPB_INLINE void google_protobuf_Value_set_number_value(google_protobuf_Value *msg, double value)
Definition: struct.upb.h:136
UPB_INLINE void google_protobuf_Struct_fields_clear(google_protobuf_Struct *msg)
Definition: struct.upb.h:66
const upb_msglayout google_protobuf_Struct_msginit
Definition: struct.upb.c:23
UPB_INLINE char * google_protobuf_ListValue_serialize(const google_protobuf_ListValue *msg, upb_arena *arena, size_t *len)
Definition: struct.upb.h:186
UPB_INLINE upb_strview google_protobuf_Struct_FieldsEntry_key(const google_protobuf_Struct_FieldsEntry *msg)
Definition: struct.upb.h:73
UPB_INLINE char * google_protobuf_Value_serialize(const google_protobuf_Value *msg, upb_arena *arena, size_t *len)
Definition: struct.upb.h:105
UPB_INLINE google_protobuf_Value ** google_protobuf_ListValue_resize_values(google_protobuf_ListValue *msg, size_t len, upb_arena *arena)
Definition: struct.upb.h:196
UPB_INLINE bool google_protobuf_ListValue_has_values(const google_protobuf_ListValue *msg)
Definition: struct.upb.h:190
UPB_INLINE google_protobuf_Value * google_protobuf_Value_parse_ex(const char *buf, size_t size, upb_arena *arena, int options)
Definition: struct.upb.h:99
google_protobuf_Value_kind_oneofcases
Definition: struct.upb.h:109
@ google_protobuf_Value_kind_struct_value
Definition: struct.upb.h:114
@ google_protobuf_Value_kind_null_value
Definition: struct.upb.h:110
@ google_protobuf_Value_kind_list_value
Definition: struct.upb.h:115
@ google_protobuf_Value_kind_bool_value
Definition: struct.upb.h:113
@ google_protobuf_Value_kind_number_value
Definition: struct.upb.h:111
@ google_protobuf_Value_kind_string_value
Definition: struct.upb.h:112
@ google_protobuf_Value_kind_NOT_SET
Definition: struct.upb.h:116
UPB_INLINE bool google_protobuf_Struct_has_fields(const google_protobuf_Struct *msg)
Definition: struct.upb.h:61
struct google_protobuf_Value google_protobuf_Value
Definition: struct.upb.h:29
UPB_INLINE bool google_protobuf_Struct_fields_get(const google_protobuf_Struct *msg, upb_strview key, google_protobuf_Value **val)
Definition: struct.upb.h:63
UPB_INLINE google_protobuf_Struct_FieldsEntry * google_protobuf_Struct_fields_nextmutable(google_protobuf_Struct *msg, size_t *iter)
Definition: struct.upb.h:69
UPB_INLINE google_protobuf_Value * google_protobuf_Value_new(upb_arena *arena)
Definition: struct.upb.h:91
UPB_INLINE google_protobuf_Value_kind_oneofcases google_protobuf_Value_kind_case(const google_protobuf_Value *msg)
Definition: struct.upb.h:118
const upb_msglayout google_protobuf_ListValue_msginit
Definition: struct.upb.c:72
UPB_INLINE void google_protobuf_Struct_FieldsEntry_set_value(google_protobuf_Struct_FieldsEntry *msg, google_protobuf_Value *value)
Definition: struct.upb.h:85
UPB_INLINE bool google_protobuf_Struct_fields_set(google_protobuf_Struct *msg, upb_strview key, google_protobuf_Value *val, upb_arena *a)
Definition: struct.upb.h:67
UPB_INLINE const google_protobuf_Struct * google_protobuf_Value_struct_value(const google_protobuf_Value *msg)
Definition: struct.upb.h:129
UPB_INLINE void google_protobuf_Value_set_null_value(google_protobuf_Value *msg, int32_t value)
Definition: struct.upb.h:133
UPB_INLINE const google_protobuf_ListValue * google_protobuf_Value_list_value(const google_protobuf_Value *msg)
Definition: struct.upb.h:131
UPB_INLINE google_protobuf_ListValue * google_protobuf_ListValue_parse_ex(const char *buf, size_t size, upb_arena *arena, int options)
Definition: struct.upb.h:180
struct google_protobuf_Struct_FieldsEntry google_protobuf_Struct_FieldsEntry
Definition: struct.upb.h:28
UPB_INLINE google_protobuf_ListValue * google_protobuf_ListValue_new(upb_arena *arena)
Definition: struct.upb.h:172
UPB_INLINE bool google_protobuf_Value_has_struct_value(const google_protobuf_Value *msg)
Definition: struct.upb.h:128
UPB_INLINE bool google_protobuf_Value_has_null_value(const google_protobuf_Value *msg)
Definition: struct.upb.h:120
UPB_INLINE bool google_protobuf_Struct_FieldsEntry_has_value(const google_protobuf_Struct_FieldsEntry *msg)
Definition: struct.upb.h:78
UPB_INLINE size_t google_protobuf_Struct_fields_size(const google_protobuf_Struct *msg)
Definition: struct.upb.h:62
UPB_INLINE bool google_protobuf_Value_has_number_value(const google_protobuf_Value *msg)
Definition: struct.upb.h:122
UPB_INLINE void google_protobuf_Value_set_struct_value(google_protobuf_Value *msg, google_protobuf_Struct *value)
Definition: struct.upb.h:145
google_protobuf_NullValue
Definition: struct.upb.h:36
@ google_protobuf_NULL_VALUE
Definition: struct.upb.h:37
UPB_INLINE google_protobuf_Value ** google_protobuf_ListValue_mutable_values(google_protobuf_ListValue *msg, size_t *len)
Definition: struct.upb.h:193
struct google_protobuf_Struct google_protobuf_Struct
Definition: struct.upb.h:27
UPB_INLINE const google_protobuf_Value *const * google_protobuf_ListValue_values(const google_protobuf_ListValue *msg, size_t *len)
Definition: struct.upb.h:191
upb_arena * arena
Definition: xds_api.cc:909