aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/ext/upb-generated/google/protobuf/struct.upb.h
blob: 5493794f0e68bf08f15e8fa0a50f333dcf0e8917 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
/* This file was generated by upbc (the upb compiler) from the input
 * file:
 *
 *     google/protobuf/struct.proto
 *
 * Do not edit -- your changes will be discarded when the file is
 * regenerated. */

#ifndef GOOGLE_PROTOBUF_STRUCT_PROTO_UPB_H_
#define GOOGLE_PROTOBUF_STRUCT_PROTO_UPB_H_

#include "upb/msg.h"

#include "upb/decode.h"
#include "upb/encode.h"
#include "upb/port_def.inc"
UPB_BEGIN_EXTERN_C

struct google_protobuf_Struct;
struct google_protobuf_Struct_FieldsEntry;
struct google_protobuf_Value;
struct google_protobuf_ListValue;
typedef struct google_protobuf_Struct google_protobuf_Struct;
typedef struct google_protobuf_Struct_FieldsEntry
    google_protobuf_Struct_FieldsEntry;
typedef struct google_protobuf_Value google_protobuf_Value;
typedef struct google_protobuf_ListValue google_protobuf_ListValue;

/* Enums */

typedef enum { google_protobuf_NULL_VALUE = 0 } google_protobuf_NullValue;

/* google.protobuf.Struct */

extern const upb_msglayout google_protobuf_Struct_msginit;
UPB_INLINE google_protobuf_Struct* google_protobuf_Struct_new(
    upb_arena* arena) {
  return upb_msg_new(&google_protobuf_Struct_msginit, arena);
}
UPB_INLINE google_protobuf_Struct* google_protobuf_Struct_parsenew(
    upb_stringview buf, upb_arena* arena) {
  google_protobuf_Struct* ret = google_protobuf_Struct_new(arena);
  return (ret && upb_decode(buf, ret, &google_protobuf_Struct_msginit)) ? ret
                                                                        : NULL;
}
UPB_INLINE char* google_protobuf_Struct_serialize(
    const google_protobuf_Struct* msg, upb_arena* arena, size_t* len) {
  return upb_encode(msg, &google_protobuf_Struct_msginit, arena, len);
}

UPB_INLINE const upb_array* google_protobuf_Struct_fields(
    const google_protobuf_Struct* msg) {
  return UPB_FIELD_AT(msg, const upb_array*, UPB_SIZE(0, 0));
}

UPB_INLINE void google_protobuf_Struct_set_fields(google_protobuf_Struct* msg,
                                                  upb_array* value) {
  UPB_FIELD_AT(msg, upb_array*, UPB_SIZE(0, 0)) = value;
}

/* google.protobuf.Struct.FieldsEntry */

extern const upb_msglayout google_protobuf_Struct_FieldsEntry_msginit;
UPB_INLINE google_protobuf_Struct_FieldsEntry*
google_protobuf_Struct_FieldsEntry_new(upb_arena* arena) {
  return upb_msg_new(&google_protobuf_Struct_FieldsEntry_msginit, arena);
}
UPB_INLINE google_protobuf_Struct_FieldsEntry*
google_protobuf_Struct_FieldsEntry_parsenew(upb_stringview buf,
                                            upb_arena* arena) {
  google_protobuf_Struct_FieldsEntry* ret =
      google_protobuf_Struct_FieldsEntry_new(arena);
  return (ret &&
          upb_decode(buf, ret, &google_protobuf_Struct_FieldsEntry_msginit))
             ? ret
             : NULL;
}
UPB_INLINE char* google_protobuf_Struct_FieldsEntry_serialize(
    const google_protobuf_Struct_FieldsEntry* msg, upb_arena* arena,
    size_t* len) {
  return upb_encode(msg, &google_protobuf_Struct_FieldsEntry_msginit, arena,
                    len);
}

UPB_INLINE upb_stringview google_protobuf_Struct_FieldsEntry_key(
    const google_protobuf_Struct_FieldsEntry* msg) {
  return UPB_FIELD_AT(msg, upb_stringview, UPB_SIZE(0, 0));
}
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));
}

UPB_INLINE void google_protobuf_Struct_FieldsEntry_set_key(
    google_protobuf_Struct_FieldsEntry* msg, upb_stringview value) {
  UPB_FIELD_AT(msg, upb_stringview, UPB_SIZE(0, 0)) = value;
}
UPB_INLINE void google_protobuf_Struct_FieldsEntry_set_value(
    google_protobuf_Struct_FieldsEntry* msg, google_protobuf_Value* value) {
  UPB_FIELD_AT(msg, google_protobuf_Value*, UPB_SIZE(8, 16)) = value;
}

/* google.protobuf.Value */

extern const upb_msglayout google_protobuf_Value_msginit;
UPB_INLINE google_protobuf_Value* google_protobuf_Value_new(upb_arena* arena) {
  return upb_msg_new(&google_protobuf_Value_msginit, arena);
}
UPB_INLINE google_protobuf_Value* google_protobuf_Value_parsenew(
    upb_stringview buf, upb_arena* arena) {
  google_protobuf_Value* ret = google_protobuf_Value_new(arena);
  return (ret && upb_decode(buf, ret, &google_protobuf_Value_msginit)) ? ret
                                                                       : NULL;
}
UPB_INLINE char* google_protobuf_Value_serialize(
    const google_protobuf_Value* msg, upb_arena* arena, size_t* len) {
  return upb_encode(msg, &google_protobuf_Value_msginit, arena, len);
}

typedef enum {
  google_protobuf_Value_kind_null_value = 1,
  google_protobuf_Value_kind_number_value = 2,
  google_protobuf_Value_kind_string_value = 3,
  google_protobuf_Value_kind_bool_value = 4,
  google_protobuf_Value_kind_struct_value = 5,
  google_protobuf_Value_kind_list_value = 6,
  google_protobuf_Value_kind_NOT_SET = 0,
} google_protobuf_Value_kind_oneofcases;
UPB_INLINE google_protobuf_Value_kind_oneofcases
google_protobuf_Value_kind_case(const google_protobuf_Value* msg) {
  return UPB_FIELD_AT(msg, int, UPB_SIZE(8, 16));
}

UPB_INLINE google_protobuf_NullValue
google_protobuf_Value_null_value(const google_protobuf_Value* msg) {
  return UPB_READ_ONEOF(msg, google_protobuf_NullValue, UPB_SIZE(0, 0),
                        UPB_SIZE(8, 16), 1, google_protobuf_NULL_VALUE);
}
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);
}
UPB_INLINE upb_stringview
google_protobuf_Value_string_value(const google_protobuf_Value* msg) {
  return UPB_READ_ONEOF(msg, upb_stringview, UPB_SIZE(0, 0), UPB_SIZE(8, 16), 3,
                        upb_stringview_make("", strlen("")));
}
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);
}
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);
}
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);
}

UPB_INLINE void google_protobuf_Value_set_null_value(
    google_protobuf_Value* msg, google_protobuf_NullValue value) {
  UPB_WRITE_ONEOF(msg, google_protobuf_NullValue, UPB_SIZE(0, 0), value,
                  UPB_SIZE(8, 16), 1);
}
UPB_INLINE void google_protobuf_Value_set_number_value(
    google_protobuf_Value* msg, double value) {
  UPB_WRITE_ONEOF(msg, double, UPB_SIZE(0, 0), value, UPB_SIZE(8, 16), 2);
}
UPB_INLINE void google_protobuf_Value_set_string_value(
    google_protobuf_Value* msg, upb_stringview value) {
  UPB_WRITE_ONEOF(msg, upb_stringview, UPB_SIZE(0, 0), value, UPB_SIZE(8, 16),
                  3);
}
UPB_INLINE void google_protobuf_Value_set_bool_value(google_protobuf_Value* msg,
                                                     bool value) {
  UPB_WRITE_ONEOF(msg, bool, UPB_SIZE(0, 0), value, UPB_SIZE(8, 16), 4);
}
UPB_INLINE void google_protobuf_Value_set_struct_value(
    google_protobuf_Value* msg, google_protobuf_Struct* value) {
  UPB_WRITE_ONEOF(msg, google_protobuf_Struct*, UPB_SIZE(0, 0), value,
                  UPB_SIZE(8, 16), 5);
}
UPB_INLINE void google_protobuf_Value_set_list_value(
    google_protobuf_Value* msg, google_protobuf_ListValue* value) {
  UPB_WRITE_ONEOF(msg, google_protobuf_ListValue*, UPB_SIZE(0, 0), value,
                  UPB_SIZE(8, 16), 6);
}

/* google.protobuf.ListValue */

extern const upb_msglayout google_protobuf_ListValue_msginit;
UPB_INLINE google_protobuf_ListValue* google_protobuf_ListValue_new(
    upb_arena* arena) {
  return upb_msg_new(&google_protobuf_ListValue_msginit, arena);
}
UPB_INLINE google_protobuf_ListValue* google_protobuf_ListValue_parsenew(
    upb_stringview buf, upb_arena* arena) {
  google_protobuf_ListValue* ret = google_protobuf_ListValue_new(arena);
  return (ret && upb_decode(buf, ret, &google_protobuf_ListValue_msginit))
             ? ret
             : NULL;
}
UPB_INLINE char* google_protobuf_ListValue_serialize(
    const google_protobuf_ListValue* msg, upb_arena* arena, size_t* len) {
  return upb_encode(msg, &google_protobuf_ListValue_msginit, arena, len);
}

UPB_INLINE const upb_array* google_protobuf_ListValue_values(
    const google_protobuf_ListValue* msg) {
  return UPB_FIELD_AT(msg, const upb_array*, UPB_SIZE(0, 0));
}

UPB_INLINE void google_protobuf_ListValue_set_values(
    google_protobuf_ListValue* msg, upb_array* value) {
  UPB_FIELD_AT(msg, upb_array*, UPB_SIZE(0, 0)) = value;
}

UPB_END_EXTERN_C

#include "upb/port_undef.inc"

#endif /* GOOGLE_PROTOBUF_STRUCT_PROTO_UPB_H_ */