GRPC Core  9.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/generated_util.h"
13 #include "upb/msg.h"
14 #include "upb/decode.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 
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 }
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 char *google_protobuf_Struct_serialize(const google_protobuf_Struct *msg, upb_arena *arena, size_t *len) {
52  return upb_encode(msg, &google_protobuf_Struct_msginit, arena, len);
53 }
54 
55 UPB_INLINE const google_protobuf_Struct_FieldsEntry* const* google_protobuf_Struct_fields(const google_protobuf_Struct *msg, size_t *len) { return (const google_protobuf_Struct_FieldsEntry* const*)_upb_array_accessor(msg, UPB_SIZE(0, 0), len); }
56 
58  return (google_protobuf_Struct_FieldsEntry**)_upb_array_mutable_accessor(msg, UPB_SIZE(0, 0), len);
59 }
61  return (google_protobuf_Struct_FieldsEntry**)_upb_array_resize_accessor(msg, UPB_SIZE(0, 0), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
62 }
65  bool ok = _upb_array_append_accessor(
66  msg, UPB_SIZE(0, 0), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
67  if (!ok) return NULL;
68  return sub;
69 }
70 
71 /* google.protobuf.Struct.FieldsEntry */
72 
75 }
77  upb_arena *arena) {
79  return (ret && upb_decode(buf, size, ret, &google_protobuf_Struct_FieldsEntry_msginit, arena)) ? ret : NULL;
80 }
81 UPB_INLINE char *google_protobuf_Struct_FieldsEntry_serialize(const google_protobuf_Struct_FieldsEntry *msg, upb_arena *arena, size_t *len) {
82  return upb_encode(msg, &google_protobuf_Struct_FieldsEntry_msginit, arena, len);
83 }
84 
85 UPB_INLINE upb_strview google_protobuf_Struct_FieldsEntry_key(const google_protobuf_Struct_FieldsEntry *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)); }
86 UPB_INLINE const google_protobuf_Value* google_protobuf_Struct_FieldsEntry_value(const google_protobuf_Struct_FieldsEntry *msg) { return UPB_FIELD_AT(msg, const google_protobuf_Value*, UPB_SIZE(8, 16)); }
87 
89  UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)) = value;
90 }
92  UPB_FIELD_AT(msg, google_protobuf_Value*, UPB_SIZE(8, 16)) = value;
93 }
96  if (sub == NULL) {
97  sub = (struct google_protobuf_Value*)upb_msg_new(&google_protobuf_Value_msginit, arena);
98  if (!sub) return NULL;
100  }
101  return sub;
102 }
103 
104 /* google.protobuf.Value */
105 
106 UPB_INLINE google_protobuf_Value *google_protobuf_Value_new(upb_arena *arena) {
107  return (google_protobuf_Value *)upb_msg_new(&google_protobuf_Value_msginit, arena);
108 }
109 UPB_INLINE google_protobuf_Value *google_protobuf_Value_parse(const char *buf, size_t size,
110  upb_arena *arena) {
112  return (ret && upb_decode(buf, size, ret, &google_protobuf_Value_msginit, arena)) ? ret : NULL;
113 }
114 UPB_INLINE char *google_protobuf_Value_serialize(const google_protobuf_Value *msg, upb_arena *arena, size_t *len) {
115  return upb_encode(msg, &google_protobuf_Value_msginit, arena, len);
116 }
117 
118 typedef enum {
128 
129 UPB_INLINE bool google_protobuf_Value_has_null_value(const google_protobuf_Value *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(8, 16), 1); }
130 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); }
131 UPB_INLINE bool google_protobuf_Value_has_number_value(const google_protobuf_Value *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(8, 16), 2); }
132 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); }
133 UPB_INLINE bool google_protobuf_Value_has_string_value(const google_protobuf_Value *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(8, 16), 3); }
134 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(""))); }
135 UPB_INLINE bool google_protobuf_Value_has_bool_value(const google_protobuf_Value *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(8, 16), 4); }
136 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); }
137 UPB_INLINE bool google_protobuf_Value_has_struct_value(const google_protobuf_Value *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(8, 16), 5); }
138 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); }
139 UPB_INLINE bool google_protobuf_Value_has_list_value(const google_protobuf_Value *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(8, 16), 6); }
140 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); }
141 
142 UPB_INLINE void google_protobuf_Value_set_null_value(google_protobuf_Value *msg, int32_t value) {
143  UPB_WRITE_ONEOF(msg, int32_t, UPB_SIZE(0, 0), value, UPB_SIZE(8, 16), 1);
144 }
146  UPB_WRITE_ONEOF(msg, double, UPB_SIZE(0, 0), value, UPB_SIZE(8, 16), 2);
147 }
148 UPB_INLINE void google_protobuf_Value_set_string_value(google_protobuf_Value *msg, upb_strview value) {
149  UPB_WRITE_ONEOF(msg, upb_strview, UPB_SIZE(0, 0), value, UPB_SIZE(8, 16), 3);
150 }
152  UPB_WRITE_ONEOF(msg, bool, UPB_SIZE(0, 0), value, UPB_SIZE(8, 16), 4);
153 }
155  UPB_WRITE_ONEOF(msg, google_protobuf_Struct*, UPB_SIZE(0, 0), value, UPB_SIZE(8, 16), 5);
156 }
159  if (sub == NULL) {
160  sub = (struct google_protobuf_Struct*)upb_msg_new(&google_protobuf_Struct_msginit, arena);
161  if (!sub) return NULL;
163  }
164  return sub;
165 }
167  UPB_WRITE_ONEOF(msg, google_protobuf_ListValue*, UPB_SIZE(0, 0), value, UPB_SIZE(8, 16), 6);
168 }
171  if (sub == NULL) {
172  sub = (struct google_protobuf_ListValue*)upb_msg_new(&google_protobuf_ListValue_msginit, arena);
173  if (!sub) return NULL;
175  }
176  return sub;
177 }
178 
179 /* google.protobuf.ListValue */
180 
182  return (google_protobuf_ListValue *)upb_msg_new(&google_protobuf_ListValue_msginit, arena);
183 }
184 UPB_INLINE google_protobuf_ListValue *google_protobuf_ListValue_parse(const char *buf, size_t size,
185  upb_arena *arena) {
187  return (ret && upb_decode(buf, size, ret, &google_protobuf_ListValue_msginit, arena)) ? ret : NULL;
188 }
189 UPB_INLINE char *google_protobuf_ListValue_serialize(const google_protobuf_ListValue *msg, upb_arena *arena, size_t *len) {
190  return upb_encode(msg, &google_protobuf_ListValue_msginit, arena, len);
191 }
192 
193 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); }
194 
196  return (google_protobuf_Value**)_upb_array_mutable_accessor(msg, UPB_SIZE(0, 0), len);
197 }
199  return (google_protobuf_Value**)_upb_array_resize_accessor(msg, UPB_SIZE(0, 0), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
200 }
202  struct google_protobuf_Value* sub = (struct google_protobuf_Value*)upb_msg_new(&google_protobuf_Value_msginit, arena);
203  bool ok = _upb_array_append_accessor(
204  msg, UPB_SIZE(0, 0), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
205  if (!ok) return NULL;
206  return sub;
207 }
208 
209 #ifdef __cplusplus
210 } /* extern "C" */
211 #endif
212 
213 #include "upb/port_undef.inc"
214 
215 #endif /* GOOGLE_PROTOBUF_STRUCT_PROTO_UPB_H_ */
UPB_INLINE bool google_protobuf_Value_has_list_value(const google_protobuf_Value *msg)
Definition: struct.upb.h:139
UPB_INLINE bool google_protobuf_Value_has_struct_value(const google_protobuf_Value *msg)
Definition: struct.upb.h:137
Definition: struct.upb.h:123
UPB_INLINE google_protobuf_Value ** google_protobuf_ListValue_mutable_values(google_protobuf_ListValue *msg, size_t *len)
Definition: struct.upb.h:195
UPB_INLINE google_protobuf_Struct_FieldsEntry * google_protobuf_Struct_FieldsEntry_parse(const char *buf, size_t size, upb_arena *arena)
Definition: struct.upb.h:76
UPB_INLINE struct google_protobuf_Value * google_protobuf_ListValue_add_values(google_protobuf_ListValue *msg, upb_arena *arena)
Definition: struct.upb.h:201
UPB_INLINE google_protobuf_Struct_FieldsEntry * google_protobuf_Struct_FieldsEntry_new(upb_arena *arena)
Definition: struct.upb.h:73
UPB_INLINE char * google_protobuf_ListValue_serialize(const google_protobuf_ListValue *msg, upb_arena *arena, size_t *len)
Definition: struct.upb.h:189
UPB_INLINE const google_protobuf_Struct * google_protobuf_Value_struct_value(const google_protobuf_Value *msg)
Definition: struct.upb.h:138
Definition: struct.upb.h:125
UPB_INLINE void google_protobuf_Value_set_number_value(google_protobuf_Value *msg, double value)
Definition: struct.upb.h:145
Definition: struct.upb.h:120
UPB_INLINE void google_protobuf_Value_set_struct_value(google_protobuf_Value *msg, google_protobuf_Struct *value)
Definition: struct.upb.h:154
UPB_INLINE void google_protobuf_Value_set_list_value(google_protobuf_Value *msg, google_protobuf_ListValue *value)
Definition: struct.upb.h:166
struct google_protobuf_Struct google_protobuf_Struct
Definition: struct.upb.h:27
UPB_INLINE bool google_protobuf_Value_has_string_value(const google_protobuf_Value *msg)
Definition: struct.upb.h:133
UPB_INLINE const google_protobuf_Value * google_protobuf_Struct_FieldsEntry_value(const google_protobuf_Struct_FieldsEntry *msg)
Definition: struct.upb.h:86
UPB_INLINE struct google_protobuf_Value * google_protobuf_Struct_FieldsEntry_mutable_value(google_protobuf_Struct_FieldsEntry *msg, 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
Definition: struct.upb.h:122
Definition: struct.upb.h:37
UPB_INLINE int32_t google_protobuf_Value_null_value(const google_protobuf_Value *msg)
Definition: struct.upb.h:130
struct google_protobuf_Struct_FieldsEntry google_protobuf_Struct_FieldsEntry
Definition: struct.upb.h:28
struct google_protobuf_ListValue google_protobuf_ListValue
Definition: struct.upb.h:30
UPB_INLINE google_protobuf_ListValue * google_protobuf_ListValue_new(upb_arena *arena)
Definition: struct.upb.h:181
UPB_INLINE const google_protobuf_ListValue * google_protobuf_Value_list_value(const google_protobuf_Value *msg)
Definition: struct.upb.h:140
UPB_INLINE struct google_protobuf_Struct * google_protobuf_Value_mutable_struct_value(google_protobuf_Value *msg, upb_arena *arena)
Definition: struct.upb.h:157
UPB_INLINE bool google_protobuf_Value_bool_value(const google_protobuf_Value *msg)
Definition: struct.upb.h:136
UPB_INLINE void google_protobuf_Struct_FieldsEntry_set_value(google_protobuf_Struct_FieldsEntry *msg, google_protobuf_Value *value)
Definition: struct.upb.h:91
UPB_INLINE google_protobuf_ListValue * google_protobuf_ListValue_parse(const char *buf, size_t size, upb_arena *arena)
Definition: struct.upb.h:184
google_protobuf_NullValue
Definition: struct.upb.h:36
UPB_INLINE char * google_protobuf_Struct_FieldsEntry_serialize(const google_protobuf_Struct_FieldsEntry *msg, upb_arena *arena, size_t *len)
Definition: struct.upb.h:81
UPB_INLINE void google_protobuf_Value_set_string_value(google_protobuf_Value *msg, upb_strview value)
Definition: struct.upb.h:148
UPB_INLINE google_protobuf_Value_kind_oneofcases google_protobuf_Value_kind_case(const google_protobuf_Value *msg)
Definition: struct.upb.h:127
UPB_INLINE google_protobuf_Struct * google_protobuf_Struct_new(upb_arena *arena)
Definition: struct.upb.h:43
UPB_INLINE google_protobuf_Value ** google_protobuf_ListValue_resize_values(google_protobuf_ListValue *msg, size_t len, upb_arena *arena)
Definition: struct.upb.h:198
const upb_msglayout google_protobuf_ListValue_msginit
Definition: struct.upb.c:72
UPB_INLINE bool google_protobuf_Value_has_bool_value(const google_protobuf_Value *msg)
Definition: struct.upb.h:135
const upb_msglayout google_protobuf_Struct_FieldsEntry_msginit
Definition: struct.upb.c:38
UPB_INLINE google_protobuf_Value * google_protobuf_Value_new(upb_arena *arena)
Definition: struct.upb.h:106
UPB_INLINE double google_protobuf_Value_number_value(const google_protobuf_Value *msg)
Definition: struct.upb.h:132
UPB_INLINE bool google_protobuf_Value_has_null_value(const google_protobuf_Value *msg)
Definition: struct.upb.h:129
const upb_msglayout google_protobuf_Value_msginit
Definition: struct.upb.c:58
UPB_INLINE void google_protobuf_Value_set_bool_value(google_protobuf_Value *msg, bool value)
Definition: struct.upb.h:151
Definition: struct.upb.h:124
UPB_INLINE upb_strview google_protobuf_Value_string_value(const google_protobuf_Value *msg)
Definition: struct.upb.h:134
UPB_INLINE struct google_protobuf_ListValue * google_protobuf_Value_mutable_list_value(google_protobuf_Value *msg, upb_arena *arena)
Definition: struct.upb.h:169
google_protobuf_Value_kind_oneofcases
Definition: struct.upb.h:118
Definition: struct.upb.h:119
UPB_INLINE google_protobuf_Struct_FieldsEntry ** google_protobuf_Struct_mutable_fields(google_protobuf_Struct *msg, size_t *len)
Definition: struct.upb.h:57
UPB_INLINE char * google_protobuf_Struct_serialize(const google_protobuf_Struct *msg, upb_arena *arena, size_t *len)
Definition: struct.upb.h:51
struct google_protobuf_Value google_protobuf_Value
Definition: struct.upb.h:29
UPB_INLINE const google_protobuf_Struct_FieldsEntry *const * google_protobuf_Struct_fields(const google_protobuf_Struct *msg, size_t *len)
Definition: struct.upb.h:55
UPB_INLINE void google_protobuf_Value_set_null_value(google_protobuf_Value *msg, int32_t value)
Definition: struct.upb.h:142
UPB_INLINE upb_strview google_protobuf_Struct_FieldsEntry_key(const google_protobuf_Struct_FieldsEntry *msg)
Definition: struct.upb.h:85
UPB_INLINE struct google_protobuf_Struct_FieldsEntry * google_protobuf_Struct_add_fields(google_protobuf_Struct *msg, upb_arena *arena)
Definition: struct.upb.h:63
UPB_INLINE bool google_protobuf_Value_has_number_value(const google_protobuf_Value *msg)
Definition: struct.upb.h:131
UPB_INLINE google_protobuf_Struct_FieldsEntry ** google_protobuf_Struct_resize_fields(google_protobuf_Struct *msg, size_t len, upb_arena *arena)
Definition: struct.upb.h:60
UPB_INLINE const google_protobuf_Value *const * google_protobuf_ListValue_values(const google_protobuf_ListValue *msg, size_t *len)
Definition: struct.upb.h:193
UPB_INLINE void google_protobuf_Struct_FieldsEntry_set_key(google_protobuf_Struct_FieldsEntry *msg, upb_strview value)
Definition: struct.upb.h:88
Definition: struct.upb.h:121
UPB_INLINE char * google_protobuf_Value_serialize(const google_protobuf_Value *msg, upb_arena *arena, size_t *len)
Definition: struct.upb.h:114
UPB_INLINE google_protobuf_Value * google_protobuf_Value_parse(const char *buf, size_t size, upb_arena *arena)
Definition: struct.upb.h:109
const upb_msglayout google_protobuf_Struct_msginit
Definition: struct.upb.c:23