google-protobuf 3.19.0.rc.1-x86_64-darwin
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of google-protobuf might be problematic. Click here for more details.
- checksums.yaml +7 -0
- data/ext/google/protobuf_c/convert.c +348 -0
- data/ext/google/protobuf_c/convert.h +72 -0
- data/ext/google/protobuf_c/defs.c +1284 -0
- data/ext/google/protobuf_c/defs.h +107 -0
- data/ext/google/protobuf_c/extconf.rb +20 -0
- data/ext/google/protobuf_c/map.c +694 -0
- data/ext/google/protobuf_c/map.h +67 -0
- data/ext/google/protobuf_c/message.c +1328 -0
- data/ext/google/protobuf_c/message.h +101 -0
- data/ext/google/protobuf_c/protobuf.c +470 -0
- data/ext/google/protobuf_c/protobuf.h +117 -0
- data/ext/google/protobuf_c/repeated_field.c +659 -0
- data/ext/google/protobuf_c/repeated_field.h +63 -0
- data/ext/google/protobuf_c/ruby-upb.c +9171 -0
- data/ext/google/protobuf_c/ruby-upb.h +4704 -0
- data/ext/google/protobuf_c/wrap_memcpy.c +51 -0
- data/lib/google/2.3/protobuf_c.bundle +0 -0
- data/lib/google/2.4/protobuf_c.bundle +0 -0
- data/lib/google/2.5/protobuf_c.bundle +0 -0
- data/lib/google/2.6/protobuf_c.bundle +0 -0
- data/lib/google/2.7/protobuf_c.bundle +0 -0
- data/lib/google/3.0/protobuf_c.bundle +0 -0
- data/lib/google/protobuf/any_pb.rb +19 -0
- data/lib/google/protobuf/api_pb.rb +41 -0
- data/lib/google/protobuf/descriptor_dsl.rb +458 -0
- data/lib/google/protobuf/descriptor_pb.rb +266 -0
- data/lib/google/protobuf/duration_pb.rb +19 -0
- data/lib/google/protobuf/empty_pb.rb +17 -0
- data/lib/google/protobuf/field_mask_pb.rb +18 -0
- data/lib/google/protobuf/message_exts.rb +53 -0
- data/lib/google/protobuf/repeated_field.rb +188 -0
- data/lib/google/protobuf/source_context_pb.rb +18 -0
- data/lib/google/protobuf/struct_pb.rb +37 -0
- data/lib/google/protobuf/timestamp_pb.rb +19 -0
- data/lib/google/protobuf/type_pb.rb +91 -0
- data/lib/google/protobuf/well_known_types.rb +235 -0
- data/lib/google/protobuf/wrappers_pb.rb +50 -0
- data/lib/google/protobuf.rb +79 -0
- data/tests/basic.rb +640 -0
- data/tests/generated_code_test.rb +23 -0
- data/tests/stress.rb +38 -0
- metadata +144 -0
@@ -0,0 +1,4704 @@
|
|
1
|
+
/* Amalgamated source file */
|
2
|
+
/*
|
3
|
+
* Copyright (c) 2009-2021, Google LLC
|
4
|
+
* All rights reserved.
|
5
|
+
*
|
6
|
+
* Redistribution and use in source and binary forms, with or without
|
7
|
+
* modification, are permitted provided that the following conditions are met:
|
8
|
+
* * Redistributions of source code must retain the above copyright
|
9
|
+
* notice, this list of conditions and the following disclaimer.
|
10
|
+
* * Redistributions in binary form must reproduce the above copyright
|
11
|
+
* notice, this list of conditions and the following disclaimer in the
|
12
|
+
* documentation and/or other materials provided with the distribution.
|
13
|
+
* * Neither the name of Google LLC nor the
|
14
|
+
* names of its contributors may be used to endorse or promote products
|
15
|
+
* derived from this software without specific prior written permission.
|
16
|
+
*
|
17
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
18
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
19
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
20
|
+
* DISCLAIMED. IN NO EVENT SHALL Google LLC BE LIABLE FOR ANY
|
21
|
+
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
22
|
+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
23
|
+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
24
|
+
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
25
|
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
26
|
+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
27
|
+
*/
|
28
|
+
|
29
|
+
/*
|
30
|
+
* This is where we define macros used across upb.
|
31
|
+
*
|
32
|
+
* All of these macros are undef'd in port_undef.inc to avoid leaking them to
|
33
|
+
* users.
|
34
|
+
*
|
35
|
+
* The correct usage is:
|
36
|
+
*
|
37
|
+
* #include "upb/foobar.h"
|
38
|
+
* #include "upb/baz.h"
|
39
|
+
*
|
40
|
+
* // MUST be last included header.
|
41
|
+
* #include "upb/port_def.inc"
|
42
|
+
*
|
43
|
+
* // Code for this file.
|
44
|
+
* // <...>
|
45
|
+
*
|
46
|
+
* // Can be omitted for .c files, required for .h.
|
47
|
+
* #include "upb/port_undef.inc"
|
48
|
+
*
|
49
|
+
* This file is private and must not be included by users!
|
50
|
+
*/
|
51
|
+
|
52
|
+
#if !((defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \
|
53
|
+
(defined(__cplusplus) && __cplusplus >= 201103L) || \
|
54
|
+
(defined(_MSC_VER) && _MSC_VER >= 1900))
|
55
|
+
#error upb requires C99 or C++11 or MSVC >= 2015.
|
56
|
+
#endif
|
57
|
+
|
58
|
+
#include <stdint.h>
|
59
|
+
#include <stddef.h>
|
60
|
+
|
61
|
+
#if UINTPTR_MAX == 0xffffffff
|
62
|
+
#define UPB_SIZE(size32, size64) size32
|
63
|
+
#else
|
64
|
+
#define UPB_SIZE(size32, size64) size64
|
65
|
+
#endif
|
66
|
+
|
67
|
+
/* If we always read/write as a consistent type to each address, this shouldn't
|
68
|
+
* violate aliasing.
|
69
|
+
*/
|
70
|
+
#define UPB_PTR_AT(msg, ofs, type) ((type*)((char*)(msg) + (ofs)))
|
71
|
+
|
72
|
+
#define UPB_READ_ONEOF(msg, fieldtype, offset, case_offset, case_val, default) \
|
73
|
+
*UPB_PTR_AT(msg, case_offset, int) == case_val \
|
74
|
+
? *UPB_PTR_AT(msg, offset, fieldtype) \
|
75
|
+
: default
|
76
|
+
|
77
|
+
#define UPB_WRITE_ONEOF(msg, fieldtype, offset, value, case_offset, case_val) \
|
78
|
+
*UPB_PTR_AT(msg, case_offset, int) = case_val; \
|
79
|
+
*UPB_PTR_AT(msg, offset, fieldtype) = value;
|
80
|
+
|
81
|
+
#define UPB_MAPTYPE_STRING 0
|
82
|
+
|
83
|
+
/* UPB_INLINE: inline if possible, emit standalone code if required. */
|
84
|
+
#ifdef __cplusplus
|
85
|
+
#define UPB_INLINE inline
|
86
|
+
#elif defined (__GNUC__) || defined(__clang__)
|
87
|
+
#define UPB_INLINE static __inline__
|
88
|
+
#else
|
89
|
+
#define UPB_INLINE static
|
90
|
+
#endif
|
91
|
+
|
92
|
+
#define UPB_ALIGN_UP(size, align) (((size) + (align) - 1) / (align) * (align))
|
93
|
+
#define UPB_ALIGN_DOWN(size, align) ((size) / (align) * (align))
|
94
|
+
#define UPB_ALIGN_MALLOC(size) UPB_ALIGN_UP(size, 16)
|
95
|
+
#define UPB_ALIGN_OF(type) offsetof (struct { char c; type member; }, member)
|
96
|
+
|
97
|
+
/* Hints to the compiler about likely/unlikely branches. */
|
98
|
+
#if defined (__GNUC__) || defined(__clang__)
|
99
|
+
#define UPB_LIKELY(x) __builtin_expect((x),1)
|
100
|
+
#define UPB_UNLIKELY(x) __builtin_expect((x),0)
|
101
|
+
#else
|
102
|
+
#define UPB_LIKELY(x) (x)
|
103
|
+
#define UPB_UNLIKELY(x) (x)
|
104
|
+
#endif
|
105
|
+
|
106
|
+
/* Macros for function attributes on compilers that support them. */
|
107
|
+
#ifdef __GNUC__
|
108
|
+
#define UPB_FORCEINLINE __inline__ __attribute__((always_inline))
|
109
|
+
#define UPB_NOINLINE __attribute__((noinline))
|
110
|
+
#define UPB_NORETURN __attribute__((__noreturn__))
|
111
|
+
#define UPB_PRINTF(str, first_vararg) __attribute__((format (printf, str, first_vararg)))
|
112
|
+
#elif defined(_MSC_VER)
|
113
|
+
#define UPB_NOINLINE
|
114
|
+
#define UPB_FORCEINLINE
|
115
|
+
#define UPB_NORETURN __declspec(noreturn)
|
116
|
+
#define UPB_PRINTF(str, first_vararg)
|
117
|
+
#else /* !defined(__GNUC__) */
|
118
|
+
#define UPB_FORCEINLINE
|
119
|
+
#define UPB_NOINLINE
|
120
|
+
#define UPB_NORETURN
|
121
|
+
#define UPB_PRINTF(str, first_vararg)
|
122
|
+
#endif
|
123
|
+
|
124
|
+
#define UPB_MAX(x, y) ((x) > (y) ? (x) : (y))
|
125
|
+
#define UPB_MIN(x, y) ((x) < (y) ? (x) : (y))
|
126
|
+
|
127
|
+
#define UPB_UNUSED(var) (void)var
|
128
|
+
|
129
|
+
/* UPB_ASSUME(): in release mode, we tell the compiler to assume this is true.
|
130
|
+
*/
|
131
|
+
#ifdef NDEBUG
|
132
|
+
#ifdef __GNUC__
|
133
|
+
#define UPB_ASSUME(expr) if (!(expr)) __builtin_unreachable()
|
134
|
+
#elif defined _MSC_VER
|
135
|
+
#define UPB_ASSUME(expr) if (!(expr)) __assume(0)
|
136
|
+
#else
|
137
|
+
#define UPB_ASSUME(expr) do {} while (false && (expr))
|
138
|
+
#endif
|
139
|
+
#else
|
140
|
+
#define UPB_ASSUME(expr) assert(expr)
|
141
|
+
#endif
|
142
|
+
|
143
|
+
/* UPB_ASSERT(): in release mode, we use the expression without letting it be
|
144
|
+
* evaluated. This prevents "unused variable" warnings. */
|
145
|
+
#ifdef NDEBUG
|
146
|
+
#define UPB_ASSERT(expr) do {} while (false && (expr))
|
147
|
+
#else
|
148
|
+
#define UPB_ASSERT(expr) assert(expr)
|
149
|
+
#endif
|
150
|
+
|
151
|
+
#if defined(__GNUC__) || defined(__clang__)
|
152
|
+
#define UPB_UNREACHABLE() do { assert(0); __builtin_unreachable(); } while(0)
|
153
|
+
#else
|
154
|
+
#define UPB_UNREACHABLE() do { assert(0); } while(0)
|
155
|
+
#endif
|
156
|
+
|
157
|
+
/* UPB_SETJMP() / UPB_LONGJMP(): avoid setting/restoring signal mask. */
|
158
|
+
#ifdef __APPLE__
|
159
|
+
#define UPB_SETJMP(buf) _setjmp(buf)
|
160
|
+
#define UPB_LONGJMP(buf, val) _longjmp(buf, val)
|
161
|
+
#else
|
162
|
+
#define UPB_SETJMP(buf) setjmp(buf)
|
163
|
+
#define UPB_LONGJMP(buf, val) longjmp(buf, val)
|
164
|
+
#endif
|
165
|
+
|
166
|
+
/* UPB_PTRADD(ptr, ofs): add pointer while avoiding "NULL + 0" UB */
|
167
|
+
#define UPB_PTRADD(ptr, ofs) ((ofs) ? (ptr) + (ofs) : (ptr))
|
168
|
+
|
169
|
+
/* Configure whether fasttable is switched on or not. *************************/
|
170
|
+
|
171
|
+
#ifdef __has_attribute
|
172
|
+
#define UPB_HAS_ATTRIBUTE(x) __has_attribute(x)
|
173
|
+
#else
|
174
|
+
#define UPB_HAS_ATTRIBUTE(x) 0
|
175
|
+
#endif
|
176
|
+
|
177
|
+
#if UPB_HAS_ATTRIBUTE(musttail)
|
178
|
+
#define UPB_MUSTTAIL __attribute__((musttail))
|
179
|
+
#else
|
180
|
+
#define UPB_MUSTTAIL
|
181
|
+
#endif
|
182
|
+
|
183
|
+
#undef UPB_HAS_ATTRIBUTE
|
184
|
+
|
185
|
+
/* This check is not fully robust: it does not require that we have "musttail"
|
186
|
+
* support available. We need tail calls to avoid consuming arbitrary amounts
|
187
|
+
* of stack space.
|
188
|
+
*
|
189
|
+
* GCC/Clang can mostly be trusted to generate tail calls as long as
|
190
|
+
* optimization is enabled, but, debug builds will not generate tail calls
|
191
|
+
* unless "musttail" is available.
|
192
|
+
*
|
193
|
+
* We should probably either:
|
194
|
+
* 1. require that the compiler supports musttail.
|
195
|
+
* 2. add some fallback code for when musttail isn't available (ie. return
|
196
|
+
* instead of tail calling). This is safe and portable, but this comes at
|
197
|
+
* a CPU cost.
|
198
|
+
*/
|
199
|
+
#if (defined(__x86_64__) || defined(__aarch64__)) && defined(__GNUC__)
|
200
|
+
#define UPB_FASTTABLE_SUPPORTED 1
|
201
|
+
#else
|
202
|
+
#define UPB_FASTTABLE_SUPPORTED 0
|
203
|
+
#endif
|
204
|
+
|
205
|
+
/* define UPB_ENABLE_FASTTABLE to force fast table support.
|
206
|
+
* This is useful when we want to ensure we are really getting fasttable,
|
207
|
+
* for example for testing or benchmarking. */
|
208
|
+
#if defined(UPB_ENABLE_FASTTABLE)
|
209
|
+
#if !UPB_FASTTABLE_SUPPORTED
|
210
|
+
#error fasttable is x86-64/ARM64 only and requires GCC or Clang.
|
211
|
+
#endif
|
212
|
+
#define UPB_FASTTABLE 1
|
213
|
+
/* Define UPB_TRY_ENABLE_FASTTABLE to use fasttable if possible.
|
214
|
+
* This is useful for releasing code that might be used on multiple platforms,
|
215
|
+
* for example the PHP or Ruby C extensions. */
|
216
|
+
#elif defined(UPB_TRY_ENABLE_FASTTABLE)
|
217
|
+
#define UPB_FASTTABLE UPB_FASTTABLE_SUPPORTED
|
218
|
+
#else
|
219
|
+
#define UPB_FASTTABLE 0
|
220
|
+
#endif
|
221
|
+
|
222
|
+
/* UPB_FASTTABLE_INIT() allows protos compiled for fasttable to gracefully
|
223
|
+
* degrade to non-fasttable if we are using UPB_TRY_ENABLE_FASTTABLE. */
|
224
|
+
#if !UPB_FASTTABLE && defined(UPB_TRY_ENABLE_FASTTABLE)
|
225
|
+
#define UPB_FASTTABLE_INIT(...)
|
226
|
+
#else
|
227
|
+
#define UPB_FASTTABLE_INIT(...) __VA_ARGS__
|
228
|
+
#endif
|
229
|
+
|
230
|
+
#undef UPB_FASTTABLE_SUPPORTED
|
231
|
+
|
232
|
+
/* ASAN poisoning (for arena) *************************************************/
|
233
|
+
|
234
|
+
#if defined(__SANITIZE_ADDRESS__)
|
235
|
+
#define UPB_ASAN 1
|
236
|
+
#ifdef __cplusplus
|
237
|
+
extern "C" {
|
238
|
+
#endif
|
239
|
+
void __asan_poison_memory_region(void const volatile *addr, size_t size);
|
240
|
+
void __asan_unpoison_memory_region(void const volatile *addr, size_t size);
|
241
|
+
#ifdef __cplusplus
|
242
|
+
} /* extern "C" */
|
243
|
+
#endif
|
244
|
+
#define UPB_POISON_MEMORY_REGION(addr, size) \
|
245
|
+
__asan_poison_memory_region((addr), (size))
|
246
|
+
#define UPB_UNPOISON_MEMORY_REGION(addr, size) \
|
247
|
+
__asan_unpoison_memory_region((addr), (size))
|
248
|
+
#else
|
249
|
+
#define UPB_ASAN 0
|
250
|
+
#define UPB_POISON_MEMORY_REGION(addr, size) \
|
251
|
+
((void)(addr), (void)(size))
|
252
|
+
#define UPB_UNPOISON_MEMORY_REGION(addr, size) \
|
253
|
+
((void)(addr), (void)(size))
|
254
|
+
#endif
|
255
|
+
|
256
|
+
/** upb/decode.h ************************************************************/
|
257
|
+
/*
|
258
|
+
* upb_decode: parsing into a upb_msg using a upb_msglayout.
|
259
|
+
*/
|
260
|
+
|
261
|
+
#ifndef UPB_DECODE_H_
|
262
|
+
#define UPB_DECODE_H_
|
263
|
+
|
264
|
+
|
265
|
+
/** upb/msg.h ************************************************************/
|
266
|
+
/*
|
267
|
+
* Public APIs for message operations that do not require descriptors.
|
268
|
+
* These functions can be used even in build that does not want to depend on
|
269
|
+
* reflection or descriptors.
|
270
|
+
*
|
271
|
+
* Descriptor-based reflection functionality lives in reflection.h.
|
272
|
+
*/
|
273
|
+
|
274
|
+
#ifndef UPB_MSG_H_
|
275
|
+
#define UPB_MSG_H_
|
276
|
+
|
277
|
+
#include <stddef.h>
|
278
|
+
|
279
|
+
|
280
|
+
/** upb/upb.h ************************************************************/
|
281
|
+
/*
|
282
|
+
* This file contains shared definitions that are widely used across upb.
|
283
|
+
*/
|
284
|
+
|
285
|
+
#ifndef UPB_H_
|
286
|
+
#define UPB_H_
|
287
|
+
|
288
|
+
#include <assert.h>
|
289
|
+
#include <stdarg.h>
|
290
|
+
#include <stdbool.h>
|
291
|
+
#include <stddef.h>
|
292
|
+
#include <stdint.h>
|
293
|
+
#include <string.h>
|
294
|
+
|
295
|
+
|
296
|
+
#ifdef __cplusplus
|
297
|
+
extern "C" {
|
298
|
+
#endif
|
299
|
+
|
300
|
+
/* upb_status *****************************************************************/
|
301
|
+
|
302
|
+
#define UPB_STATUS_MAX_MESSAGE 127
|
303
|
+
|
304
|
+
typedef struct {
|
305
|
+
bool ok;
|
306
|
+
char msg[UPB_STATUS_MAX_MESSAGE]; /* Error message; NULL-terminated. */
|
307
|
+
} upb_status;
|
308
|
+
|
309
|
+
const char *upb_status_errmsg(const upb_status *status);
|
310
|
+
bool upb_ok(const upb_status *status);
|
311
|
+
|
312
|
+
/* These are no-op if |status| is NULL. */
|
313
|
+
void upb_status_clear(upb_status *status);
|
314
|
+
void upb_status_seterrmsg(upb_status *status, const char *msg);
|
315
|
+
void upb_status_seterrf(upb_status *status, const char *fmt, ...)
|
316
|
+
UPB_PRINTF(2, 3);
|
317
|
+
void upb_status_vseterrf(upb_status *status, const char *fmt, va_list args)
|
318
|
+
UPB_PRINTF(2, 0);
|
319
|
+
void upb_status_vappenderrf(upb_status *status, const char *fmt, va_list args)
|
320
|
+
UPB_PRINTF(2, 0);
|
321
|
+
|
322
|
+
/** upb_strview ************************************************************/
|
323
|
+
|
324
|
+
typedef struct {
|
325
|
+
const char *data;
|
326
|
+
size_t size;
|
327
|
+
} upb_strview;
|
328
|
+
|
329
|
+
UPB_INLINE upb_strview upb_strview_make(const char *data, size_t size) {
|
330
|
+
upb_strview ret;
|
331
|
+
ret.data = data;
|
332
|
+
ret.size = size;
|
333
|
+
return ret;
|
334
|
+
}
|
335
|
+
|
336
|
+
UPB_INLINE upb_strview upb_strview_makez(const char *data) {
|
337
|
+
return upb_strview_make(data, strlen(data));
|
338
|
+
}
|
339
|
+
|
340
|
+
UPB_INLINE bool upb_strview_eql(upb_strview a, upb_strview b) {
|
341
|
+
return a.size == b.size && memcmp(a.data, b.data, a.size) == 0;
|
342
|
+
}
|
343
|
+
|
344
|
+
#define UPB_STRVIEW_INIT(ptr, len) {ptr, len}
|
345
|
+
|
346
|
+
#define UPB_STRVIEW_FORMAT "%.*s"
|
347
|
+
#define UPB_STRVIEW_ARGS(view) (int)(view).size, (view).data
|
348
|
+
|
349
|
+
/** upb_alloc *****************************************************************/
|
350
|
+
|
351
|
+
/* A upb_alloc is a possibly-stateful allocator object.
|
352
|
+
*
|
353
|
+
* It could either be an arena allocator (which doesn't require individual
|
354
|
+
* free() calls) or a regular malloc() (which does). The client must therefore
|
355
|
+
* free memory unless it knows that the allocator is an arena allocator. */
|
356
|
+
|
357
|
+
struct upb_alloc;
|
358
|
+
typedef struct upb_alloc upb_alloc;
|
359
|
+
|
360
|
+
/* A malloc()/free() function.
|
361
|
+
* If "size" is 0 then the function acts like free(), otherwise it acts like
|
362
|
+
* realloc(). Only "oldsize" bytes from a previous allocation are preserved. */
|
363
|
+
typedef void *upb_alloc_func(upb_alloc *alloc, void *ptr, size_t oldsize,
|
364
|
+
size_t size);
|
365
|
+
|
366
|
+
struct upb_alloc {
|
367
|
+
upb_alloc_func *func;
|
368
|
+
};
|
369
|
+
|
370
|
+
UPB_INLINE void *upb_malloc(upb_alloc *alloc, size_t size) {
|
371
|
+
UPB_ASSERT(alloc);
|
372
|
+
return alloc->func(alloc, NULL, 0, size);
|
373
|
+
}
|
374
|
+
|
375
|
+
UPB_INLINE void *upb_realloc(upb_alloc *alloc, void *ptr, size_t oldsize,
|
376
|
+
size_t size) {
|
377
|
+
UPB_ASSERT(alloc);
|
378
|
+
return alloc->func(alloc, ptr, oldsize, size);
|
379
|
+
}
|
380
|
+
|
381
|
+
UPB_INLINE void upb_free(upb_alloc *alloc, void *ptr) {
|
382
|
+
assert(alloc);
|
383
|
+
alloc->func(alloc, ptr, 0, 0);
|
384
|
+
}
|
385
|
+
|
386
|
+
/* The global allocator used by upb. Uses the standard malloc()/free(). */
|
387
|
+
|
388
|
+
extern upb_alloc upb_alloc_global;
|
389
|
+
|
390
|
+
/* Functions that hard-code the global malloc.
|
391
|
+
*
|
392
|
+
* We still get benefit because we can put custom logic into our global
|
393
|
+
* allocator, like injecting out-of-memory faults in debug/testing builds. */
|
394
|
+
|
395
|
+
UPB_INLINE void *upb_gmalloc(size_t size) {
|
396
|
+
return upb_malloc(&upb_alloc_global, size);
|
397
|
+
}
|
398
|
+
|
399
|
+
UPB_INLINE void *upb_grealloc(void *ptr, size_t oldsize, size_t size) {
|
400
|
+
return upb_realloc(&upb_alloc_global, ptr, oldsize, size);
|
401
|
+
}
|
402
|
+
|
403
|
+
UPB_INLINE void upb_gfree(void *ptr) {
|
404
|
+
upb_free(&upb_alloc_global, ptr);
|
405
|
+
}
|
406
|
+
|
407
|
+
/* upb_arena ******************************************************************/
|
408
|
+
|
409
|
+
/* upb_arena is a specific allocator implementation that uses arena allocation.
|
410
|
+
* The user provides an allocator that will be used to allocate the underlying
|
411
|
+
* arena blocks. Arenas by nature do not require the individual allocations
|
412
|
+
* to be freed. However the Arena does allow users to register cleanup
|
413
|
+
* functions that will run when the arena is destroyed.
|
414
|
+
*
|
415
|
+
* A upb_arena is *not* thread-safe.
|
416
|
+
*
|
417
|
+
* You could write a thread-safe arena allocator that satisfies the
|
418
|
+
* upb_alloc interface, but it would not be as efficient for the
|
419
|
+
* single-threaded case. */
|
420
|
+
|
421
|
+
typedef void upb_cleanup_func(void *ud);
|
422
|
+
|
423
|
+
struct upb_arena;
|
424
|
+
typedef struct upb_arena upb_arena;
|
425
|
+
|
426
|
+
typedef struct {
|
427
|
+
/* We implement the allocator interface.
|
428
|
+
* This must be the first member of upb_arena!
|
429
|
+
* TODO(haberman): remove once handlers are gone. */
|
430
|
+
upb_alloc alloc;
|
431
|
+
|
432
|
+
char *ptr, *end;
|
433
|
+
} _upb_arena_head;
|
434
|
+
|
435
|
+
/* Creates an arena from the given initial block (if any -- n may be 0).
|
436
|
+
* Additional blocks will be allocated from |alloc|. If |alloc| is NULL, this
|
437
|
+
* is a fixed-size arena and cannot grow. */
|
438
|
+
upb_arena *upb_arena_init(void *mem, size_t n, upb_alloc *alloc);
|
439
|
+
void upb_arena_free(upb_arena *a);
|
440
|
+
bool upb_arena_addcleanup(upb_arena *a, void *ud, upb_cleanup_func *func);
|
441
|
+
bool upb_arena_fuse(upb_arena *a, upb_arena *b);
|
442
|
+
void *_upb_arena_slowmalloc(upb_arena *a, size_t size);
|
443
|
+
|
444
|
+
UPB_INLINE upb_alloc *upb_arena_alloc(upb_arena *a) { return (upb_alloc*)a; }
|
445
|
+
|
446
|
+
UPB_INLINE size_t _upb_arenahas(upb_arena *a) {
|
447
|
+
_upb_arena_head *h = (_upb_arena_head*)a;
|
448
|
+
return (size_t)(h->end - h->ptr);
|
449
|
+
}
|
450
|
+
|
451
|
+
UPB_INLINE void *upb_arena_malloc(upb_arena *a, size_t size) {
|
452
|
+
_upb_arena_head *h = (_upb_arena_head*)a;
|
453
|
+
void* ret;
|
454
|
+
size = UPB_ALIGN_MALLOC(size);
|
455
|
+
|
456
|
+
if (UPB_UNLIKELY(_upb_arenahas(a) < size)) {
|
457
|
+
return _upb_arena_slowmalloc(a, size);
|
458
|
+
}
|
459
|
+
|
460
|
+
ret = h->ptr;
|
461
|
+
h->ptr += size;
|
462
|
+
UPB_UNPOISON_MEMORY_REGION(ret, size);
|
463
|
+
|
464
|
+
#if UPB_ASAN
|
465
|
+
{
|
466
|
+
size_t guard_size = 32;
|
467
|
+
if (_upb_arenahas(a) >= guard_size) {
|
468
|
+
h->ptr += guard_size;
|
469
|
+
} else {
|
470
|
+
h->ptr = h->end;
|
471
|
+
}
|
472
|
+
}
|
473
|
+
#endif
|
474
|
+
|
475
|
+
return ret;
|
476
|
+
}
|
477
|
+
|
478
|
+
UPB_INLINE void *upb_arena_realloc(upb_arena *a, void *ptr, size_t oldsize,
|
479
|
+
size_t size) {
|
480
|
+
void *ret = upb_arena_malloc(a, size);
|
481
|
+
|
482
|
+
if (ret && oldsize > 0) {
|
483
|
+
memcpy(ret, ptr, oldsize);
|
484
|
+
}
|
485
|
+
|
486
|
+
return ret;
|
487
|
+
}
|
488
|
+
|
489
|
+
UPB_INLINE upb_arena *upb_arena_new(void) {
|
490
|
+
return upb_arena_init(NULL, 0, &upb_alloc_global);
|
491
|
+
}
|
492
|
+
|
493
|
+
/* Constants ******************************************************************/
|
494
|
+
|
495
|
+
/* Generic function type. */
|
496
|
+
typedef void upb_func(void);
|
497
|
+
|
498
|
+
/* A list of types as they are encoded on-the-wire. */
|
499
|
+
typedef enum {
|
500
|
+
UPB_WIRE_TYPE_VARINT = 0,
|
501
|
+
UPB_WIRE_TYPE_64BIT = 1,
|
502
|
+
UPB_WIRE_TYPE_DELIMITED = 2,
|
503
|
+
UPB_WIRE_TYPE_START_GROUP = 3,
|
504
|
+
UPB_WIRE_TYPE_END_GROUP = 4,
|
505
|
+
UPB_WIRE_TYPE_32BIT = 5
|
506
|
+
} upb_wiretype_t;
|
507
|
+
|
508
|
+
/* The types a field can have. Note that this list is not identical to the
|
509
|
+
* types defined in descriptor.proto, which gives INT32 and SINT32 separate
|
510
|
+
* types (we distinguish the two with the "integer encoding" enum below). */
|
511
|
+
typedef enum {
|
512
|
+
UPB_TYPE_BOOL = 1,
|
513
|
+
UPB_TYPE_FLOAT = 2,
|
514
|
+
UPB_TYPE_INT32 = 3,
|
515
|
+
UPB_TYPE_UINT32 = 4,
|
516
|
+
UPB_TYPE_ENUM = 5, /* Enum values are int32. */
|
517
|
+
UPB_TYPE_MESSAGE = 6,
|
518
|
+
UPB_TYPE_DOUBLE = 7,
|
519
|
+
UPB_TYPE_INT64 = 8,
|
520
|
+
UPB_TYPE_UINT64 = 9,
|
521
|
+
UPB_TYPE_STRING = 10,
|
522
|
+
UPB_TYPE_BYTES = 11
|
523
|
+
} upb_fieldtype_t;
|
524
|
+
|
525
|
+
/* The repeated-ness of each field; this matches descriptor.proto. */
|
526
|
+
typedef enum {
|
527
|
+
UPB_LABEL_OPTIONAL = 1,
|
528
|
+
UPB_LABEL_REQUIRED = 2,
|
529
|
+
UPB_LABEL_REPEATED = 3
|
530
|
+
} upb_label_t;
|
531
|
+
|
532
|
+
/* Descriptor types, as defined in descriptor.proto. */
|
533
|
+
typedef enum {
|
534
|
+
/* Old (long) names. TODO(haberman): remove */
|
535
|
+
UPB_DESCRIPTOR_TYPE_DOUBLE = 1,
|
536
|
+
UPB_DESCRIPTOR_TYPE_FLOAT = 2,
|
537
|
+
UPB_DESCRIPTOR_TYPE_INT64 = 3,
|
538
|
+
UPB_DESCRIPTOR_TYPE_UINT64 = 4,
|
539
|
+
UPB_DESCRIPTOR_TYPE_INT32 = 5,
|
540
|
+
UPB_DESCRIPTOR_TYPE_FIXED64 = 6,
|
541
|
+
UPB_DESCRIPTOR_TYPE_FIXED32 = 7,
|
542
|
+
UPB_DESCRIPTOR_TYPE_BOOL = 8,
|
543
|
+
UPB_DESCRIPTOR_TYPE_STRING = 9,
|
544
|
+
UPB_DESCRIPTOR_TYPE_GROUP = 10,
|
545
|
+
UPB_DESCRIPTOR_TYPE_MESSAGE = 11,
|
546
|
+
UPB_DESCRIPTOR_TYPE_BYTES = 12,
|
547
|
+
UPB_DESCRIPTOR_TYPE_UINT32 = 13,
|
548
|
+
UPB_DESCRIPTOR_TYPE_ENUM = 14,
|
549
|
+
UPB_DESCRIPTOR_TYPE_SFIXED32 = 15,
|
550
|
+
UPB_DESCRIPTOR_TYPE_SFIXED64 = 16,
|
551
|
+
UPB_DESCRIPTOR_TYPE_SINT32 = 17,
|
552
|
+
UPB_DESCRIPTOR_TYPE_SINT64 = 18,
|
553
|
+
|
554
|
+
UPB_DTYPE_DOUBLE = 1,
|
555
|
+
UPB_DTYPE_FLOAT = 2,
|
556
|
+
UPB_DTYPE_INT64 = 3,
|
557
|
+
UPB_DTYPE_UINT64 = 4,
|
558
|
+
UPB_DTYPE_INT32 = 5,
|
559
|
+
UPB_DTYPE_FIXED64 = 6,
|
560
|
+
UPB_DTYPE_FIXED32 = 7,
|
561
|
+
UPB_DTYPE_BOOL = 8,
|
562
|
+
UPB_DTYPE_STRING = 9,
|
563
|
+
UPB_DTYPE_GROUP = 10,
|
564
|
+
UPB_DTYPE_MESSAGE = 11,
|
565
|
+
UPB_DTYPE_BYTES = 12,
|
566
|
+
UPB_DTYPE_UINT32 = 13,
|
567
|
+
UPB_DTYPE_ENUM = 14,
|
568
|
+
UPB_DTYPE_SFIXED32 = 15,
|
569
|
+
UPB_DTYPE_SFIXED64 = 16,
|
570
|
+
UPB_DTYPE_SINT32 = 17,
|
571
|
+
UPB_DTYPE_SINT64 = 18
|
572
|
+
} upb_descriptortype_t;
|
573
|
+
|
574
|
+
#define UPB_MAP_BEGIN ((size_t)-1)
|
575
|
+
|
576
|
+
UPB_INLINE bool _upb_isle(void) {
|
577
|
+
int x = 1;
|
578
|
+
return *(char*)&x == 1;
|
579
|
+
}
|
580
|
+
|
581
|
+
UPB_INLINE uint32_t _upb_be_swap32(uint32_t val) {
|
582
|
+
if (_upb_isle()) {
|
583
|
+
return val;
|
584
|
+
} else {
|
585
|
+
return ((val & 0xff) << 24) | ((val & 0xff00) << 8) |
|
586
|
+
((val & 0xff0000) >> 8) | ((val & 0xff000000) >> 24);
|
587
|
+
}
|
588
|
+
}
|
589
|
+
|
590
|
+
UPB_INLINE uint64_t _upb_be_swap64(uint64_t val) {
|
591
|
+
if (_upb_isle()) {
|
592
|
+
return val;
|
593
|
+
} else {
|
594
|
+
return ((uint64_t)_upb_be_swap32(val) << 32) | _upb_be_swap32(val >> 32);
|
595
|
+
}
|
596
|
+
}
|
597
|
+
|
598
|
+
UPB_INLINE int _upb_lg2ceil(int x) {
|
599
|
+
if (x <= 1) return 0;
|
600
|
+
#ifdef __GNUC__
|
601
|
+
return 32 - __builtin_clz(x - 1);
|
602
|
+
#else
|
603
|
+
int lg2 = 0;
|
604
|
+
while (1 << lg2 < x) lg2++;
|
605
|
+
return lg2;
|
606
|
+
#endif
|
607
|
+
}
|
608
|
+
|
609
|
+
UPB_INLINE int _upb_lg2ceilsize(int x) {
|
610
|
+
return 1 << _upb_lg2ceil(x);
|
611
|
+
}
|
612
|
+
|
613
|
+
|
614
|
+
#ifdef __cplusplus
|
615
|
+
} /* extern "C" */
|
616
|
+
#endif
|
617
|
+
|
618
|
+
#endif /* UPB_H_ */
|
619
|
+
|
620
|
+
#ifdef __cplusplus
|
621
|
+
extern "C" {
|
622
|
+
#endif
|
623
|
+
|
624
|
+
typedef void upb_msg;
|
625
|
+
|
626
|
+
/* For users these are opaque. They can be obtained from upb_msgdef_layout()
|
627
|
+
* but users cannot access any of the members. */
|
628
|
+
struct upb_msglayout;
|
629
|
+
typedef struct upb_msglayout upb_msglayout;
|
630
|
+
|
631
|
+
/* Adds unknown data (serialized protobuf data) to the given message. The data
|
632
|
+
* is copied into the message instance. */
|
633
|
+
void upb_msg_addunknown(upb_msg *msg, const char *data, size_t len,
|
634
|
+
upb_arena *arena);
|
635
|
+
|
636
|
+
/* Returns a reference to the message's unknown data. */
|
637
|
+
const char *upb_msg_getunknown(const upb_msg *msg, size_t *len);
|
638
|
+
|
639
|
+
/** upb_extreg *******************************************************************/
|
640
|
+
|
641
|
+
/* Extension registry: a dynamic data structure that stores a map of:
|
642
|
+
* (upb_msglayout, number) -> extension info
|
643
|
+
*
|
644
|
+
* upb_decode() uses upb_extreg to look up extensions while parsing binary
|
645
|
+
* format.
|
646
|
+
*
|
647
|
+
* upb_extreg is part of the mini-table (msglayout) family of objects. Like all
|
648
|
+
* mini-table objects, it is suitable for reflection-less builds that do not
|
649
|
+
* want to expose names into the binary.
|
650
|
+
*
|
651
|
+
* Unlike most mini-table types, upb_extreg requires dynamic memory allocation
|
652
|
+
* and dynamic initialization:
|
653
|
+
* * If reflection is being used, then upb_symtab will construct an appropriate
|
654
|
+
* upb_extreg automatically.
|
655
|
+
* * For a mini-table only build, the user must manually construct the
|
656
|
+
* upb_extreg and populate it with all of the extensions the user cares about.
|
657
|
+
* * A third alternative is to manually unpack relevant extensions after the
|
658
|
+
* main parse is complete, similar to how Any works. This is perhaps the
|
659
|
+
* nicest solution from the perspective of reducing dependencies, avoiding
|
660
|
+
* dynamic memory allocation, and avoiding the need to parse uninteresting
|
661
|
+
* extensions. The downsides are:
|
662
|
+
* (1) parse errors are not caught during the main parse
|
663
|
+
* (2) the CPU hit of parsing comes during access, which could cause an
|
664
|
+
* undesirable stutter in application performance.
|
665
|
+
*
|
666
|
+
* Users cannot directly get or put into this map. Users can only add the
|
667
|
+
* extensions from a generated module and pass the extension registry to the
|
668
|
+
* binary decoder.
|
669
|
+
*
|
670
|
+
* A upb_symtab provides a upb_extreg, so any users who use reflection do not
|
671
|
+
* need to populate a upb_extreg directly.
|
672
|
+
*/
|
673
|
+
|
674
|
+
struct upb_extreg;
|
675
|
+
typedef struct upb_extreg upb_extreg;
|
676
|
+
|
677
|
+
/* Creates a upb_extreg in the given arena. The arena must outlive any use of
|
678
|
+
* the extreg. */
|
679
|
+
upb_extreg *upb_extreg_new(upb_arena *arena);
|
680
|
+
|
681
|
+
#ifdef __cplusplus
|
682
|
+
} /* extern "C" */
|
683
|
+
#endif
|
684
|
+
|
685
|
+
#endif /* UPB_MSG_INT_H_ */
|
686
|
+
|
687
|
+
/* Must be last. */
|
688
|
+
|
689
|
+
#ifdef __cplusplus
|
690
|
+
extern "C" {
|
691
|
+
#endif
|
692
|
+
|
693
|
+
enum {
|
694
|
+
/* If set, strings will alias the input buffer instead of copying into the
|
695
|
+
* arena. */
|
696
|
+
UPB_DECODE_ALIAS = 1,
|
697
|
+
};
|
698
|
+
|
699
|
+
#define UPB_DECODE_MAXDEPTH(depth) ((depth) << 16)
|
700
|
+
|
701
|
+
bool _upb_decode(const char *buf, size_t size, upb_msg *msg,
|
702
|
+
const upb_msglayout *l, const upb_extreg *extreg, int options,
|
703
|
+
upb_arena *arena);
|
704
|
+
|
705
|
+
UPB_INLINE
|
706
|
+
bool upb_decode(const char *buf, size_t size, upb_msg *msg,
|
707
|
+
const upb_msglayout *l, upb_arena *arena) {
|
708
|
+
return _upb_decode(buf, size, msg, l, NULL, 0, arena);
|
709
|
+
}
|
710
|
+
|
711
|
+
#ifdef __cplusplus
|
712
|
+
} /* extern "C" */
|
713
|
+
#endif
|
714
|
+
|
715
|
+
|
716
|
+
#endif /* UPB_DECODE_H_ */
|
717
|
+
|
718
|
+
/** upb/decode_internal.h ************************************************************/
|
719
|
+
/*
|
720
|
+
* Internal implementation details of the decoder that are shared between
|
721
|
+
* decode.c and decode_fast.c.
|
722
|
+
*/
|
723
|
+
|
724
|
+
#ifndef UPB_DECODE_INT_H_
|
725
|
+
#define UPB_DECODE_INT_H_
|
726
|
+
|
727
|
+
#include <setjmp.h>
|
728
|
+
|
729
|
+
|
730
|
+
/** upb/msg_internal.h ************************************************************//*
|
731
|
+
** Our memory representation for parsing tables and messages themselves.
|
732
|
+
** Functions in this file are used by generated code and possibly reflection.
|
733
|
+
**
|
734
|
+
** The definitions in this file are internal to upb.
|
735
|
+
**/
|
736
|
+
|
737
|
+
#ifndef UPB_MSG_INT_H_
|
738
|
+
#define UPB_MSG_INT_H_
|
739
|
+
|
740
|
+
#include <stdint.h>
|
741
|
+
#include <stdlib.h>
|
742
|
+
#include <string.h>
|
743
|
+
|
744
|
+
|
745
|
+
/** upb/table_internal.h ************************************************************/
|
746
|
+
/*
|
747
|
+
* upb_table
|
748
|
+
*
|
749
|
+
* This header is INTERNAL-ONLY! Its interfaces are not public or stable!
|
750
|
+
* This file defines very fast int->upb_value (inttable) and string->upb_value
|
751
|
+
* (strtable) hash tables.
|
752
|
+
*
|
753
|
+
* The table uses chained scatter with Brent's variation (inspired by the Lua
|
754
|
+
* implementation of hash tables). The hash function for strings is Austin
|
755
|
+
* Appleby's "MurmurHash."
|
756
|
+
*
|
757
|
+
* The inttable uses uintptr_t as its key, which guarantees it can be used to
|
758
|
+
* store pointers or integers of at least 32 bits (upb isn't really useful on
|
759
|
+
* systems where sizeof(void*) < 4).
|
760
|
+
*
|
761
|
+
* The table must be homogeneous (all values of the same type). In debug
|
762
|
+
* mode, we check this on insert and lookup.
|
763
|
+
*/
|
764
|
+
|
765
|
+
#ifndef UPB_TABLE_H_
|
766
|
+
#define UPB_TABLE_H_
|
767
|
+
|
768
|
+
#include <stdint.h>
|
769
|
+
#include <string.h>
|
770
|
+
|
771
|
+
|
772
|
+
#ifdef __cplusplus
|
773
|
+
extern "C" {
|
774
|
+
#endif
|
775
|
+
|
776
|
+
|
777
|
+
/* upb_value ******************************************************************/
|
778
|
+
|
779
|
+
typedef struct {
|
780
|
+
uint64_t val;
|
781
|
+
} upb_value;
|
782
|
+
|
783
|
+
/* Variant that works with a length-delimited rather than NULL-delimited string,
|
784
|
+
* as supported by strtable. */
|
785
|
+
char *upb_strdup2(const char *s, size_t len, upb_arena *a);
|
786
|
+
|
787
|
+
UPB_INLINE void _upb_value_setval(upb_value *v, uint64_t val) {
|
788
|
+
v->val = val;
|
789
|
+
}
|
790
|
+
|
791
|
+
/* For each value ctype, define the following set of functions:
|
792
|
+
*
|
793
|
+
* // Get/set an int32 from a upb_value.
|
794
|
+
* int32_t upb_value_getint32(upb_value val);
|
795
|
+
* void upb_value_setint32(upb_value *val, int32_t cval);
|
796
|
+
*
|
797
|
+
* // Construct a new upb_value from an int32.
|
798
|
+
* upb_value upb_value_int32(int32_t val); */
|
799
|
+
#define FUNCS(name, membername, type_t, converter, proto_type) \
|
800
|
+
UPB_INLINE void upb_value_set ## name(upb_value *val, type_t cval) { \
|
801
|
+
val->val = (converter)cval; \
|
802
|
+
} \
|
803
|
+
UPB_INLINE upb_value upb_value_ ## name(type_t val) { \
|
804
|
+
upb_value ret; \
|
805
|
+
upb_value_set ## name(&ret, val); \
|
806
|
+
return ret; \
|
807
|
+
} \
|
808
|
+
UPB_INLINE type_t upb_value_get ## name(upb_value val) { \
|
809
|
+
return (type_t)(converter)val.val; \
|
810
|
+
}
|
811
|
+
|
812
|
+
FUNCS(int32, int32, int32_t, int32_t, UPB_CTYPE_INT32)
|
813
|
+
FUNCS(int64, int64, int64_t, int64_t, UPB_CTYPE_INT64)
|
814
|
+
FUNCS(uint32, uint32, uint32_t, uint32_t, UPB_CTYPE_UINT32)
|
815
|
+
FUNCS(uint64, uint64, uint64_t, uint64_t, UPB_CTYPE_UINT64)
|
816
|
+
FUNCS(bool, _bool, bool, bool, UPB_CTYPE_BOOL)
|
817
|
+
FUNCS(cstr, cstr, char*, uintptr_t, UPB_CTYPE_CSTR)
|
818
|
+
FUNCS(ptr, ptr, void*, uintptr_t, UPB_CTYPE_PTR)
|
819
|
+
FUNCS(constptr, constptr, const void*, uintptr_t, UPB_CTYPE_CONSTPTR)
|
820
|
+
FUNCS(fptr, fptr, upb_func*, uintptr_t, UPB_CTYPE_FPTR)
|
821
|
+
|
822
|
+
#undef FUNCS
|
823
|
+
|
824
|
+
UPB_INLINE void upb_value_setfloat(upb_value *val, float cval) {
|
825
|
+
memcpy(&val->val, &cval, sizeof(cval));
|
826
|
+
}
|
827
|
+
|
828
|
+
UPB_INLINE void upb_value_setdouble(upb_value *val, double cval) {
|
829
|
+
memcpy(&val->val, &cval, sizeof(cval));
|
830
|
+
}
|
831
|
+
|
832
|
+
UPB_INLINE upb_value upb_value_float(float cval) {
|
833
|
+
upb_value ret;
|
834
|
+
upb_value_setfloat(&ret, cval);
|
835
|
+
return ret;
|
836
|
+
}
|
837
|
+
|
838
|
+
UPB_INLINE upb_value upb_value_double(double cval) {
|
839
|
+
upb_value ret;
|
840
|
+
upb_value_setdouble(&ret, cval);
|
841
|
+
return ret;
|
842
|
+
}
|
843
|
+
|
844
|
+
#undef SET_TYPE
|
845
|
+
|
846
|
+
|
847
|
+
/* upb_tabkey *****************************************************************/
|
848
|
+
|
849
|
+
/* Either:
|
850
|
+
* 1. an actual integer key, or
|
851
|
+
* 2. a pointer to a string prefixed by its uint32_t length, owned by us.
|
852
|
+
*
|
853
|
+
* ...depending on whether this is a string table or an int table. We would
|
854
|
+
* make this a union of those two types, but C89 doesn't support statically
|
855
|
+
* initializing a non-first union member. */
|
856
|
+
typedef uintptr_t upb_tabkey;
|
857
|
+
|
858
|
+
UPB_INLINE char *upb_tabstr(upb_tabkey key, uint32_t *len) {
|
859
|
+
char* mem = (char*)key;
|
860
|
+
if (len) memcpy(len, mem, sizeof(*len));
|
861
|
+
return mem + sizeof(*len);
|
862
|
+
}
|
863
|
+
|
864
|
+
UPB_INLINE upb_strview upb_tabstrview(upb_tabkey key) {
|
865
|
+
upb_strview ret;
|
866
|
+
uint32_t len;
|
867
|
+
ret.data = upb_tabstr(key, &len);
|
868
|
+
ret.size = len;
|
869
|
+
return ret;
|
870
|
+
}
|
871
|
+
|
872
|
+
/* upb_tabval *****************************************************************/
|
873
|
+
|
874
|
+
typedef struct upb_tabval {
|
875
|
+
uint64_t val;
|
876
|
+
} upb_tabval;
|
877
|
+
|
878
|
+
#define UPB_TABVALUE_EMPTY_INIT {-1}
|
879
|
+
|
880
|
+
/* upb_table ******************************************************************/
|
881
|
+
|
882
|
+
uint64_t Wyhash(const void *data, size_t len, uint64_t seed,
|
883
|
+
const uint64_t salt[]);
|
884
|
+
extern const uint64_t kWyhashSalt[5];
|
885
|
+
|
886
|
+
typedef struct _upb_tabent {
|
887
|
+
upb_tabkey key;
|
888
|
+
upb_tabval val;
|
889
|
+
|
890
|
+
/* Internal chaining. This is const so we can create static initializers for
|
891
|
+
* tables. We cast away const sometimes, but *only* when the containing
|
892
|
+
* upb_table is known to be non-const. This requires a bit of care, but
|
893
|
+
* the subtlety is confined to table.c. */
|
894
|
+
const struct _upb_tabent *next;
|
895
|
+
} upb_tabent;
|
896
|
+
|
897
|
+
typedef struct {
|
898
|
+
size_t count; /* Number of entries in the hash part. */
|
899
|
+
uint32_t mask; /* Mask to turn hash value -> bucket. */
|
900
|
+
uint32_t max_count; /* Max count before we hit our load limit. */
|
901
|
+
uint8_t size_lg2; /* Size of the hashtable part is 2^size_lg2 entries. */
|
902
|
+
upb_tabent *entries;
|
903
|
+
} upb_table;
|
904
|
+
|
905
|
+
typedef struct {
|
906
|
+
upb_table t;
|
907
|
+
} upb_strtable;
|
908
|
+
|
909
|
+
typedef struct {
|
910
|
+
upb_table t; /* For entries that don't fit in the array part. */
|
911
|
+
const upb_tabval *array; /* Array part of the table. See const note above. */
|
912
|
+
size_t array_size; /* Array part size. */
|
913
|
+
size_t array_count; /* Array part number of elements. */
|
914
|
+
} upb_inttable;
|
915
|
+
|
916
|
+
UPB_INLINE size_t upb_table_size(const upb_table *t) {
|
917
|
+
if (t->size_lg2 == 0)
|
918
|
+
return 0;
|
919
|
+
else
|
920
|
+
return 1 << t->size_lg2;
|
921
|
+
}
|
922
|
+
|
923
|
+
/* Internal-only functions, in .h file only out of necessity. */
|
924
|
+
UPB_INLINE bool upb_tabent_isempty(const upb_tabent *e) {
|
925
|
+
return e->key == 0;
|
926
|
+
}
|
927
|
+
|
928
|
+
/* Initialize and uninitialize a table, respectively. If memory allocation
|
929
|
+
* failed, false is returned that the table is uninitialized. */
|
930
|
+
bool upb_inttable_init(upb_inttable *table, upb_arena *a);
|
931
|
+
bool upb_strtable_init(upb_strtable *table, size_t expected_size, upb_arena *a);
|
932
|
+
|
933
|
+
/* Returns the number of values in the table. */
|
934
|
+
size_t upb_inttable_count(const upb_inttable *t);
|
935
|
+
UPB_INLINE size_t upb_strtable_count(const upb_strtable *t) {
|
936
|
+
return t->t.count;
|
937
|
+
}
|
938
|
+
|
939
|
+
void upb_strtable_clear(upb_strtable *t);
|
940
|
+
|
941
|
+
/* Inserts the given key into the hashtable with the given value. The key must
|
942
|
+
* not already exist in the hash table. For string tables, the key must be
|
943
|
+
* NULL-terminated, and the table will make an internal copy of the key.
|
944
|
+
* Inttables must not insert a value of UINTPTR_MAX.
|
945
|
+
*
|
946
|
+
* If a table resize was required but memory allocation failed, false is
|
947
|
+
* returned and the table is unchanged. */
|
948
|
+
bool upb_inttable_insert(upb_inttable *t, uintptr_t key, upb_value val,
|
949
|
+
upb_arena *a);
|
950
|
+
bool upb_strtable_insert(upb_strtable *t, const char *key, size_t len,
|
951
|
+
upb_value val, upb_arena *a);
|
952
|
+
|
953
|
+
/* Looks up key in this table, returning "true" if the key was found.
|
954
|
+
* If v is non-NULL, copies the value for this key into *v. */
|
955
|
+
bool upb_inttable_lookup(const upb_inttable *t, uintptr_t key, upb_value *v);
|
956
|
+
bool upb_strtable_lookup2(const upb_strtable *t, const char *key, size_t len,
|
957
|
+
upb_value *v);
|
958
|
+
|
959
|
+
/* For NULL-terminated strings. */
|
960
|
+
UPB_INLINE bool upb_strtable_lookup(const upb_strtable *t, const char *key,
|
961
|
+
upb_value *v) {
|
962
|
+
return upb_strtable_lookup2(t, key, strlen(key), v);
|
963
|
+
}
|
964
|
+
|
965
|
+
/* Removes an item from the table. Returns true if the remove was successful,
|
966
|
+
* and stores the removed item in *val if non-NULL. */
|
967
|
+
bool upb_inttable_remove(upb_inttable *t, uintptr_t key, upb_value *val);
|
968
|
+
bool upb_strtable_remove(upb_strtable *t, const char *key, size_t len,
|
969
|
+
upb_value *val);
|
970
|
+
|
971
|
+
/* Updates an existing entry in an inttable. If the entry does not exist,
|
972
|
+
* returns false and does nothing. Unlike insert/remove, this does not
|
973
|
+
* invalidate iterators. */
|
974
|
+
bool upb_inttable_replace(upb_inttable *t, uintptr_t key, upb_value val);
|
975
|
+
|
976
|
+
/* Optimizes the table for the current set of entries, for both memory use and
|
977
|
+
* lookup time. Client should call this after all entries have been inserted;
|
978
|
+
* inserting more entries is legal, but will likely require a table resize. */
|
979
|
+
void upb_inttable_compact(upb_inttable *t, upb_arena *a);
|
980
|
+
|
981
|
+
/* Exposed for testing only. */
|
982
|
+
bool upb_strtable_resize(upb_strtable *t, size_t size_lg2, upb_arena *a);
|
983
|
+
|
984
|
+
/* Iterators ******************************************************************/
|
985
|
+
|
986
|
+
/* Iterators for int and string tables. We are subject to some kind of unusual
|
987
|
+
* design constraints:
|
988
|
+
*
|
989
|
+
* For high-level languages:
|
990
|
+
* - we must be able to guarantee that we don't crash or corrupt memory even if
|
991
|
+
* the program accesses an invalidated iterator.
|
992
|
+
*
|
993
|
+
* For C++11 range-based for:
|
994
|
+
* - iterators must be copyable
|
995
|
+
* - iterators must be comparable
|
996
|
+
* - it must be possible to construct an "end" value.
|
997
|
+
*
|
998
|
+
* Iteration order is undefined.
|
999
|
+
*
|
1000
|
+
* Modifying the table invalidates iterators. upb_{str,int}table_done() is
|
1001
|
+
* guaranteed to work even on an invalidated iterator, as long as the table it
|
1002
|
+
* is iterating over has not been freed. Calling next() or accessing data from
|
1003
|
+
* an invalidated iterator yields unspecified elements from the table, but it is
|
1004
|
+
* guaranteed not to crash and to return real table elements (except when done()
|
1005
|
+
* is true). */
|
1006
|
+
|
1007
|
+
|
1008
|
+
/* upb_strtable_iter **********************************************************/
|
1009
|
+
|
1010
|
+
/* upb_strtable_iter i;
|
1011
|
+
* upb_strtable_begin(&i, t);
|
1012
|
+
* for(; !upb_strtable_done(&i); upb_strtable_next(&i)) {
|
1013
|
+
* const char *key = upb_strtable_iter_key(&i);
|
1014
|
+
* const upb_value val = upb_strtable_iter_value(&i);
|
1015
|
+
* // ...
|
1016
|
+
* }
|
1017
|
+
*/
|
1018
|
+
|
1019
|
+
typedef struct {
|
1020
|
+
const upb_strtable *t;
|
1021
|
+
size_t index;
|
1022
|
+
} upb_strtable_iter;
|
1023
|
+
|
1024
|
+
void upb_strtable_begin(upb_strtable_iter *i, const upb_strtable *t);
|
1025
|
+
void upb_strtable_next(upb_strtable_iter *i);
|
1026
|
+
bool upb_strtable_done(const upb_strtable_iter *i);
|
1027
|
+
upb_strview upb_strtable_iter_key(const upb_strtable_iter *i);
|
1028
|
+
upb_value upb_strtable_iter_value(const upb_strtable_iter *i);
|
1029
|
+
void upb_strtable_iter_setdone(upb_strtable_iter *i);
|
1030
|
+
bool upb_strtable_iter_isequal(const upb_strtable_iter *i1,
|
1031
|
+
const upb_strtable_iter *i2);
|
1032
|
+
|
1033
|
+
|
1034
|
+
/* upb_inttable_iter **********************************************************/
|
1035
|
+
|
1036
|
+
/* upb_inttable_iter i;
|
1037
|
+
* upb_inttable_begin(&i, t);
|
1038
|
+
* for(; !upb_inttable_done(&i); upb_inttable_next(&i)) {
|
1039
|
+
* uintptr_t key = upb_inttable_iter_key(&i);
|
1040
|
+
* upb_value val = upb_inttable_iter_value(&i);
|
1041
|
+
* // ...
|
1042
|
+
* }
|
1043
|
+
*/
|
1044
|
+
|
1045
|
+
typedef struct {
|
1046
|
+
const upb_inttable *t;
|
1047
|
+
size_t index;
|
1048
|
+
bool array_part;
|
1049
|
+
} upb_inttable_iter;
|
1050
|
+
|
1051
|
+
UPB_INLINE const upb_tabent *str_tabent(const upb_strtable_iter *i) {
|
1052
|
+
return &i->t->t.entries[i->index];
|
1053
|
+
}
|
1054
|
+
|
1055
|
+
void upb_inttable_begin(upb_inttable_iter *i, const upb_inttable *t);
|
1056
|
+
void upb_inttable_next(upb_inttable_iter *i);
|
1057
|
+
bool upb_inttable_done(const upb_inttable_iter *i);
|
1058
|
+
uintptr_t upb_inttable_iter_key(const upb_inttable_iter *i);
|
1059
|
+
upb_value upb_inttable_iter_value(const upb_inttable_iter *i);
|
1060
|
+
void upb_inttable_iter_setdone(upb_inttable_iter *i);
|
1061
|
+
bool upb_inttable_iter_isequal(const upb_inttable_iter *i1,
|
1062
|
+
const upb_inttable_iter *i2);
|
1063
|
+
|
1064
|
+
|
1065
|
+
#ifdef __cplusplus
|
1066
|
+
} /* extern "C" */
|
1067
|
+
#endif
|
1068
|
+
|
1069
|
+
|
1070
|
+
#endif /* UPB_TABLE_H_ */
|
1071
|
+
|
1072
|
+
/* Must be last. */
|
1073
|
+
|
1074
|
+
#ifdef __cplusplus
|
1075
|
+
extern "C" {
|
1076
|
+
#endif
|
1077
|
+
|
1078
|
+
/** upb_msglayout *************************************************************/
|
1079
|
+
|
1080
|
+
/* upb_msglayout represents the memory layout of a given upb_msgdef. The
|
1081
|
+
* members are public so generated code can initialize them, but users MUST NOT
|
1082
|
+
* read or write any of its members. */
|
1083
|
+
|
1084
|
+
/* These aren't real labels according to descriptor.proto, but in the table we
|
1085
|
+
* use these for map/packed fields instead of UPB_LABEL_REPEATED. */
|
1086
|
+
enum {
|
1087
|
+
_UPB_LABEL_MAP = 4,
|
1088
|
+
_UPB_LABEL_PACKED = 7 /* Low 3 bits are common with UPB_LABEL_REPEATED. */
|
1089
|
+
};
|
1090
|
+
|
1091
|
+
typedef struct {
|
1092
|
+
uint32_t number;
|
1093
|
+
uint16_t offset;
|
1094
|
+
int16_t presence; /* If >0, hasbit_index. If <0, ~oneof_index. */
|
1095
|
+
uint16_t submsg_index; /* undefined if descriptortype != MESSAGE or GROUP. */
|
1096
|
+
uint8_t descriptortype;
|
1097
|
+
int8_t mode; /* upb_fieldmode, with flags from upb_labelflags */
|
1098
|
+
} upb_msglayout_field;
|
1099
|
+
|
1100
|
+
typedef enum {
|
1101
|
+
_UPB_MODE_MAP = 0,
|
1102
|
+
_UPB_MODE_ARRAY = 1,
|
1103
|
+
_UPB_MODE_SCALAR = 2,
|
1104
|
+
} upb_fieldmode;
|
1105
|
+
|
1106
|
+
/* Extra flags on the mode field. */
|
1107
|
+
enum upb_labelflags {
|
1108
|
+
_UPB_MODE_IS_PACKED = 4,
|
1109
|
+
};
|
1110
|
+
|
1111
|
+
UPB_INLINE upb_fieldmode _upb_getmode(const upb_msglayout_field *field) {
|
1112
|
+
return (upb_fieldmode)(field->mode & 3);
|
1113
|
+
}
|
1114
|
+
|
1115
|
+
UPB_INLINE bool _upb_repeated_or_map(const upb_msglayout_field *field) {
|
1116
|
+
/* This works because upb_fieldmode has no value 3. */
|
1117
|
+
return !(field->mode & _UPB_MODE_SCALAR);
|
1118
|
+
}
|
1119
|
+
|
1120
|
+
UPB_INLINE bool _upb_issubmsg(const upb_msglayout_field *field) {
|
1121
|
+
return field->descriptortype == UPB_DTYPE_MESSAGE ||
|
1122
|
+
field->descriptortype == UPB_DTYPE_GROUP;
|
1123
|
+
}
|
1124
|
+
|
1125
|
+
struct upb_decstate;
|
1126
|
+
struct upb_msglayout;
|
1127
|
+
|
1128
|
+
typedef const char *_upb_field_parser(struct upb_decstate *d, const char *ptr,
|
1129
|
+
upb_msg *msg, intptr_t table,
|
1130
|
+
uint64_t hasbits, uint64_t data);
|
1131
|
+
|
1132
|
+
typedef struct {
|
1133
|
+
uint64_t field_data;
|
1134
|
+
_upb_field_parser *field_parser;
|
1135
|
+
} _upb_fasttable_entry;
|
1136
|
+
|
1137
|
+
struct upb_msglayout {
|
1138
|
+
const struct upb_msglayout *const* submsgs;
|
1139
|
+
const upb_msglayout_field *fields;
|
1140
|
+
/* Must be aligned to sizeof(void*). Doesn't include internal members like
|
1141
|
+
* unknown fields, extension dict, pointer to msglayout, etc. */
|
1142
|
+
uint16_t size;
|
1143
|
+
uint16_t field_count;
|
1144
|
+
bool extendable;
|
1145
|
+
uint8_t dense_below;
|
1146
|
+
uint8_t table_mask;
|
1147
|
+
/* To constant-initialize the tables of variable length, we need a flexible
|
1148
|
+
* array member, and we need to compile in C99 mode. */
|
1149
|
+
_upb_fasttable_entry fasttable[];
|
1150
|
+
};
|
1151
|
+
|
1152
|
+
typedef struct {
|
1153
|
+
upb_msglayout_field field;
|
1154
|
+
const upb_msglayout *extendee;
|
1155
|
+
const upb_msglayout *submsg; /* NULL for non-submessage fields. */
|
1156
|
+
} upb_msglayout_ext;
|
1157
|
+
|
1158
|
+
/** upb_extreg ****************************************************************/
|
1159
|
+
|
1160
|
+
/* Adds the given extension info for message type |l| and field number |num|
|
1161
|
+
* into the registry. Returns false if this message type and field number were
|
1162
|
+
* already in the map, or if memory allocation fails. */
|
1163
|
+
bool _upb_extreg_add(upb_extreg *r, const upb_msglayout_ext *e, size_t count);
|
1164
|
+
|
1165
|
+
/* Looks up the extension (if any) defined for message type |l| and field
|
1166
|
+
* number |num|. If an extension was found, copies the field info into |*ext|
|
1167
|
+
* and returns true. Otherwise returns false. */
|
1168
|
+
const upb_msglayout_field *_upb_extreg_get(const upb_extreg *r,
|
1169
|
+
const upb_msglayout *l,
|
1170
|
+
uint32_t num);
|
1171
|
+
|
1172
|
+
/** upb_msg *******************************************************************/
|
1173
|
+
|
1174
|
+
/* Internal members of a upb_msg that track unknown fields and/or extensions.
|
1175
|
+
* We can change this without breaking binary compatibility. We put these
|
1176
|
+
* before the user's data. The user's upb_msg* points after the
|
1177
|
+
* upb_msg_internal. */
|
1178
|
+
|
1179
|
+
typedef struct {
|
1180
|
+
/* Total size of this structure, including the data that follows.
|
1181
|
+
* Must be aligned to 8, which is alignof(upb_msg_ext) */
|
1182
|
+
uint32_t size;
|
1183
|
+
|
1184
|
+
/* Offsets relative to the beginning of this structure.
|
1185
|
+
*
|
1186
|
+
* Unknown data grows forward from the beginning to unknown_end.
|
1187
|
+
* Extension data grows backward from size to ext_begin.
|
1188
|
+
* When the two meet, we're out of data and have to realloc.
|
1189
|
+
*
|
1190
|
+
* If we imagine that the final member of this struct is:
|
1191
|
+
* char data[size - overhead]; // overhead = sizeof(upb_msg_internaldata)
|
1192
|
+
*
|
1193
|
+
* Then we have:
|
1194
|
+
* unknown data: data[0 .. (unknown_end - overhead)]
|
1195
|
+
* extensions data: data[(ext_begin - overhead) .. (size - overhead)] */
|
1196
|
+
uint32_t unknown_end;
|
1197
|
+
uint32_t ext_begin;
|
1198
|
+
/* Data follows, as if there were an array:
|
1199
|
+
* char data[size - sizeof(upb_msg_internaldata)]; */
|
1200
|
+
} upb_msg_internaldata;
|
1201
|
+
|
1202
|
+
typedef struct {
|
1203
|
+
upb_msg_internaldata *internal;
|
1204
|
+
} upb_msg_internal;
|
1205
|
+
|
1206
|
+
/* Maps upb_fieldtype_t -> memory size. */
|
1207
|
+
extern char _upb_fieldtype_to_size[12];
|
1208
|
+
|
1209
|
+
UPB_INLINE size_t upb_msg_sizeof(const upb_msglayout *l) {
|
1210
|
+
return l->size + sizeof(upb_msg_internal);
|
1211
|
+
}
|
1212
|
+
|
1213
|
+
UPB_INLINE upb_msg *_upb_msg_new_inl(const upb_msglayout *l, upb_arena *a) {
|
1214
|
+
size_t size = upb_msg_sizeof(l);
|
1215
|
+
void *mem = upb_arena_malloc(a, size);
|
1216
|
+
upb_msg *msg;
|
1217
|
+
if (UPB_UNLIKELY(!mem)) return NULL;
|
1218
|
+
msg = UPB_PTR_AT(mem, sizeof(upb_msg_internal), upb_msg);
|
1219
|
+
memset(mem, 0, size);
|
1220
|
+
return msg;
|
1221
|
+
}
|
1222
|
+
|
1223
|
+
/* Creates a new messages with the given layout on the given arena. */
|
1224
|
+
upb_msg *_upb_msg_new(const upb_msglayout *l, upb_arena *a);
|
1225
|
+
|
1226
|
+
UPB_INLINE upb_msg_internal *upb_msg_getinternal(upb_msg *msg) {
|
1227
|
+
ptrdiff_t size = sizeof(upb_msg_internal);
|
1228
|
+
return (upb_msg_internal*)((char*)msg - size);
|
1229
|
+
}
|
1230
|
+
|
1231
|
+
/* Clears the given message. */
|
1232
|
+
void _upb_msg_clear(upb_msg *msg, const upb_msglayout *l);
|
1233
|
+
|
1234
|
+
/* Discards the unknown fields for this message only. */
|
1235
|
+
void _upb_msg_discardunknown_shallow(upb_msg *msg);
|
1236
|
+
|
1237
|
+
/* Adds unknown data (serialized protobuf data) to the given message. The data
|
1238
|
+
* is copied into the message instance. */
|
1239
|
+
bool _upb_msg_addunknown(upb_msg *msg, const char *data, size_t len,
|
1240
|
+
upb_arena *arena);
|
1241
|
+
|
1242
|
+
/** upb_msg_ext ***************************************************************/
|
1243
|
+
|
1244
|
+
/* The internal representation of an extension is self-describing: it contains
|
1245
|
+
* enough information that we can serialize it to binary format without needing
|
1246
|
+
* to look it up in a registry. */
|
1247
|
+
typedef struct {
|
1248
|
+
const upb_msglayout_ext *ext;
|
1249
|
+
union {
|
1250
|
+
upb_strview str;
|
1251
|
+
void *ptr;
|
1252
|
+
double dbl;
|
1253
|
+
char scalar_data[8];
|
1254
|
+
} data;
|
1255
|
+
} upb_msg_ext;
|
1256
|
+
|
1257
|
+
/* Adds the given extension data to the given message. The returned extension will
|
1258
|
+
* have its "ext" member initialized according to |ext|. */
|
1259
|
+
upb_msg_ext *_upb_msg_getorcreateext(upb_msg *msg, const upb_msglayout_ext *ext,
|
1260
|
+
upb_arena *arena);
|
1261
|
+
|
1262
|
+
/* Returns an array of extensions for this message. Note: the array is
|
1263
|
+
* ordered in reverse relative to the order of creation. */
|
1264
|
+
const upb_msg_ext *_upb_msg_getexts(const upb_msg *msg, size_t *count);
|
1265
|
+
|
1266
|
+
/* Returns an extension for the given field number, or NULL if no extension
|
1267
|
+
* exists for this field number. */
|
1268
|
+
const upb_msg_ext *_upb_msg_getext(const upb_msg *msg,
|
1269
|
+
const upb_msglayout_ext *ext);
|
1270
|
+
|
1271
|
+
/** Hasbit access *************************************************************/
|
1272
|
+
|
1273
|
+
UPB_INLINE bool _upb_hasbit(const upb_msg *msg, size_t idx) {
|
1274
|
+
return (*UPB_PTR_AT(msg, idx / 8, const char) & (1 << (idx % 8))) != 0;
|
1275
|
+
}
|
1276
|
+
|
1277
|
+
UPB_INLINE void _upb_sethas(const upb_msg *msg, size_t idx) {
|
1278
|
+
(*UPB_PTR_AT(msg, idx / 8, char)) |= (char)(1 << (idx % 8));
|
1279
|
+
}
|
1280
|
+
|
1281
|
+
UPB_INLINE void _upb_clearhas(const upb_msg *msg, size_t idx) {
|
1282
|
+
(*UPB_PTR_AT(msg, idx / 8, char)) &= (char)(~(1 << (idx % 8)));
|
1283
|
+
}
|
1284
|
+
|
1285
|
+
UPB_INLINE size_t _upb_msg_hasidx(const upb_msglayout_field *f) {
|
1286
|
+
UPB_ASSERT(f->presence > 0);
|
1287
|
+
return f->presence;
|
1288
|
+
}
|
1289
|
+
|
1290
|
+
UPB_INLINE bool _upb_hasbit_field(const upb_msg *msg,
|
1291
|
+
const upb_msglayout_field *f) {
|
1292
|
+
return _upb_hasbit(msg, _upb_msg_hasidx(f));
|
1293
|
+
}
|
1294
|
+
|
1295
|
+
UPB_INLINE void _upb_sethas_field(const upb_msg *msg,
|
1296
|
+
const upb_msglayout_field *f) {
|
1297
|
+
_upb_sethas(msg, _upb_msg_hasidx(f));
|
1298
|
+
}
|
1299
|
+
|
1300
|
+
UPB_INLINE void _upb_clearhas_field(const upb_msg *msg,
|
1301
|
+
const upb_msglayout_field *f) {
|
1302
|
+
_upb_clearhas(msg, _upb_msg_hasidx(f));
|
1303
|
+
}
|
1304
|
+
|
1305
|
+
/** Oneof case access *********************************************************/
|
1306
|
+
|
1307
|
+
UPB_INLINE uint32_t *_upb_oneofcase(upb_msg *msg, size_t case_ofs) {
|
1308
|
+
return UPB_PTR_AT(msg, case_ofs, uint32_t);
|
1309
|
+
}
|
1310
|
+
|
1311
|
+
UPB_INLINE uint32_t _upb_getoneofcase(const void *msg, size_t case_ofs) {
|
1312
|
+
return *UPB_PTR_AT(msg, case_ofs, uint32_t);
|
1313
|
+
}
|
1314
|
+
|
1315
|
+
UPB_INLINE size_t _upb_oneofcase_ofs(const upb_msglayout_field *f) {
|
1316
|
+
UPB_ASSERT(f->presence < 0);
|
1317
|
+
return ~(ptrdiff_t)f->presence;
|
1318
|
+
}
|
1319
|
+
|
1320
|
+
UPB_INLINE uint32_t *_upb_oneofcase_field(upb_msg *msg,
|
1321
|
+
const upb_msglayout_field *f) {
|
1322
|
+
return _upb_oneofcase(msg, _upb_oneofcase_ofs(f));
|
1323
|
+
}
|
1324
|
+
|
1325
|
+
UPB_INLINE uint32_t _upb_getoneofcase_field(const upb_msg *msg,
|
1326
|
+
const upb_msglayout_field *f) {
|
1327
|
+
return _upb_getoneofcase(msg, _upb_oneofcase_ofs(f));
|
1328
|
+
}
|
1329
|
+
|
1330
|
+
UPB_INLINE bool _upb_has_submsg_nohasbit(const upb_msg *msg, size_t ofs) {
|
1331
|
+
return *UPB_PTR_AT(msg, ofs, const upb_msg*) != NULL;
|
1332
|
+
}
|
1333
|
+
|
1334
|
+
/** upb_array *****************************************************************/
|
1335
|
+
|
1336
|
+
/* Our internal representation for repeated fields. */
|
1337
|
+
typedef struct {
|
1338
|
+
uintptr_t data; /* Tagged ptr: low 3 bits of ptr are lg2(elem size). */
|
1339
|
+
size_t len; /* Measured in elements. */
|
1340
|
+
size_t size; /* Measured in elements. */
|
1341
|
+
uint64_t junk;
|
1342
|
+
} upb_array;
|
1343
|
+
|
1344
|
+
UPB_INLINE const void *_upb_array_constptr(const upb_array *arr) {
|
1345
|
+
UPB_ASSERT((arr->data & 7) <= 4);
|
1346
|
+
return (void*)(arr->data & ~(uintptr_t)7);
|
1347
|
+
}
|
1348
|
+
|
1349
|
+
UPB_INLINE uintptr_t _upb_array_tagptr(void* ptr, int elem_size_lg2) {
|
1350
|
+
UPB_ASSERT(elem_size_lg2 <= 4);
|
1351
|
+
return (uintptr_t)ptr | elem_size_lg2;
|
1352
|
+
}
|
1353
|
+
|
1354
|
+
UPB_INLINE void *_upb_array_ptr(upb_array *arr) {
|
1355
|
+
return (void*)_upb_array_constptr(arr);
|
1356
|
+
}
|
1357
|
+
|
1358
|
+
UPB_INLINE uintptr_t _upb_tag_arrptr(void* ptr, int elem_size_lg2) {
|
1359
|
+
UPB_ASSERT(elem_size_lg2 <= 4);
|
1360
|
+
UPB_ASSERT(((uintptr_t)ptr & 7) == 0);
|
1361
|
+
return (uintptr_t)ptr | (unsigned)elem_size_lg2;
|
1362
|
+
}
|
1363
|
+
|
1364
|
+
UPB_INLINE upb_array *_upb_array_new(upb_arena *a, size_t init_size,
|
1365
|
+
int elem_size_lg2) {
|
1366
|
+
const size_t arr_size = UPB_ALIGN_UP(sizeof(upb_array), 8);
|
1367
|
+
const size_t bytes = sizeof(upb_array) + (init_size << elem_size_lg2);
|
1368
|
+
upb_array *arr = (upb_array*)upb_arena_malloc(a, bytes);
|
1369
|
+
if (!arr) return NULL;
|
1370
|
+
arr->data = _upb_tag_arrptr(UPB_PTR_AT(arr, arr_size, void), elem_size_lg2);
|
1371
|
+
arr->len = 0;
|
1372
|
+
arr->size = init_size;
|
1373
|
+
return arr;
|
1374
|
+
}
|
1375
|
+
|
1376
|
+
/* Resizes the capacity of the array to be at least min_size. */
|
1377
|
+
bool _upb_array_realloc(upb_array *arr, size_t min_size, upb_arena *arena);
|
1378
|
+
|
1379
|
+
/* Fallback functions for when the accessors require a resize. */
|
1380
|
+
void *_upb_array_resize_fallback(upb_array **arr_ptr, size_t size,
|
1381
|
+
int elem_size_lg2, upb_arena *arena);
|
1382
|
+
bool _upb_array_append_fallback(upb_array **arr_ptr, const void *value,
|
1383
|
+
int elem_size_lg2, upb_arena *arena);
|
1384
|
+
|
1385
|
+
UPB_INLINE bool _upb_array_reserve(upb_array *arr, size_t size,
|
1386
|
+
upb_arena *arena) {
|
1387
|
+
if (arr->size < size) return _upb_array_realloc(arr, size, arena);
|
1388
|
+
return true;
|
1389
|
+
}
|
1390
|
+
|
1391
|
+
UPB_INLINE bool _upb_array_resize(upb_array *arr, size_t size,
|
1392
|
+
upb_arena *arena) {
|
1393
|
+
if (!_upb_array_reserve(arr, size, arena)) return false;
|
1394
|
+
arr->len = size;
|
1395
|
+
return true;
|
1396
|
+
}
|
1397
|
+
|
1398
|
+
UPB_INLINE const void *_upb_array_accessor(const void *msg, size_t ofs,
|
1399
|
+
size_t *size) {
|
1400
|
+
const upb_array *arr = *UPB_PTR_AT(msg, ofs, const upb_array*);
|
1401
|
+
if (arr) {
|
1402
|
+
if (size) *size = arr->len;
|
1403
|
+
return _upb_array_constptr(arr);
|
1404
|
+
} else {
|
1405
|
+
if (size) *size = 0;
|
1406
|
+
return NULL;
|
1407
|
+
}
|
1408
|
+
}
|
1409
|
+
|
1410
|
+
UPB_INLINE void *_upb_array_mutable_accessor(void *msg, size_t ofs,
|
1411
|
+
size_t *size) {
|
1412
|
+
upb_array *arr = *UPB_PTR_AT(msg, ofs, upb_array*);
|
1413
|
+
if (arr) {
|
1414
|
+
if (size) *size = arr->len;
|
1415
|
+
return _upb_array_ptr(arr);
|
1416
|
+
} else {
|
1417
|
+
if (size) *size = 0;
|
1418
|
+
return NULL;
|
1419
|
+
}
|
1420
|
+
}
|
1421
|
+
|
1422
|
+
UPB_INLINE void *_upb_array_resize_accessor2(void *msg, size_t ofs, size_t size,
|
1423
|
+
int elem_size_lg2,
|
1424
|
+
upb_arena *arena) {
|
1425
|
+
upb_array **arr_ptr = UPB_PTR_AT(msg, ofs, upb_array *);
|
1426
|
+
upb_array *arr = *arr_ptr;
|
1427
|
+
if (!arr || arr->size < size) {
|
1428
|
+
return _upb_array_resize_fallback(arr_ptr, size, elem_size_lg2, arena);
|
1429
|
+
}
|
1430
|
+
arr->len = size;
|
1431
|
+
return _upb_array_ptr(arr);
|
1432
|
+
}
|
1433
|
+
|
1434
|
+
UPB_INLINE bool _upb_array_append_accessor2(void *msg, size_t ofs,
|
1435
|
+
int elem_size_lg2,
|
1436
|
+
const void *value,
|
1437
|
+
upb_arena *arena) {
|
1438
|
+
upb_array **arr_ptr = UPB_PTR_AT(msg, ofs, upb_array *);
|
1439
|
+
size_t elem_size = 1 << elem_size_lg2;
|
1440
|
+
upb_array *arr = *arr_ptr;
|
1441
|
+
void *ptr;
|
1442
|
+
if (!arr || arr->len == arr->size) {
|
1443
|
+
return _upb_array_append_fallback(arr_ptr, value, elem_size_lg2, arena);
|
1444
|
+
}
|
1445
|
+
ptr = _upb_array_ptr(arr);
|
1446
|
+
memcpy(UPB_PTR_AT(ptr, arr->len * elem_size, char), value, elem_size);
|
1447
|
+
arr->len++;
|
1448
|
+
return true;
|
1449
|
+
}
|
1450
|
+
|
1451
|
+
/* Used by old generated code, remove once all code has been regenerated. */
|
1452
|
+
UPB_INLINE int _upb_sizelg2(upb_fieldtype_t type) {
|
1453
|
+
switch (type) {
|
1454
|
+
case UPB_TYPE_BOOL:
|
1455
|
+
return 0;
|
1456
|
+
case UPB_TYPE_FLOAT:
|
1457
|
+
case UPB_TYPE_INT32:
|
1458
|
+
case UPB_TYPE_UINT32:
|
1459
|
+
case UPB_TYPE_ENUM:
|
1460
|
+
return 2;
|
1461
|
+
case UPB_TYPE_MESSAGE:
|
1462
|
+
return UPB_SIZE(2, 3);
|
1463
|
+
case UPB_TYPE_DOUBLE:
|
1464
|
+
case UPB_TYPE_INT64:
|
1465
|
+
case UPB_TYPE_UINT64:
|
1466
|
+
return 3;
|
1467
|
+
case UPB_TYPE_STRING:
|
1468
|
+
case UPB_TYPE_BYTES:
|
1469
|
+
return UPB_SIZE(3, 4);
|
1470
|
+
}
|
1471
|
+
UPB_UNREACHABLE();
|
1472
|
+
}
|
1473
|
+
UPB_INLINE void *_upb_array_resize_accessor(void *msg, size_t ofs, size_t size,
|
1474
|
+
upb_fieldtype_t type,
|
1475
|
+
upb_arena *arena) {
|
1476
|
+
return _upb_array_resize_accessor2(msg, ofs, size, _upb_sizelg2(type), arena);
|
1477
|
+
}
|
1478
|
+
UPB_INLINE bool _upb_array_append_accessor(void *msg, size_t ofs,
|
1479
|
+
size_t elem_size, upb_fieldtype_t type,
|
1480
|
+
const void *value,
|
1481
|
+
upb_arena *arena) {
|
1482
|
+
(void)elem_size;
|
1483
|
+
return _upb_array_append_accessor2(msg, ofs, _upb_sizelg2(type), value,
|
1484
|
+
arena);
|
1485
|
+
}
|
1486
|
+
|
1487
|
+
/** upb_map *******************************************************************/
|
1488
|
+
|
1489
|
+
/* Right now we use strmaps for everything. We'll likely want to use
|
1490
|
+
* integer-specific maps for integer-keyed maps.*/
|
1491
|
+
typedef struct {
|
1492
|
+
/* Size of key and val, based on the map type. Strings are represented as '0'
|
1493
|
+
* because they must be handled specially. */
|
1494
|
+
char key_size;
|
1495
|
+
char val_size;
|
1496
|
+
|
1497
|
+
upb_strtable table;
|
1498
|
+
} upb_map;
|
1499
|
+
|
1500
|
+
/* Map entries aren't actually stored, they are only used during parsing. For
|
1501
|
+
* parsing, it helps a lot if all map entry messages have the same layout.
|
1502
|
+
* The compiler and def.c must ensure that all map entries have this layout. */
|
1503
|
+
typedef struct {
|
1504
|
+
upb_msg_internal internal;
|
1505
|
+
union {
|
1506
|
+
upb_strview str; /* For str/bytes. */
|
1507
|
+
upb_value val; /* For all other types. */
|
1508
|
+
} k;
|
1509
|
+
union {
|
1510
|
+
upb_strview str; /* For str/bytes. */
|
1511
|
+
upb_value val; /* For all other types. */
|
1512
|
+
} v;
|
1513
|
+
} upb_map_entry;
|
1514
|
+
|
1515
|
+
/* Creates a new map on the given arena with this key/value type. */
|
1516
|
+
upb_map *_upb_map_new(upb_arena *a, size_t key_size, size_t value_size);
|
1517
|
+
|
1518
|
+
/* Converting between internal table representation and user values.
|
1519
|
+
*
|
1520
|
+
* _upb_map_tokey() and _upb_map_fromkey() are inverses.
|
1521
|
+
* _upb_map_tovalue() and _upb_map_fromvalue() are inverses.
|
1522
|
+
*
|
1523
|
+
* These functions account for the fact that strings are treated differently
|
1524
|
+
* from other types when stored in a map.
|
1525
|
+
*/
|
1526
|
+
|
1527
|
+
UPB_INLINE upb_strview _upb_map_tokey(const void *key, size_t size) {
|
1528
|
+
if (size == UPB_MAPTYPE_STRING) {
|
1529
|
+
return *(upb_strview*)key;
|
1530
|
+
} else {
|
1531
|
+
return upb_strview_make((const char*)key, size);
|
1532
|
+
}
|
1533
|
+
}
|
1534
|
+
|
1535
|
+
UPB_INLINE void _upb_map_fromkey(upb_strview key, void* out, size_t size) {
|
1536
|
+
if (size == UPB_MAPTYPE_STRING) {
|
1537
|
+
memcpy(out, &key, sizeof(key));
|
1538
|
+
} else {
|
1539
|
+
memcpy(out, key.data, size);
|
1540
|
+
}
|
1541
|
+
}
|
1542
|
+
|
1543
|
+
UPB_INLINE bool _upb_map_tovalue(const void *val, size_t size, upb_value *msgval,
|
1544
|
+
upb_arena *a) {
|
1545
|
+
if (size == UPB_MAPTYPE_STRING) {
|
1546
|
+
upb_strview *strp = (upb_strview*)upb_arena_malloc(a, sizeof(*strp));
|
1547
|
+
if (!strp) return false;
|
1548
|
+
*strp = *(upb_strview*)val;
|
1549
|
+
*msgval = upb_value_ptr(strp);
|
1550
|
+
} else {
|
1551
|
+
memcpy(msgval, val, size);
|
1552
|
+
}
|
1553
|
+
return true;
|
1554
|
+
}
|
1555
|
+
|
1556
|
+
UPB_INLINE void _upb_map_fromvalue(upb_value val, void* out, size_t size) {
|
1557
|
+
if (size == UPB_MAPTYPE_STRING) {
|
1558
|
+
const upb_strview *strp = (const upb_strview*)upb_value_getptr(val);
|
1559
|
+
memcpy(out, strp, sizeof(upb_strview));
|
1560
|
+
} else {
|
1561
|
+
memcpy(out, &val, size);
|
1562
|
+
}
|
1563
|
+
}
|
1564
|
+
|
1565
|
+
/* Map operations, shared by reflection and generated code. */
|
1566
|
+
|
1567
|
+
UPB_INLINE size_t _upb_map_size(const upb_map *map) {
|
1568
|
+
return map->table.t.count;
|
1569
|
+
}
|
1570
|
+
|
1571
|
+
UPB_INLINE bool _upb_map_get(const upb_map *map, const void *key,
|
1572
|
+
size_t key_size, void *val, size_t val_size) {
|
1573
|
+
upb_value tabval;
|
1574
|
+
upb_strview k = _upb_map_tokey(key, key_size);
|
1575
|
+
bool ret = upb_strtable_lookup2(&map->table, k.data, k.size, &tabval);
|
1576
|
+
if (ret && val) {
|
1577
|
+
_upb_map_fromvalue(tabval, val, val_size);
|
1578
|
+
}
|
1579
|
+
return ret;
|
1580
|
+
}
|
1581
|
+
|
1582
|
+
UPB_INLINE void* _upb_map_next(const upb_map *map, size_t *iter) {
|
1583
|
+
upb_strtable_iter it;
|
1584
|
+
it.t = &map->table;
|
1585
|
+
it.index = *iter;
|
1586
|
+
upb_strtable_next(&it);
|
1587
|
+
*iter = it.index;
|
1588
|
+
if (upb_strtable_done(&it)) return NULL;
|
1589
|
+
return (void*)str_tabent(&it);
|
1590
|
+
}
|
1591
|
+
|
1592
|
+
UPB_INLINE bool _upb_map_set(upb_map *map, const void *key, size_t key_size,
|
1593
|
+
void *val, size_t val_size, upb_arena *a) {
|
1594
|
+
upb_strview strkey = _upb_map_tokey(key, key_size);
|
1595
|
+
upb_value tabval = {0};
|
1596
|
+
if (!_upb_map_tovalue(val, val_size, &tabval, a)) return false;
|
1597
|
+
|
1598
|
+
/* TODO(haberman): add overwrite operation to minimize number of lookups. */
|
1599
|
+
upb_strtable_remove(&map->table, strkey.data, strkey.size, NULL);
|
1600
|
+
return upb_strtable_insert(&map->table, strkey.data, strkey.size, tabval, a);
|
1601
|
+
}
|
1602
|
+
|
1603
|
+
UPB_INLINE bool _upb_map_delete(upb_map *map, const void *key, size_t key_size) {
|
1604
|
+
upb_strview k = _upb_map_tokey(key, key_size);
|
1605
|
+
return upb_strtable_remove(&map->table, k.data, k.size, NULL);
|
1606
|
+
}
|
1607
|
+
|
1608
|
+
UPB_INLINE void _upb_map_clear(upb_map *map) {
|
1609
|
+
upb_strtable_clear(&map->table);
|
1610
|
+
}
|
1611
|
+
|
1612
|
+
/* Message map operations, these get the map from the message first. */
|
1613
|
+
|
1614
|
+
UPB_INLINE size_t _upb_msg_map_size(const upb_msg *msg, size_t ofs) {
|
1615
|
+
upb_map *map = *UPB_PTR_AT(msg, ofs, upb_map *);
|
1616
|
+
return map ? _upb_map_size(map) : 0;
|
1617
|
+
}
|
1618
|
+
|
1619
|
+
UPB_INLINE bool _upb_msg_map_get(const upb_msg *msg, size_t ofs,
|
1620
|
+
const void *key, size_t key_size, void *val,
|
1621
|
+
size_t val_size) {
|
1622
|
+
upb_map *map = *UPB_PTR_AT(msg, ofs, upb_map *);
|
1623
|
+
if (!map) return false;
|
1624
|
+
return _upb_map_get(map, key, key_size, val, val_size);
|
1625
|
+
}
|
1626
|
+
|
1627
|
+
UPB_INLINE void *_upb_msg_map_next(const upb_msg *msg, size_t ofs,
|
1628
|
+
size_t *iter) {
|
1629
|
+
upb_map *map = *UPB_PTR_AT(msg, ofs, upb_map *);
|
1630
|
+
if (!map) return NULL;
|
1631
|
+
return _upb_map_next(map, iter);
|
1632
|
+
}
|
1633
|
+
|
1634
|
+
UPB_INLINE bool _upb_msg_map_set(upb_msg *msg, size_t ofs, const void *key,
|
1635
|
+
size_t key_size, void *val, size_t val_size,
|
1636
|
+
upb_arena *arena) {
|
1637
|
+
upb_map **map = UPB_PTR_AT(msg, ofs, upb_map *);
|
1638
|
+
if (!*map) {
|
1639
|
+
*map = _upb_map_new(arena, key_size, val_size);
|
1640
|
+
}
|
1641
|
+
return _upb_map_set(*map, key, key_size, val, val_size, arena);
|
1642
|
+
}
|
1643
|
+
|
1644
|
+
UPB_INLINE bool _upb_msg_map_delete(upb_msg *msg, size_t ofs, const void *key,
|
1645
|
+
size_t key_size) {
|
1646
|
+
upb_map *map = *UPB_PTR_AT(msg, ofs, upb_map *);
|
1647
|
+
if (!map) return false;
|
1648
|
+
return _upb_map_delete(map, key, key_size);
|
1649
|
+
}
|
1650
|
+
|
1651
|
+
UPB_INLINE void _upb_msg_map_clear(upb_msg *msg, size_t ofs) {
|
1652
|
+
upb_map *map = *UPB_PTR_AT(msg, ofs, upb_map *);
|
1653
|
+
if (!map) return;
|
1654
|
+
_upb_map_clear(map);
|
1655
|
+
}
|
1656
|
+
|
1657
|
+
/* Accessing map key/value from a pointer, used by generated code only. */
|
1658
|
+
|
1659
|
+
UPB_INLINE void _upb_msg_map_key(const void* msg, void* key, size_t size) {
|
1660
|
+
const upb_tabent *ent = (const upb_tabent*)msg;
|
1661
|
+
uint32_t u32len;
|
1662
|
+
upb_strview k;
|
1663
|
+
k.data = upb_tabstr(ent->key, &u32len);
|
1664
|
+
k.size = u32len;
|
1665
|
+
_upb_map_fromkey(k, key, size);
|
1666
|
+
}
|
1667
|
+
|
1668
|
+
UPB_INLINE void _upb_msg_map_value(const void* msg, void* val, size_t size) {
|
1669
|
+
const upb_tabent *ent = (const upb_tabent*)msg;
|
1670
|
+
upb_value v = {ent->val.val};
|
1671
|
+
_upb_map_fromvalue(v, val, size);
|
1672
|
+
}
|
1673
|
+
|
1674
|
+
UPB_INLINE void _upb_msg_map_set_value(void* msg, const void* val, size_t size) {
|
1675
|
+
upb_tabent *ent = (upb_tabent*)msg;
|
1676
|
+
/* This is like _upb_map_tovalue() except the entry already exists so we can
|
1677
|
+
* reuse the allocated upb_strview for string fields. */
|
1678
|
+
if (size == UPB_MAPTYPE_STRING) {
|
1679
|
+
upb_strview *strp = (upb_strview*)(uintptr_t)ent->val.val;
|
1680
|
+
memcpy(strp, val, sizeof(*strp));
|
1681
|
+
} else {
|
1682
|
+
memcpy(&ent->val.val, val, size);
|
1683
|
+
}
|
1684
|
+
}
|
1685
|
+
|
1686
|
+
/** _upb_mapsorter *************************************************************/
|
1687
|
+
|
1688
|
+
/* _upb_mapsorter sorts maps and provides ordered iteration over the entries.
|
1689
|
+
* Since maps can be recursive (map values can be messages which contain other maps).
|
1690
|
+
* _upb_mapsorter can contain a stack of maps. */
|
1691
|
+
|
1692
|
+
typedef struct {
|
1693
|
+
upb_tabent const**entries;
|
1694
|
+
int size;
|
1695
|
+
int cap;
|
1696
|
+
} _upb_mapsorter;
|
1697
|
+
|
1698
|
+
typedef struct {
|
1699
|
+
int start;
|
1700
|
+
int pos;
|
1701
|
+
int end;
|
1702
|
+
} _upb_sortedmap;
|
1703
|
+
|
1704
|
+
UPB_INLINE void _upb_mapsorter_init(_upb_mapsorter *s) {
|
1705
|
+
s->entries = NULL;
|
1706
|
+
s->size = 0;
|
1707
|
+
s->cap = 0;
|
1708
|
+
}
|
1709
|
+
|
1710
|
+
UPB_INLINE void _upb_mapsorter_destroy(_upb_mapsorter *s) {
|
1711
|
+
if (s->entries) free(s->entries);
|
1712
|
+
}
|
1713
|
+
|
1714
|
+
bool _upb_mapsorter_pushmap(_upb_mapsorter *s, upb_descriptortype_t key_type,
|
1715
|
+
const upb_map *map, _upb_sortedmap *sorted);
|
1716
|
+
|
1717
|
+
UPB_INLINE void _upb_mapsorter_popmap(_upb_mapsorter *s, _upb_sortedmap *sorted) {
|
1718
|
+
s->size = sorted->start;
|
1719
|
+
}
|
1720
|
+
|
1721
|
+
UPB_INLINE bool _upb_sortedmap_next(_upb_mapsorter *s, const upb_map *map,
|
1722
|
+
_upb_sortedmap *sorted,
|
1723
|
+
upb_map_entry *ent) {
|
1724
|
+
if (sorted->pos == sorted->end) return false;
|
1725
|
+
const upb_tabent *tabent = s->entries[sorted->pos++];
|
1726
|
+
upb_strview key = upb_tabstrview(tabent->key);
|
1727
|
+
_upb_map_fromkey(key, &ent->k, map->key_size);
|
1728
|
+
upb_value val = {tabent->val.val};
|
1729
|
+
_upb_map_fromvalue(val, &ent->v, map->val_size);
|
1730
|
+
return true;
|
1731
|
+
}
|
1732
|
+
|
1733
|
+
#ifdef __cplusplus
|
1734
|
+
} /* extern "C" */
|
1735
|
+
#endif
|
1736
|
+
|
1737
|
+
|
1738
|
+
#endif /* UPB_MSG_INT_H_ */
|
1739
|
+
|
1740
|
+
/** upb/upb_internal.h ************************************************************/
|
1741
|
+
#ifndef UPB_INT_H_
|
1742
|
+
#define UPB_INT_H_
|
1743
|
+
|
1744
|
+
|
1745
|
+
struct mem_block;
|
1746
|
+
typedef struct mem_block mem_block;
|
1747
|
+
|
1748
|
+
struct upb_arena {
|
1749
|
+
_upb_arena_head head;
|
1750
|
+
/* Stores cleanup metadata for this arena.
|
1751
|
+
* - a pointer to the current cleanup counter.
|
1752
|
+
* - a boolean indicating if there is an unowned initial block. */
|
1753
|
+
uintptr_t cleanup_metadata;
|
1754
|
+
|
1755
|
+
/* Allocator to allocate arena blocks. We are responsible for freeing these
|
1756
|
+
* when we are destroyed. */
|
1757
|
+
upb_alloc *block_alloc;
|
1758
|
+
uint32_t last_size;
|
1759
|
+
|
1760
|
+
/* When multiple arenas are fused together, each arena points to a parent
|
1761
|
+
* arena (root points to itself). The root tracks how many live arenas
|
1762
|
+
* reference it. */
|
1763
|
+
uint32_t refcount; /* Only used when a->parent == a */
|
1764
|
+
struct upb_arena *parent;
|
1765
|
+
|
1766
|
+
/* Linked list of blocks to free/cleanup. */
|
1767
|
+
mem_block *freelist, *freelist_tail;
|
1768
|
+
};
|
1769
|
+
|
1770
|
+
#endif /* UPB_INT_H_ */
|
1771
|
+
|
1772
|
+
/* Must be last. */
|
1773
|
+
|
1774
|
+
#define DECODE_NOGROUP (uint32_t)-1
|
1775
|
+
|
1776
|
+
typedef struct upb_decstate {
|
1777
|
+
const char *end; /* Can read up to 16 bytes slop beyond this. */
|
1778
|
+
const char *limit_ptr; /* = end + UPB_MIN(limit, 0) */
|
1779
|
+
upb_msg *unknown_msg; /* If non-NULL, add unknown data at buffer flip. */
|
1780
|
+
const char *unknown; /* Start of unknown data. */
|
1781
|
+
int limit; /* Submessage limit relative to end. */
|
1782
|
+
int depth;
|
1783
|
+
uint32_t end_group; /* field number of END_GROUP tag, else DECODE_NOGROUP */
|
1784
|
+
bool alias;
|
1785
|
+
char patch[32];
|
1786
|
+
upb_arena arena;
|
1787
|
+
jmp_buf err;
|
1788
|
+
} upb_decstate;
|
1789
|
+
|
1790
|
+
/* Error function that will abort decoding with longjmp(). We can't declare this
|
1791
|
+
* UPB_NORETURN, even though it is appropriate, because if we do then compilers
|
1792
|
+
* will "helpfully" refuse to tailcall to it
|
1793
|
+
* (see: https://stackoverflow.com/a/55657013), which will defeat a major goal
|
1794
|
+
* of our optimizations. That is also why we must declare it in a separate file,
|
1795
|
+
* otherwise the compiler will see that it calls longjmp() and deduce that it is
|
1796
|
+
* noreturn. */
|
1797
|
+
const char *fastdecode_err(upb_decstate *d);
|
1798
|
+
|
1799
|
+
extern const uint8_t upb_utf8_offsets[];
|
1800
|
+
|
1801
|
+
UPB_INLINE
|
1802
|
+
bool decode_verifyutf8_inl(const char *buf, int len) {
|
1803
|
+
int i, j;
|
1804
|
+
uint8_t offset;
|
1805
|
+
|
1806
|
+
i = 0;
|
1807
|
+
while (i < len) {
|
1808
|
+
offset = upb_utf8_offsets[(uint8_t)buf[i]];
|
1809
|
+
if (offset == 0 || i + offset > len) {
|
1810
|
+
return false;
|
1811
|
+
}
|
1812
|
+
for (j = i + 1; j < i + offset; j++) {
|
1813
|
+
if ((buf[j] & 0xc0) != 0x80) {
|
1814
|
+
return false;
|
1815
|
+
}
|
1816
|
+
}
|
1817
|
+
i += offset;
|
1818
|
+
}
|
1819
|
+
return i == len;
|
1820
|
+
}
|
1821
|
+
|
1822
|
+
/* x86-64 pointers always have the high 16 bits matching. So we can shift
|
1823
|
+
* left 8 and right 8 without loss of information. */
|
1824
|
+
UPB_INLINE intptr_t decode_totable(const upb_msglayout *tablep) {
|
1825
|
+
return ((intptr_t)tablep << 8) | tablep->table_mask;
|
1826
|
+
}
|
1827
|
+
|
1828
|
+
UPB_INLINE const upb_msglayout *decode_totablep(intptr_t table) {
|
1829
|
+
return (const upb_msglayout*)(table >> 8);
|
1830
|
+
}
|
1831
|
+
|
1832
|
+
UPB_INLINE
|
1833
|
+
const char *decode_isdonefallback_inl(upb_decstate *d, const char *ptr,
|
1834
|
+
int overrun) {
|
1835
|
+
if (overrun < d->limit) {
|
1836
|
+
/* Need to copy remaining data into patch buffer. */
|
1837
|
+
UPB_ASSERT(overrun < 16);
|
1838
|
+
if (d->unknown_msg) {
|
1839
|
+
if (!_upb_msg_addunknown(d->unknown_msg, d->unknown, ptr - d->unknown,
|
1840
|
+
&d->arena)) {
|
1841
|
+
return NULL;
|
1842
|
+
}
|
1843
|
+
d->unknown = &d->patch[0] + overrun;
|
1844
|
+
}
|
1845
|
+
memset(d->patch + 16, 0, 16);
|
1846
|
+
memcpy(d->patch, d->end, 16);
|
1847
|
+
ptr = &d->patch[0] + overrun;
|
1848
|
+
d->end = &d->patch[16];
|
1849
|
+
d->limit -= 16;
|
1850
|
+
d->limit_ptr = d->end + d->limit;
|
1851
|
+
d->alias = false;
|
1852
|
+
UPB_ASSERT(ptr < d->limit_ptr);
|
1853
|
+
return ptr;
|
1854
|
+
} else {
|
1855
|
+
return NULL;
|
1856
|
+
}
|
1857
|
+
}
|
1858
|
+
|
1859
|
+
const char *decode_isdonefallback(upb_decstate *d, const char *ptr,
|
1860
|
+
int overrun);
|
1861
|
+
|
1862
|
+
UPB_INLINE
|
1863
|
+
bool decode_isdone(upb_decstate *d, const char **ptr) {
|
1864
|
+
int overrun = *ptr - d->end;
|
1865
|
+
if (UPB_LIKELY(*ptr < d->limit_ptr)) {
|
1866
|
+
return false;
|
1867
|
+
} else if (UPB_LIKELY(overrun == d->limit)) {
|
1868
|
+
return true;
|
1869
|
+
} else {
|
1870
|
+
*ptr = decode_isdonefallback(d, *ptr, overrun);
|
1871
|
+
return false;
|
1872
|
+
}
|
1873
|
+
}
|
1874
|
+
|
1875
|
+
#if UPB_FASTTABLE
|
1876
|
+
UPB_INLINE
|
1877
|
+
const char *fastdecode_tagdispatch(upb_decstate *d, const char *ptr,
|
1878
|
+
upb_msg *msg, intptr_t table,
|
1879
|
+
uint64_t hasbits, uint64_t tag) {
|
1880
|
+
const upb_msglayout *table_p = decode_totablep(table);
|
1881
|
+
uint8_t mask = table;
|
1882
|
+
uint64_t data;
|
1883
|
+
size_t idx = tag & mask;
|
1884
|
+
UPB_ASSUME((idx & 7) == 0);
|
1885
|
+
idx >>= 3;
|
1886
|
+
data = table_p->fasttable[idx].field_data ^ tag;
|
1887
|
+
UPB_MUSTTAIL return table_p->fasttable[idx].field_parser(d, ptr, msg, table,
|
1888
|
+
hasbits, data);
|
1889
|
+
}
|
1890
|
+
#endif
|
1891
|
+
|
1892
|
+
UPB_INLINE uint32_t fastdecode_loadtag(const char* ptr) {
|
1893
|
+
uint16_t tag;
|
1894
|
+
memcpy(&tag, ptr, 2);
|
1895
|
+
return tag;
|
1896
|
+
}
|
1897
|
+
|
1898
|
+
UPB_INLINE void decode_checklimit(upb_decstate *d) {
|
1899
|
+
UPB_ASSERT(d->limit_ptr == d->end + UPB_MIN(0, d->limit));
|
1900
|
+
}
|
1901
|
+
|
1902
|
+
UPB_INLINE int decode_pushlimit(upb_decstate *d, const char *ptr, int size) {
|
1903
|
+
int limit = size + (int)(ptr - d->end);
|
1904
|
+
int delta = d->limit - limit;
|
1905
|
+
decode_checklimit(d);
|
1906
|
+
d->limit = limit;
|
1907
|
+
d->limit_ptr = d->end + UPB_MIN(0, limit);
|
1908
|
+
decode_checklimit(d);
|
1909
|
+
return delta;
|
1910
|
+
}
|
1911
|
+
|
1912
|
+
UPB_INLINE void decode_poplimit(upb_decstate *d, const char *ptr,
|
1913
|
+
int saved_delta) {
|
1914
|
+
UPB_ASSERT(ptr - d->end == d->limit);
|
1915
|
+
decode_checklimit(d);
|
1916
|
+
d->limit += saved_delta;
|
1917
|
+
d->limit_ptr = d->end + UPB_MIN(0, d->limit);
|
1918
|
+
decode_checklimit(d);
|
1919
|
+
}
|
1920
|
+
|
1921
|
+
|
1922
|
+
#endif /* UPB_DECODE_INT_H_ */
|
1923
|
+
|
1924
|
+
/** upb/encode.h ************************************************************/
|
1925
|
+
/*
|
1926
|
+
* upb_encode: parsing into a upb_msg using a upb_msglayout.
|
1927
|
+
*/
|
1928
|
+
|
1929
|
+
#ifndef UPB_ENCODE_H_
|
1930
|
+
#define UPB_ENCODE_H_
|
1931
|
+
|
1932
|
+
|
1933
|
+
/* Must be last. */
|
1934
|
+
|
1935
|
+
#ifdef __cplusplus
|
1936
|
+
extern "C" {
|
1937
|
+
#endif
|
1938
|
+
|
1939
|
+
enum {
|
1940
|
+
/* If set, the results of serializing will be deterministic across all
|
1941
|
+
* instances of this binary. There are no guarantees across different
|
1942
|
+
* binary builds.
|
1943
|
+
*
|
1944
|
+
* If your proto contains maps, the encoder will need to malloc()/free()
|
1945
|
+
* memory during encode. */
|
1946
|
+
UPB_ENCODE_DETERMINISTIC = 1,
|
1947
|
+
|
1948
|
+
/* When set, unknown fields are not printed. */
|
1949
|
+
UPB_ENCODE_SKIPUNKNOWN = 2,
|
1950
|
+
};
|
1951
|
+
|
1952
|
+
#define UPB_ENCODE_MAXDEPTH(depth) ((depth) << 16)
|
1953
|
+
|
1954
|
+
char *upb_encode_ex(const void *msg, const upb_msglayout *l, int options,
|
1955
|
+
upb_arena *arena, size_t *size);
|
1956
|
+
|
1957
|
+
UPB_INLINE char *upb_encode(const void *msg, const upb_msglayout *l,
|
1958
|
+
upb_arena *arena, size_t *size) {
|
1959
|
+
return upb_encode_ex(msg, l, 0, arena, size);
|
1960
|
+
}
|
1961
|
+
|
1962
|
+
|
1963
|
+
#ifdef __cplusplus
|
1964
|
+
} /* extern "C" */
|
1965
|
+
#endif
|
1966
|
+
|
1967
|
+
#endif /* UPB_ENCODE_H_ */
|
1968
|
+
|
1969
|
+
/** upb/decode_fast.h ************************************************************/
|
1970
|
+
// These are the specialized field parser functions for the fast parser.
|
1971
|
+
// Generated tables will refer to these by name.
|
1972
|
+
//
|
1973
|
+
// The function names are encoded with names like:
|
1974
|
+
//
|
1975
|
+
// // 123 4
|
1976
|
+
// upb_pss_1bt(); // Parse singular string, 1 byte tag.
|
1977
|
+
//
|
1978
|
+
// In position 1:
|
1979
|
+
// - 'p' for parse, most function use this
|
1980
|
+
// - 'c' for copy, for when we are copying strings instead of aliasing
|
1981
|
+
//
|
1982
|
+
// In position 2 (cardinality):
|
1983
|
+
// - 's' for singular, with or without hasbit
|
1984
|
+
// - 'o' for oneof
|
1985
|
+
// - 'r' for non-packed repeated
|
1986
|
+
// - 'p' for packed repeated
|
1987
|
+
//
|
1988
|
+
// In position 3 (type):
|
1989
|
+
// - 'b1' for bool
|
1990
|
+
// - 'v4' for 4-byte varint
|
1991
|
+
// - 'v8' for 8-byte varint
|
1992
|
+
// - 'z4' for zig-zag-encoded 4-byte varint
|
1993
|
+
// - 'z8' for zig-zag-encoded 8-byte varint
|
1994
|
+
// - 'f4' for 4-byte fixed
|
1995
|
+
// - 'f8' for 8-byte fixed
|
1996
|
+
// - 'm' for sub-message
|
1997
|
+
// - 's' for string (validate UTF-8)
|
1998
|
+
// - 'b' for bytes
|
1999
|
+
//
|
2000
|
+
// In position 4 (tag length):
|
2001
|
+
// - '1' for one-byte tags (field numbers 1-15)
|
2002
|
+
// - '2' for two-byte tags (field numbers 16-2048)
|
2003
|
+
|
2004
|
+
#ifndef UPB_DECODE_FAST_H_
|
2005
|
+
#define UPB_DECODE_FAST_H_
|
2006
|
+
|
2007
|
+
|
2008
|
+
struct upb_decstate;
|
2009
|
+
|
2010
|
+
// The fallback, generic parsing function that can handle any field type.
|
2011
|
+
// This just uses the regular (non-fast) parser to parse a single field.
|
2012
|
+
const char *fastdecode_generic(struct upb_decstate *d, const char *ptr,
|
2013
|
+
upb_msg *msg, intptr_t table, uint64_t hasbits,
|
2014
|
+
uint64_t data);
|
2015
|
+
|
2016
|
+
#define UPB_PARSE_PARAMS \
|
2017
|
+
struct upb_decstate *d, const char *ptr, upb_msg *msg, intptr_t table, \
|
2018
|
+
uint64_t hasbits, uint64_t data
|
2019
|
+
|
2020
|
+
/* primitive fields ***********************************************************/
|
2021
|
+
|
2022
|
+
#define F(card, type, valbytes, tagbytes) \
|
2023
|
+
const char *upb_p##card##type##valbytes##_##tagbytes##bt(UPB_PARSE_PARAMS);
|
2024
|
+
|
2025
|
+
#define TYPES(card, tagbytes) \
|
2026
|
+
F(card, b, 1, tagbytes) \
|
2027
|
+
F(card, v, 4, tagbytes) \
|
2028
|
+
F(card, v, 8, tagbytes) \
|
2029
|
+
F(card, z, 4, tagbytes) \
|
2030
|
+
F(card, z, 8, tagbytes) \
|
2031
|
+
F(card, f, 4, tagbytes) \
|
2032
|
+
F(card, f, 8, tagbytes)
|
2033
|
+
|
2034
|
+
#define TAGBYTES(card) \
|
2035
|
+
TYPES(card, 1) \
|
2036
|
+
TYPES(card, 2)
|
2037
|
+
|
2038
|
+
TAGBYTES(s)
|
2039
|
+
TAGBYTES(o)
|
2040
|
+
TAGBYTES(r)
|
2041
|
+
TAGBYTES(p)
|
2042
|
+
|
2043
|
+
#undef F
|
2044
|
+
#undef TYPES
|
2045
|
+
#undef TAGBYTES
|
2046
|
+
|
2047
|
+
/* string fields **************************************************************/
|
2048
|
+
|
2049
|
+
#define F(card, tagbytes, type) \
|
2050
|
+
const char *upb_p##card##type##_##tagbytes##bt(UPB_PARSE_PARAMS); \
|
2051
|
+
const char *upb_c##card##type##_##tagbytes##bt(UPB_PARSE_PARAMS);
|
2052
|
+
|
2053
|
+
#define UTF8(card, tagbytes) \
|
2054
|
+
F(card, tagbytes, s) \
|
2055
|
+
F(card, tagbytes, b)
|
2056
|
+
|
2057
|
+
#define TAGBYTES(card) \
|
2058
|
+
UTF8(card, 1) \
|
2059
|
+
UTF8(card, 2)
|
2060
|
+
|
2061
|
+
TAGBYTES(s)
|
2062
|
+
TAGBYTES(o)
|
2063
|
+
TAGBYTES(r)
|
2064
|
+
|
2065
|
+
#undef F
|
2066
|
+
#undef TAGBYTES
|
2067
|
+
|
2068
|
+
/* sub-message fields *********************************************************/
|
2069
|
+
|
2070
|
+
#define F(card, tagbytes, size_ceil, ceil_arg) \
|
2071
|
+
const char *upb_p##card##m_##tagbytes##bt_max##size_ceil##b(UPB_PARSE_PARAMS);
|
2072
|
+
|
2073
|
+
#define SIZES(card, tagbytes) \
|
2074
|
+
F(card, tagbytes, 64, 64) \
|
2075
|
+
F(card, tagbytes, 128, 128) \
|
2076
|
+
F(card, tagbytes, 192, 192) \
|
2077
|
+
F(card, tagbytes, 256, 256) \
|
2078
|
+
F(card, tagbytes, max, -1)
|
2079
|
+
|
2080
|
+
#define TAGBYTES(card) \
|
2081
|
+
SIZES(card, 1) \
|
2082
|
+
SIZES(card, 2)
|
2083
|
+
|
2084
|
+
TAGBYTES(s)
|
2085
|
+
TAGBYTES(o)
|
2086
|
+
TAGBYTES(r)
|
2087
|
+
|
2088
|
+
#undef TAGBYTES
|
2089
|
+
#undef SIZES
|
2090
|
+
#undef F
|
2091
|
+
|
2092
|
+
#undef UPB_PARSE_PARAMS
|
2093
|
+
|
2094
|
+
#endif /* UPB_DECODE_FAST_H_ */
|
2095
|
+
|
2096
|
+
/** google/protobuf/descriptor.upb.h ************************************************************//* This file was generated by upbc (the upb compiler) from the input
|
2097
|
+
* file:
|
2098
|
+
*
|
2099
|
+
* google/protobuf/descriptor.proto
|
2100
|
+
*
|
2101
|
+
* Do not edit -- your changes will be discarded when the file is
|
2102
|
+
* regenerated. */
|
2103
|
+
|
2104
|
+
#ifndef GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_H_
|
2105
|
+
#define GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_H_
|
2106
|
+
|
2107
|
+
|
2108
|
+
|
2109
|
+
#ifdef __cplusplus
|
2110
|
+
extern "C" {
|
2111
|
+
#endif
|
2112
|
+
|
2113
|
+
struct google_protobuf_FileDescriptorSet;
|
2114
|
+
struct google_protobuf_FileDescriptorProto;
|
2115
|
+
struct google_protobuf_DescriptorProto;
|
2116
|
+
struct google_protobuf_DescriptorProto_ExtensionRange;
|
2117
|
+
struct google_protobuf_DescriptorProto_ReservedRange;
|
2118
|
+
struct google_protobuf_ExtensionRangeOptions;
|
2119
|
+
struct google_protobuf_FieldDescriptorProto;
|
2120
|
+
struct google_protobuf_OneofDescriptorProto;
|
2121
|
+
struct google_protobuf_EnumDescriptorProto;
|
2122
|
+
struct google_protobuf_EnumDescriptorProto_EnumReservedRange;
|
2123
|
+
struct google_protobuf_EnumValueDescriptorProto;
|
2124
|
+
struct google_protobuf_ServiceDescriptorProto;
|
2125
|
+
struct google_protobuf_MethodDescriptorProto;
|
2126
|
+
struct google_protobuf_FileOptions;
|
2127
|
+
struct google_protobuf_MessageOptions;
|
2128
|
+
struct google_protobuf_FieldOptions;
|
2129
|
+
struct google_protobuf_OneofOptions;
|
2130
|
+
struct google_protobuf_EnumOptions;
|
2131
|
+
struct google_protobuf_EnumValueOptions;
|
2132
|
+
struct google_protobuf_ServiceOptions;
|
2133
|
+
struct google_protobuf_MethodOptions;
|
2134
|
+
struct google_protobuf_UninterpretedOption;
|
2135
|
+
struct google_protobuf_UninterpretedOption_NamePart;
|
2136
|
+
struct google_protobuf_SourceCodeInfo;
|
2137
|
+
struct google_protobuf_SourceCodeInfo_Location;
|
2138
|
+
struct google_protobuf_GeneratedCodeInfo;
|
2139
|
+
struct google_protobuf_GeneratedCodeInfo_Annotation;
|
2140
|
+
typedef struct google_protobuf_FileDescriptorSet google_protobuf_FileDescriptorSet;
|
2141
|
+
typedef struct google_protobuf_FileDescriptorProto google_protobuf_FileDescriptorProto;
|
2142
|
+
typedef struct google_protobuf_DescriptorProto google_protobuf_DescriptorProto;
|
2143
|
+
typedef struct google_protobuf_DescriptorProto_ExtensionRange google_protobuf_DescriptorProto_ExtensionRange;
|
2144
|
+
typedef struct google_protobuf_DescriptorProto_ReservedRange google_protobuf_DescriptorProto_ReservedRange;
|
2145
|
+
typedef struct google_protobuf_ExtensionRangeOptions google_protobuf_ExtensionRangeOptions;
|
2146
|
+
typedef struct google_protobuf_FieldDescriptorProto google_protobuf_FieldDescriptorProto;
|
2147
|
+
typedef struct google_protobuf_OneofDescriptorProto google_protobuf_OneofDescriptorProto;
|
2148
|
+
typedef struct google_protobuf_EnumDescriptorProto google_protobuf_EnumDescriptorProto;
|
2149
|
+
typedef struct google_protobuf_EnumDescriptorProto_EnumReservedRange google_protobuf_EnumDescriptorProto_EnumReservedRange;
|
2150
|
+
typedef struct google_protobuf_EnumValueDescriptorProto google_protobuf_EnumValueDescriptorProto;
|
2151
|
+
typedef struct google_protobuf_ServiceDescriptorProto google_protobuf_ServiceDescriptorProto;
|
2152
|
+
typedef struct google_protobuf_MethodDescriptorProto google_protobuf_MethodDescriptorProto;
|
2153
|
+
typedef struct google_protobuf_FileOptions google_protobuf_FileOptions;
|
2154
|
+
typedef struct google_protobuf_MessageOptions google_protobuf_MessageOptions;
|
2155
|
+
typedef struct google_protobuf_FieldOptions google_protobuf_FieldOptions;
|
2156
|
+
typedef struct google_protobuf_OneofOptions google_protobuf_OneofOptions;
|
2157
|
+
typedef struct google_protobuf_EnumOptions google_protobuf_EnumOptions;
|
2158
|
+
typedef struct google_protobuf_EnumValueOptions google_protobuf_EnumValueOptions;
|
2159
|
+
typedef struct google_protobuf_ServiceOptions google_protobuf_ServiceOptions;
|
2160
|
+
typedef struct google_protobuf_MethodOptions google_protobuf_MethodOptions;
|
2161
|
+
typedef struct google_protobuf_UninterpretedOption google_protobuf_UninterpretedOption;
|
2162
|
+
typedef struct google_protobuf_UninterpretedOption_NamePart google_protobuf_UninterpretedOption_NamePart;
|
2163
|
+
typedef struct google_protobuf_SourceCodeInfo google_protobuf_SourceCodeInfo;
|
2164
|
+
typedef struct google_protobuf_SourceCodeInfo_Location google_protobuf_SourceCodeInfo_Location;
|
2165
|
+
typedef struct google_protobuf_GeneratedCodeInfo google_protobuf_GeneratedCodeInfo;
|
2166
|
+
typedef struct google_protobuf_GeneratedCodeInfo_Annotation google_protobuf_GeneratedCodeInfo_Annotation;
|
2167
|
+
extern const upb_msglayout google_protobuf_FileDescriptorSet_msginit;
|
2168
|
+
extern const upb_msglayout google_protobuf_FileDescriptorProto_msginit;
|
2169
|
+
extern const upb_msglayout google_protobuf_DescriptorProto_msginit;
|
2170
|
+
extern const upb_msglayout google_protobuf_DescriptorProto_ExtensionRange_msginit;
|
2171
|
+
extern const upb_msglayout google_protobuf_DescriptorProto_ReservedRange_msginit;
|
2172
|
+
extern const upb_msglayout google_protobuf_ExtensionRangeOptions_msginit;
|
2173
|
+
extern const upb_msglayout google_protobuf_FieldDescriptorProto_msginit;
|
2174
|
+
extern const upb_msglayout google_protobuf_OneofDescriptorProto_msginit;
|
2175
|
+
extern const upb_msglayout google_protobuf_EnumDescriptorProto_msginit;
|
2176
|
+
extern const upb_msglayout google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit;
|
2177
|
+
extern const upb_msglayout google_protobuf_EnumValueDescriptorProto_msginit;
|
2178
|
+
extern const upb_msglayout google_protobuf_ServiceDescriptorProto_msginit;
|
2179
|
+
extern const upb_msglayout google_protobuf_MethodDescriptorProto_msginit;
|
2180
|
+
extern const upb_msglayout google_protobuf_FileOptions_msginit;
|
2181
|
+
extern const upb_msglayout google_protobuf_MessageOptions_msginit;
|
2182
|
+
extern const upb_msglayout google_protobuf_FieldOptions_msginit;
|
2183
|
+
extern const upb_msglayout google_protobuf_OneofOptions_msginit;
|
2184
|
+
extern const upb_msglayout google_protobuf_EnumOptions_msginit;
|
2185
|
+
extern const upb_msglayout google_protobuf_EnumValueOptions_msginit;
|
2186
|
+
extern const upb_msglayout google_protobuf_ServiceOptions_msginit;
|
2187
|
+
extern const upb_msglayout google_protobuf_MethodOptions_msginit;
|
2188
|
+
extern const upb_msglayout google_protobuf_UninterpretedOption_msginit;
|
2189
|
+
extern const upb_msglayout google_protobuf_UninterpretedOption_NamePart_msginit;
|
2190
|
+
extern const upb_msglayout google_protobuf_SourceCodeInfo_msginit;
|
2191
|
+
extern const upb_msglayout google_protobuf_SourceCodeInfo_Location_msginit;
|
2192
|
+
extern const upb_msglayout google_protobuf_GeneratedCodeInfo_msginit;
|
2193
|
+
extern const upb_msglayout google_protobuf_GeneratedCodeInfo_Annotation_msginit;
|
2194
|
+
|
2195
|
+
typedef enum {
|
2196
|
+
google_protobuf_FieldDescriptorProto_LABEL_OPTIONAL = 1,
|
2197
|
+
google_protobuf_FieldDescriptorProto_LABEL_REQUIRED = 2,
|
2198
|
+
google_protobuf_FieldDescriptorProto_LABEL_REPEATED = 3
|
2199
|
+
} google_protobuf_FieldDescriptorProto_Label;
|
2200
|
+
|
2201
|
+
typedef enum {
|
2202
|
+
google_protobuf_FieldDescriptorProto_TYPE_DOUBLE = 1,
|
2203
|
+
google_protobuf_FieldDescriptorProto_TYPE_FLOAT = 2,
|
2204
|
+
google_protobuf_FieldDescriptorProto_TYPE_INT64 = 3,
|
2205
|
+
google_protobuf_FieldDescriptorProto_TYPE_UINT64 = 4,
|
2206
|
+
google_protobuf_FieldDescriptorProto_TYPE_INT32 = 5,
|
2207
|
+
google_protobuf_FieldDescriptorProto_TYPE_FIXED64 = 6,
|
2208
|
+
google_protobuf_FieldDescriptorProto_TYPE_FIXED32 = 7,
|
2209
|
+
google_protobuf_FieldDescriptorProto_TYPE_BOOL = 8,
|
2210
|
+
google_protobuf_FieldDescriptorProto_TYPE_STRING = 9,
|
2211
|
+
google_protobuf_FieldDescriptorProto_TYPE_GROUP = 10,
|
2212
|
+
google_protobuf_FieldDescriptorProto_TYPE_MESSAGE = 11,
|
2213
|
+
google_protobuf_FieldDescriptorProto_TYPE_BYTES = 12,
|
2214
|
+
google_protobuf_FieldDescriptorProto_TYPE_UINT32 = 13,
|
2215
|
+
google_protobuf_FieldDescriptorProto_TYPE_ENUM = 14,
|
2216
|
+
google_protobuf_FieldDescriptorProto_TYPE_SFIXED32 = 15,
|
2217
|
+
google_protobuf_FieldDescriptorProto_TYPE_SFIXED64 = 16,
|
2218
|
+
google_protobuf_FieldDescriptorProto_TYPE_SINT32 = 17,
|
2219
|
+
google_protobuf_FieldDescriptorProto_TYPE_SINT64 = 18
|
2220
|
+
} google_protobuf_FieldDescriptorProto_Type;
|
2221
|
+
|
2222
|
+
typedef enum {
|
2223
|
+
google_protobuf_FieldOptions_STRING = 0,
|
2224
|
+
google_protobuf_FieldOptions_CORD = 1,
|
2225
|
+
google_protobuf_FieldOptions_STRING_PIECE = 2
|
2226
|
+
} google_protobuf_FieldOptions_CType;
|
2227
|
+
|
2228
|
+
typedef enum {
|
2229
|
+
google_protobuf_FieldOptions_JS_NORMAL = 0,
|
2230
|
+
google_protobuf_FieldOptions_JS_STRING = 1,
|
2231
|
+
google_protobuf_FieldOptions_JS_NUMBER = 2
|
2232
|
+
} google_protobuf_FieldOptions_JSType;
|
2233
|
+
|
2234
|
+
typedef enum {
|
2235
|
+
google_protobuf_FileOptions_SPEED = 1,
|
2236
|
+
google_protobuf_FileOptions_CODE_SIZE = 2,
|
2237
|
+
google_protobuf_FileOptions_LITE_RUNTIME = 3
|
2238
|
+
} google_protobuf_FileOptions_OptimizeMode;
|
2239
|
+
|
2240
|
+
typedef enum {
|
2241
|
+
google_protobuf_MethodOptions_IDEMPOTENCY_UNKNOWN = 0,
|
2242
|
+
google_protobuf_MethodOptions_NO_SIDE_EFFECTS = 1,
|
2243
|
+
google_protobuf_MethodOptions_IDEMPOTENT = 2
|
2244
|
+
} google_protobuf_MethodOptions_IdempotencyLevel;
|
2245
|
+
|
2246
|
+
|
2247
|
+
/* google.protobuf.FileDescriptorSet */
|
2248
|
+
|
2249
|
+
UPB_INLINE google_protobuf_FileDescriptorSet *google_protobuf_FileDescriptorSet_new(upb_arena *arena) {
|
2250
|
+
return (google_protobuf_FileDescriptorSet *)_upb_msg_new(&google_protobuf_FileDescriptorSet_msginit, arena);
|
2251
|
+
}
|
2252
|
+
UPB_INLINE google_protobuf_FileDescriptorSet *google_protobuf_FileDescriptorSet_parse(const char *buf, size_t size,
|
2253
|
+
upb_arena *arena) {
|
2254
|
+
google_protobuf_FileDescriptorSet *ret = google_protobuf_FileDescriptorSet_new(arena);
|
2255
|
+
if (!ret) return NULL;
|
2256
|
+
if (!upb_decode(buf, size, ret, &google_protobuf_FileDescriptorSet_msginit, arena)) return NULL;
|
2257
|
+
return ret;
|
2258
|
+
}
|
2259
|
+
UPB_INLINE google_protobuf_FileDescriptorSet *google_protobuf_FileDescriptorSet_parse_ex(const char *buf, size_t size,
|
2260
|
+
const upb_extreg *extreg, int options,
|
2261
|
+
upb_arena *arena) {
|
2262
|
+
google_protobuf_FileDescriptorSet *ret = google_protobuf_FileDescriptorSet_new(arena);
|
2263
|
+
if (!ret) return NULL;
|
2264
|
+
if (!_upb_decode(buf, size, ret, &google_protobuf_FileDescriptorSet_msginit, extreg, options, arena)) {
|
2265
|
+
return NULL;
|
2266
|
+
}
|
2267
|
+
return ret;
|
2268
|
+
}
|
2269
|
+
UPB_INLINE char *google_protobuf_FileDescriptorSet_serialize(const google_protobuf_FileDescriptorSet *msg, upb_arena *arena, size_t *len) {
|
2270
|
+
return upb_encode(msg, &google_protobuf_FileDescriptorSet_msginit, arena, len);
|
2271
|
+
}
|
2272
|
+
|
2273
|
+
UPB_INLINE bool google_protobuf_FileDescriptorSet_has_file(const google_protobuf_FileDescriptorSet *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(0, 0)); }
|
2274
|
+
UPB_INLINE const google_protobuf_FileDescriptorProto* const* google_protobuf_FileDescriptorSet_file(const google_protobuf_FileDescriptorSet *msg, size_t *len) { return (const google_protobuf_FileDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(0, 0), len); }
|
2275
|
+
|
2276
|
+
UPB_INLINE google_protobuf_FileDescriptorProto** google_protobuf_FileDescriptorSet_mutable_file(google_protobuf_FileDescriptorSet *msg, size_t *len) {
|
2277
|
+
return (google_protobuf_FileDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(0, 0), len);
|
2278
|
+
}
|
2279
|
+
UPB_INLINE google_protobuf_FileDescriptorProto** google_protobuf_FileDescriptorSet_resize_file(google_protobuf_FileDescriptorSet *msg, size_t len, upb_arena *arena) {
|
2280
|
+
return (google_protobuf_FileDescriptorProto**)_upb_array_resize_accessor2(msg, UPB_SIZE(0, 0), len, UPB_SIZE(2, 3), arena);
|
2281
|
+
}
|
2282
|
+
UPB_INLINE struct google_protobuf_FileDescriptorProto* google_protobuf_FileDescriptorSet_add_file(google_protobuf_FileDescriptorSet *msg, upb_arena *arena) {
|
2283
|
+
struct google_protobuf_FileDescriptorProto* sub = (struct google_protobuf_FileDescriptorProto*)_upb_msg_new(&google_protobuf_FileDescriptorProto_msginit, arena);
|
2284
|
+
bool ok = _upb_array_append_accessor2(
|
2285
|
+
msg, UPB_SIZE(0, 0), UPB_SIZE(2, 3), &sub, arena);
|
2286
|
+
if (!ok) return NULL;
|
2287
|
+
return sub;
|
2288
|
+
}
|
2289
|
+
|
2290
|
+
/* google.protobuf.FileDescriptorProto */
|
2291
|
+
|
2292
|
+
UPB_INLINE google_protobuf_FileDescriptorProto *google_protobuf_FileDescriptorProto_new(upb_arena *arena) {
|
2293
|
+
return (google_protobuf_FileDescriptorProto *)_upb_msg_new(&google_protobuf_FileDescriptorProto_msginit, arena);
|
2294
|
+
}
|
2295
|
+
UPB_INLINE google_protobuf_FileDescriptorProto *google_protobuf_FileDescriptorProto_parse(const char *buf, size_t size,
|
2296
|
+
upb_arena *arena) {
|
2297
|
+
google_protobuf_FileDescriptorProto *ret = google_protobuf_FileDescriptorProto_new(arena);
|
2298
|
+
if (!ret) return NULL;
|
2299
|
+
if (!upb_decode(buf, size, ret, &google_protobuf_FileDescriptorProto_msginit, arena)) return NULL;
|
2300
|
+
return ret;
|
2301
|
+
}
|
2302
|
+
UPB_INLINE google_protobuf_FileDescriptorProto *google_protobuf_FileDescriptorProto_parse_ex(const char *buf, size_t size,
|
2303
|
+
const upb_extreg *extreg, int options,
|
2304
|
+
upb_arena *arena) {
|
2305
|
+
google_protobuf_FileDescriptorProto *ret = google_protobuf_FileDescriptorProto_new(arena);
|
2306
|
+
if (!ret) return NULL;
|
2307
|
+
if (!_upb_decode(buf, size, ret, &google_protobuf_FileDescriptorProto_msginit, extreg, options, arena)) {
|
2308
|
+
return NULL;
|
2309
|
+
}
|
2310
|
+
return ret;
|
2311
|
+
}
|
2312
|
+
UPB_INLINE char *google_protobuf_FileDescriptorProto_serialize(const google_protobuf_FileDescriptorProto *msg, upb_arena *arena, size_t *len) {
|
2313
|
+
return upb_encode(msg, &google_protobuf_FileDescriptorProto_msginit, arena, len);
|
2314
|
+
}
|
2315
|
+
|
2316
|
+
UPB_INLINE bool google_protobuf_FileDescriptorProto_has_name(const google_protobuf_FileDescriptorProto *msg) { return _upb_hasbit(msg, 1); }
|
2317
|
+
UPB_INLINE upb_strview google_protobuf_FileDescriptorProto_name(const google_protobuf_FileDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(4, 8), upb_strview); }
|
2318
|
+
UPB_INLINE bool google_protobuf_FileDescriptorProto_has_package(const google_protobuf_FileDescriptorProto *msg) { return _upb_hasbit(msg, 2); }
|
2319
|
+
UPB_INLINE upb_strview google_protobuf_FileDescriptorProto_package(const google_protobuf_FileDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(12, 24), upb_strview); }
|
2320
|
+
UPB_INLINE upb_strview const* google_protobuf_FileDescriptorProto_dependency(const google_protobuf_FileDescriptorProto *msg, size_t *len) { return (upb_strview const*)_upb_array_accessor(msg, UPB_SIZE(36, 72), len); }
|
2321
|
+
UPB_INLINE bool google_protobuf_FileDescriptorProto_has_message_type(const google_protobuf_FileDescriptorProto *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(40, 80)); }
|
2322
|
+
UPB_INLINE const google_protobuf_DescriptorProto* const* google_protobuf_FileDescriptorProto_message_type(const google_protobuf_FileDescriptorProto *msg, size_t *len) { return (const google_protobuf_DescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(40, 80), len); }
|
2323
|
+
UPB_INLINE bool google_protobuf_FileDescriptorProto_has_enum_type(const google_protobuf_FileDescriptorProto *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(44, 88)); }
|
2324
|
+
UPB_INLINE const google_protobuf_EnumDescriptorProto* const* google_protobuf_FileDescriptorProto_enum_type(const google_protobuf_FileDescriptorProto *msg, size_t *len) { return (const google_protobuf_EnumDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(44, 88), len); }
|
2325
|
+
UPB_INLINE bool google_protobuf_FileDescriptorProto_has_service(const google_protobuf_FileDescriptorProto *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(48, 96)); }
|
2326
|
+
UPB_INLINE const google_protobuf_ServiceDescriptorProto* const* google_protobuf_FileDescriptorProto_service(const google_protobuf_FileDescriptorProto *msg, size_t *len) { return (const google_protobuf_ServiceDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(48, 96), len); }
|
2327
|
+
UPB_INLINE bool google_protobuf_FileDescriptorProto_has_extension(const google_protobuf_FileDescriptorProto *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(52, 104)); }
|
2328
|
+
UPB_INLINE const google_protobuf_FieldDescriptorProto* const* google_protobuf_FileDescriptorProto_extension(const google_protobuf_FileDescriptorProto *msg, size_t *len) { return (const google_protobuf_FieldDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(52, 104), len); }
|
2329
|
+
UPB_INLINE bool google_protobuf_FileDescriptorProto_has_options(const google_protobuf_FileDescriptorProto *msg) { return _upb_hasbit(msg, 3); }
|
2330
|
+
UPB_INLINE const google_protobuf_FileOptions* google_protobuf_FileDescriptorProto_options(const google_protobuf_FileDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(28, 56), const google_protobuf_FileOptions*); }
|
2331
|
+
UPB_INLINE bool google_protobuf_FileDescriptorProto_has_source_code_info(const google_protobuf_FileDescriptorProto *msg) { return _upb_hasbit(msg, 4); }
|
2332
|
+
UPB_INLINE const google_protobuf_SourceCodeInfo* google_protobuf_FileDescriptorProto_source_code_info(const google_protobuf_FileDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(32, 64), const google_protobuf_SourceCodeInfo*); }
|
2333
|
+
UPB_INLINE int32_t const* google_protobuf_FileDescriptorProto_public_dependency(const google_protobuf_FileDescriptorProto *msg, size_t *len) { return (int32_t const*)_upb_array_accessor(msg, UPB_SIZE(56, 112), len); }
|
2334
|
+
UPB_INLINE int32_t const* google_protobuf_FileDescriptorProto_weak_dependency(const google_protobuf_FileDescriptorProto *msg, size_t *len) { return (int32_t const*)_upb_array_accessor(msg, UPB_SIZE(60, 120), len); }
|
2335
|
+
UPB_INLINE bool google_protobuf_FileDescriptorProto_has_syntax(const google_protobuf_FileDescriptorProto *msg) { return _upb_hasbit(msg, 5); }
|
2336
|
+
UPB_INLINE upb_strview google_protobuf_FileDescriptorProto_syntax(const google_protobuf_FileDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(20, 40), upb_strview); }
|
2337
|
+
|
2338
|
+
UPB_INLINE void google_protobuf_FileDescriptorProto_set_name(google_protobuf_FileDescriptorProto *msg, upb_strview value) {
|
2339
|
+
_upb_sethas(msg, 1);
|
2340
|
+
*UPB_PTR_AT(msg, UPB_SIZE(4, 8), upb_strview) = value;
|
2341
|
+
}
|
2342
|
+
UPB_INLINE void google_protobuf_FileDescriptorProto_set_package(google_protobuf_FileDescriptorProto *msg, upb_strview value) {
|
2343
|
+
_upb_sethas(msg, 2);
|
2344
|
+
*UPB_PTR_AT(msg, UPB_SIZE(12, 24), upb_strview) = value;
|
2345
|
+
}
|
2346
|
+
UPB_INLINE upb_strview* google_protobuf_FileDescriptorProto_mutable_dependency(google_protobuf_FileDescriptorProto *msg, size_t *len) {
|
2347
|
+
return (upb_strview*)_upb_array_mutable_accessor(msg, UPB_SIZE(36, 72), len);
|
2348
|
+
}
|
2349
|
+
UPB_INLINE upb_strview* google_protobuf_FileDescriptorProto_resize_dependency(google_protobuf_FileDescriptorProto *msg, size_t len, upb_arena *arena) {
|
2350
|
+
return (upb_strview*)_upb_array_resize_accessor2(msg, UPB_SIZE(36, 72), len, UPB_SIZE(3, 4), arena);
|
2351
|
+
}
|
2352
|
+
UPB_INLINE bool google_protobuf_FileDescriptorProto_add_dependency(google_protobuf_FileDescriptorProto *msg, upb_strview val, upb_arena *arena) {
|
2353
|
+
return _upb_array_append_accessor2(msg, UPB_SIZE(36, 72), UPB_SIZE(3, 4), &val,
|
2354
|
+
arena);
|
2355
|
+
}
|
2356
|
+
UPB_INLINE google_protobuf_DescriptorProto** google_protobuf_FileDescriptorProto_mutable_message_type(google_protobuf_FileDescriptorProto *msg, size_t *len) {
|
2357
|
+
return (google_protobuf_DescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(40, 80), len);
|
2358
|
+
}
|
2359
|
+
UPB_INLINE google_protobuf_DescriptorProto** google_protobuf_FileDescriptorProto_resize_message_type(google_protobuf_FileDescriptorProto *msg, size_t len, upb_arena *arena) {
|
2360
|
+
return (google_protobuf_DescriptorProto**)_upb_array_resize_accessor2(msg, UPB_SIZE(40, 80), len, UPB_SIZE(2, 3), arena);
|
2361
|
+
}
|
2362
|
+
UPB_INLINE struct google_protobuf_DescriptorProto* google_protobuf_FileDescriptorProto_add_message_type(google_protobuf_FileDescriptorProto *msg, upb_arena *arena) {
|
2363
|
+
struct google_protobuf_DescriptorProto* sub = (struct google_protobuf_DescriptorProto*)_upb_msg_new(&google_protobuf_DescriptorProto_msginit, arena);
|
2364
|
+
bool ok = _upb_array_append_accessor2(
|
2365
|
+
msg, UPB_SIZE(40, 80), UPB_SIZE(2, 3), &sub, arena);
|
2366
|
+
if (!ok) return NULL;
|
2367
|
+
return sub;
|
2368
|
+
}
|
2369
|
+
UPB_INLINE google_protobuf_EnumDescriptorProto** google_protobuf_FileDescriptorProto_mutable_enum_type(google_protobuf_FileDescriptorProto *msg, size_t *len) {
|
2370
|
+
return (google_protobuf_EnumDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(44, 88), len);
|
2371
|
+
}
|
2372
|
+
UPB_INLINE google_protobuf_EnumDescriptorProto** google_protobuf_FileDescriptorProto_resize_enum_type(google_protobuf_FileDescriptorProto *msg, size_t len, upb_arena *arena) {
|
2373
|
+
return (google_protobuf_EnumDescriptorProto**)_upb_array_resize_accessor2(msg, UPB_SIZE(44, 88), len, UPB_SIZE(2, 3), arena);
|
2374
|
+
}
|
2375
|
+
UPB_INLINE struct google_protobuf_EnumDescriptorProto* google_protobuf_FileDescriptorProto_add_enum_type(google_protobuf_FileDescriptorProto *msg, upb_arena *arena) {
|
2376
|
+
struct google_protobuf_EnumDescriptorProto* sub = (struct google_protobuf_EnumDescriptorProto*)_upb_msg_new(&google_protobuf_EnumDescriptorProto_msginit, arena);
|
2377
|
+
bool ok = _upb_array_append_accessor2(
|
2378
|
+
msg, UPB_SIZE(44, 88), UPB_SIZE(2, 3), &sub, arena);
|
2379
|
+
if (!ok) return NULL;
|
2380
|
+
return sub;
|
2381
|
+
}
|
2382
|
+
UPB_INLINE google_protobuf_ServiceDescriptorProto** google_protobuf_FileDescriptorProto_mutable_service(google_protobuf_FileDescriptorProto *msg, size_t *len) {
|
2383
|
+
return (google_protobuf_ServiceDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(48, 96), len);
|
2384
|
+
}
|
2385
|
+
UPB_INLINE google_protobuf_ServiceDescriptorProto** google_protobuf_FileDescriptorProto_resize_service(google_protobuf_FileDescriptorProto *msg, size_t len, upb_arena *arena) {
|
2386
|
+
return (google_protobuf_ServiceDescriptorProto**)_upb_array_resize_accessor2(msg, UPB_SIZE(48, 96), len, UPB_SIZE(2, 3), arena);
|
2387
|
+
}
|
2388
|
+
UPB_INLINE struct google_protobuf_ServiceDescriptorProto* google_protobuf_FileDescriptorProto_add_service(google_protobuf_FileDescriptorProto *msg, upb_arena *arena) {
|
2389
|
+
struct google_protobuf_ServiceDescriptorProto* sub = (struct google_protobuf_ServiceDescriptorProto*)_upb_msg_new(&google_protobuf_ServiceDescriptorProto_msginit, arena);
|
2390
|
+
bool ok = _upb_array_append_accessor2(
|
2391
|
+
msg, UPB_SIZE(48, 96), UPB_SIZE(2, 3), &sub, arena);
|
2392
|
+
if (!ok) return NULL;
|
2393
|
+
return sub;
|
2394
|
+
}
|
2395
|
+
UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_FileDescriptorProto_mutable_extension(google_protobuf_FileDescriptorProto *msg, size_t *len) {
|
2396
|
+
return (google_protobuf_FieldDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(52, 104), len);
|
2397
|
+
}
|
2398
|
+
UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_FileDescriptorProto_resize_extension(google_protobuf_FileDescriptorProto *msg, size_t len, upb_arena *arena) {
|
2399
|
+
return (google_protobuf_FieldDescriptorProto**)_upb_array_resize_accessor2(msg, UPB_SIZE(52, 104), len, UPB_SIZE(2, 3), arena);
|
2400
|
+
}
|
2401
|
+
UPB_INLINE struct google_protobuf_FieldDescriptorProto* google_protobuf_FileDescriptorProto_add_extension(google_protobuf_FileDescriptorProto *msg, upb_arena *arena) {
|
2402
|
+
struct google_protobuf_FieldDescriptorProto* sub = (struct google_protobuf_FieldDescriptorProto*)_upb_msg_new(&google_protobuf_FieldDescriptorProto_msginit, arena);
|
2403
|
+
bool ok = _upb_array_append_accessor2(
|
2404
|
+
msg, UPB_SIZE(52, 104), UPB_SIZE(2, 3), &sub, arena);
|
2405
|
+
if (!ok) return NULL;
|
2406
|
+
return sub;
|
2407
|
+
}
|
2408
|
+
UPB_INLINE void google_protobuf_FileDescriptorProto_set_options(google_protobuf_FileDescriptorProto *msg, google_protobuf_FileOptions* value) {
|
2409
|
+
_upb_sethas(msg, 3);
|
2410
|
+
*UPB_PTR_AT(msg, UPB_SIZE(28, 56), google_protobuf_FileOptions*) = value;
|
2411
|
+
}
|
2412
|
+
UPB_INLINE struct google_protobuf_FileOptions* google_protobuf_FileDescriptorProto_mutable_options(google_protobuf_FileDescriptorProto *msg, upb_arena *arena) {
|
2413
|
+
struct google_protobuf_FileOptions* sub = (struct google_protobuf_FileOptions*)google_protobuf_FileDescriptorProto_options(msg);
|
2414
|
+
if (sub == NULL) {
|
2415
|
+
sub = (struct google_protobuf_FileOptions*)_upb_msg_new(&google_protobuf_FileOptions_msginit, arena);
|
2416
|
+
if (!sub) return NULL;
|
2417
|
+
google_protobuf_FileDescriptorProto_set_options(msg, sub);
|
2418
|
+
}
|
2419
|
+
return sub;
|
2420
|
+
}
|
2421
|
+
UPB_INLINE void google_protobuf_FileDescriptorProto_set_source_code_info(google_protobuf_FileDescriptorProto *msg, google_protobuf_SourceCodeInfo* value) {
|
2422
|
+
_upb_sethas(msg, 4);
|
2423
|
+
*UPB_PTR_AT(msg, UPB_SIZE(32, 64), google_protobuf_SourceCodeInfo*) = value;
|
2424
|
+
}
|
2425
|
+
UPB_INLINE struct google_protobuf_SourceCodeInfo* google_protobuf_FileDescriptorProto_mutable_source_code_info(google_protobuf_FileDescriptorProto *msg, upb_arena *arena) {
|
2426
|
+
struct google_protobuf_SourceCodeInfo* sub = (struct google_protobuf_SourceCodeInfo*)google_protobuf_FileDescriptorProto_source_code_info(msg);
|
2427
|
+
if (sub == NULL) {
|
2428
|
+
sub = (struct google_protobuf_SourceCodeInfo*)_upb_msg_new(&google_protobuf_SourceCodeInfo_msginit, arena);
|
2429
|
+
if (!sub) return NULL;
|
2430
|
+
google_protobuf_FileDescriptorProto_set_source_code_info(msg, sub);
|
2431
|
+
}
|
2432
|
+
return sub;
|
2433
|
+
}
|
2434
|
+
UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_mutable_public_dependency(google_protobuf_FileDescriptorProto *msg, size_t *len) {
|
2435
|
+
return (int32_t*)_upb_array_mutable_accessor(msg, UPB_SIZE(56, 112), len);
|
2436
|
+
}
|
2437
|
+
UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_resize_public_dependency(google_protobuf_FileDescriptorProto *msg, size_t len, upb_arena *arena) {
|
2438
|
+
return (int32_t*)_upb_array_resize_accessor2(msg, UPB_SIZE(56, 112), len, 2, arena);
|
2439
|
+
}
|
2440
|
+
UPB_INLINE bool google_protobuf_FileDescriptorProto_add_public_dependency(google_protobuf_FileDescriptorProto *msg, int32_t val, upb_arena *arena) {
|
2441
|
+
return _upb_array_append_accessor2(msg, UPB_SIZE(56, 112), 2, &val,
|
2442
|
+
arena);
|
2443
|
+
}
|
2444
|
+
UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_mutable_weak_dependency(google_protobuf_FileDescriptorProto *msg, size_t *len) {
|
2445
|
+
return (int32_t*)_upb_array_mutable_accessor(msg, UPB_SIZE(60, 120), len);
|
2446
|
+
}
|
2447
|
+
UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_resize_weak_dependency(google_protobuf_FileDescriptorProto *msg, size_t len, upb_arena *arena) {
|
2448
|
+
return (int32_t*)_upb_array_resize_accessor2(msg, UPB_SIZE(60, 120), len, 2, arena);
|
2449
|
+
}
|
2450
|
+
UPB_INLINE bool google_protobuf_FileDescriptorProto_add_weak_dependency(google_protobuf_FileDescriptorProto *msg, int32_t val, upb_arena *arena) {
|
2451
|
+
return _upb_array_append_accessor2(msg, UPB_SIZE(60, 120), 2, &val,
|
2452
|
+
arena);
|
2453
|
+
}
|
2454
|
+
UPB_INLINE void google_protobuf_FileDescriptorProto_set_syntax(google_protobuf_FileDescriptorProto *msg, upb_strview value) {
|
2455
|
+
_upb_sethas(msg, 5);
|
2456
|
+
*UPB_PTR_AT(msg, UPB_SIZE(20, 40), upb_strview) = value;
|
2457
|
+
}
|
2458
|
+
|
2459
|
+
/* google.protobuf.DescriptorProto */
|
2460
|
+
|
2461
|
+
UPB_INLINE google_protobuf_DescriptorProto *google_protobuf_DescriptorProto_new(upb_arena *arena) {
|
2462
|
+
return (google_protobuf_DescriptorProto *)_upb_msg_new(&google_protobuf_DescriptorProto_msginit, arena);
|
2463
|
+
}
|
2464
|
+
UPB_INLINE google_protobuf_DescriptorProto *google_protobuf_DescriptorProto_parse(const char *buf, size_t size,
|
2465
|
+
upb_arena *arena) {
|
2466
|
+
google_protobuf_DescriptorProto *ret = google_protobuf_DescriptorProto_new(arena);
|
2467
|
+
if (!ret) return NULL;
|
2468
|
+
if (!upb_decode(buf, size, ret, &google_protobuf_DescriptorProto_msginit, arena)) return NULL;
|
2469
|
+
return ret;
|
2470
|
+
}
|
2471
|
+
UPB_INLINE google_protobuf_DescriptorProto *google_protobuf_DescriptorProto_parse_ex(const char *buf, size_t size,
|
2472
|
+
const upb_extreg *extreg, int options,
|
2473
|
+
upb_arena *arena) {
|
2474
|
+
google_protobuf_DescriptorProto *ret = google_protobuf_DescriptorProto_new(arena);
|
2475
|
+
if (!ret) return NULL;
|
2476
|
+
if (!_upb_decode(buf, size, ret, &google_protobuf_DescriptorProto_msginit, extreg, options, arena)) {
|
2477
|
+
return NULL;
|
2478
|
+
}
|
2479
|
+
return ret;
|
2480
|
+
}
|
2481
|
+
UPB_INLINE char *google_protobuf_DescriptorProto_serialize(const google_protobuf_DescriptorProto *msg, upb_arena *arena, size_t *len) {
|
2482
|
+
return upb_encode(msg, &google_protobuf_DescriptorProto_msginit, arena, len);
|
2483
|
+
}
|
2484
|
+
|
2485
|
+
UPB_INLINE bool google_protobuf_DescriptorProto_has_name(const google_protobuf_DescriptorProto *msg) { return _upb_hasbit(msg, 1); }
|
2486
|
+
UPB_INLINE upb_strview google_protobuf_DescriptorProto_name(const google_protobuf_DescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(4, 8), upb_strview); }
|
2487
|
+
UPB_INLINE bool google_protobuf_DescriptorProto_has_field(const google_protobuf_DescriptorProto *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(16, 32)); }
|
2488
|
+
UPB_INLINE const google_protobuf_FieldDescriptorProto* const* google_protobuf_DescriptorProto_field(const google_protobuf_DescriptorProto *msg, size_t *len) { return (const google_protobuf_FieldDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(16, 32), len); }
|
2489
|
+
UPB_INLINE bool google_protobuf_DescriptorProto_has_nested_type(const google_protobuf_DescriptorProto *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(20, 40)); }
|
2490
|
+
UPB_INLINE const google_protobuf_DescriptorProto* const* google_protobuf_DescriptorProto_nested_type(const google_protobuf_DescriptorProto *msg, size_t *len) { return (const google_protobuf_DescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(20, 40), len); }
|
2491
|
+
UPB_INLINE bool google_protobuf_DescriptorProto_has_enum_type(const google_protobuf_DescriptorProto *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(24, 48)); }
|
2492
|
+
UPB_INLINE const google_protobuf_EnumDescriptorProto* const* google_protobuf_DescriptorProto_enum_type(const google_protobuf_DescriptorProto *msg, size_t *len) { return (const google_protobuf_EnumDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(24, 48), len); }
|
2493
|
+
UPB_INLINE bool google_protobuf_DescriptorProto_has_extension_range(const google_protobuf_DescriptorProto *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(28, 56)); }
|
2494
|
+
UPB_INLINE const google_protobuf_DescriptorProto_ExtensionRange* const* google_protobuf_DescriptorProto_extension_range(const google_protobuf_DescriptorProto *msg, size_t *len) { return (const google_protobuf_DescriptorProto_ExtensionRange* const*)_upb_array_accessor(msg, UPB_SIZE(28, 56), len); }
|
2495
|
+
UPB_INLINE bool google_protobuf_DescriptorProto_has_extension(const google_protobuf_DescriptorProto *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(32, 64)); }
|
2496
|
+
UPB_INLINE const google_protobuf_FieldDescriptorProto* const* google_protobuf_DescriptorProto_extension(const google_protobuf_DescriptorProto *msg, size_t *len) { return (const google_protobuf_FieldDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(32, 64), len); }
|
2497
|
+
UPB_INLINE bool google_protobuf_DescriptorProto_has_options(const google_protobuf_DescriptorProto *msg) { return _upb_hasbit(msg, 2); }
|
2498
|
+
UPB_INLINE const google_protobuf_MessageOptions* google_protobuf_DescriptorProto_options(const google_protobuf_DescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(12, 24), const google_protobuf_MessageOptions*); }
|
2499
|
+
UPB_INLINE bool google_protobuf_DescriptorProto_has_oneof_decl(const google_protobuf_DescriptorProto *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(36, 72)); }
|
2500
|
+
UPB_INLINE const google_protobuf_OneofDescriptorProto* const* google_protobuf_DescriptorProto_oneof_decl(const google_protobuf_DescriptorProto *msg, size_t *len) { return (const google_protobuf_OneofDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(36, 72), len); }
|
2501
|
+
UPB_INLINE bool google_protobuf_DescriptorProto_has_reserved_range(const google_protobuf_DescriptorProto *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(40, 80)); }
|
2502
|
+
UPB_INLINE const google_protobuf_DescriptorProto_ReservedRange* const* google_protobuf_DescriptorProto_reserved_range(const google_protobuf_DescriptorProto *msg, size_t *len) { return (const google_protobuf_DescriptorProto_ReservedRange* const*)_upb_array_accessor(msg, UPB_SIZE(40, 80), len); }
|
2503
|
+
UPB_INLINE upb_strview const* google_protobuf_DescriptorProto_reserved_name(const google_protobuf_DescriptorProto *msg, size_t *len) { return (upb_strview const*)_upb_array_accessor(msg, UPB_SIZE(44, 88), len); }
|
2504
|
+
|
2505
|
+
UPB_INLINE void google_protobuf_DescriptorProto_set_name(google_protobuf_DescriptorProto *msg, upb_strview value) {
|
2506
|
+
_upb_sethas(msg, 1);
|
2507
|
+
*UPB_PTR_AT(msg, UPB_SIZE(4, 8), upb_strview) = value;
|
2508
|
+
}
|
2509
|
+
UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_DescriptorProto_mutable_field(google_protobuf_DescriptorProto *msg, size_t *len) {
|
2510
|
+
return (google_protobuf_FieldDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(16, 32), len);
|
2511
|
+
}
|
2512
|
+
UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_DescriptorProto_resize_field(google_protobuf_DescriptorProto *msg, size_t len, upb_arena *arena) {
|
2513
|
+
return (google_protobuf_FieldDescriptorProto**)_upb_array_resize_accessor2(msg, UPB_SIZE(16, 32), len, UPB_SIZE(2, 3), arena);
|
2514
|
+
}
|
2515
|
+
UPB_INLINE struct google_protobuf_FieldDescriptorProto* google_protobuf_DescriptorProto_add_field(google_protobuf_DescriptorProto *msg, upb_arena *arena) {
|
2516
|
+
struct google_protobuf_FieldDescriptorProto* sub = (struct google_protobuf_FieldDescriptorProto*)_upb_msg_new(&google_protobuf_FieldDescriptorProto_msginit, arena);
|
2517
|
+
bool ok = _upb_array_append_accessor2(
|
2518
|
+
msg, UPB_SIZE(16, 32), UPB_SIZE(2, 3), &sub, arena);
|
2519
|
+
if (!ok) return NULL;
|
2520
|
+
return sub;
|
2521
|
+
}
|
2522
|
+
UPB_INLINE google_protobuf_DescriptorProto** google_protobuf_DescriptorProto_mutable_nested_type(google_protobuf_DescriptorProto *msg, size_t *len) {
|
2523
|
+
return (google_protobuf_DescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(20, 40), len);
|
2524
|
+
}
|
2525
|
+
UPB_INLINE google_protobuf_DescriptorProto** google_protobuf_DescriptorProto_resize_nested_type(google_protobuf_DescriptorProto *msg, size_t len, upb_arena *arena) {
|
2526
|
+
return (google_protobuf_DescriptorProto**)_upb_array_resize_accessor2(msg, UPB_SIZE(20, 40), len, UPB_SIZE(2, 3), arena);
|
2527
|
+
}
|
2528
|
+
UPB_INLINE struct google_protobuf_DescriptorProto* google_protobuf_DescriptorProto_add_nested_type(google_protobuf_DescriptorProto *msg, upb_arena *arena) {
|
2529
|
+
struct google_protobuf_DescriptorProto* sub = (struct google_protobuf_DescriptorProto*)_upb_msg_new(&google_protobuf_DescriptorProto_msginit, arena);
|
2530
|
+
bool ok = _upb_array_append_accessor2(
|
2531
|
+
msg, UPB_SIZE(20, 40), UPB_SIZE(2, 3), &sub, arena);
|
2532
|
+
if (!ok) return NULL;
|
2533
|
+
return sub;
|
2534
|
+
}
|
2535
|
+
UPB_INLINE google_protobuf_EnumDescriptorProto** google_protobuf_DescriptorProto_mutable_enum_type(google_protobuf_DescriptorProto *msg, size_t *len) {
|
2536
|
+
return (google_protobuf_EnumDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(24, 48), len);
|
2537
|
+
}
|
2538
|
+
UPB_INLINE google_protobuf_EnumDescriptorProto** google_protobuf_DescriptorProto_resize_enum_type(google_protobuf_DescriptorProto *msg, size_t len, upb_arena *arena) {
|
2539
|
+
return (google_protobuf_EnumDescriptorProto**)_upb_array_resize_accessor2(msg, UPB_SIZE(24, 48), len, UPB_SIZE(2, 3), arena);
|
2540
|
+
}
|
2541
|
+
UPB_INLINE struct google_protobuf_EnumDescriptorProto* google_protobuf_DescriptorProto_add_enum_type(google_protobuf_DescriptorProto *msg, upb_arena *arena) {
|
2542
|
+
struct google_protobuf_EnumDescriptorProto* sub = (struct google_protobuf_EnumDescriptorProto*)_upb_msg_new(&google_protobuf_EnumDescriptorProto_msginit, arena);
|
2543
|
+
bool ok = _upb_array_append_accessor2(
|
2544
|
+
msg, UPB_SIZE(24, 48), UPB_SIZE(2, 3), &sub, arena);
|
2545
|
+
if (!ok) return NULL;
|
2546
|
+
return sub;
|
2547
|
+
}
|
2548
|
+
UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange** google_protobuf_DescriptorProto_mutable_extension_range(google_protobuf_DescriptorProto *msg, size_t *len) {
|
2549
|
+
return (google_protobuf_DescriptorProto_ExtensionRange**)_upb_array_mutable_accessor(msg, UPB_SIZE(28, 56), len);
|
2550
|
+
}
|
2551
|
+
UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange** google_protobuf_DescriptorProto_resize_extension_range(google_protobuf_DescriptorProto *msg, size_t len, upb_arena *arena) {
|
2552
|
+
return (google_protobuf_DescriptorProto_ExtensionRange**)_upb_array_resize_accessor2(msg, UPB_SIZE(28, 56), len, UPB_SIZE(2, 3), arena);
|
2553
|
+
}
|
2554
|
+
UPB_INLINE struct google_protobuf_DescriptorProto_ExtensionRange* google_protobuf_DescriptorProto_add_extension_range(google_protobuf_DescriptorProto *msg, upb_arena *arena) {
|
2555
|
+
struct google_protobuf_DescriptorProto_ExtensionRange* sub = (struct google_protobuf_DescriptorProto_ExtensionRange*)_upb_msg_new(&google_protobuf_DescriptorProto_ExtensionRange_msginit, arena);
|
2556
|
+
bool ok = _upb_array_append_accessor2(
|
2557
|
+
msg, UPB_SIZE(28, 56), UPB_SIZE(2, 3), &sub, arena);
|
2558
|
+
if (!ok) return NULL;
|
2559
|
+
return sub;
|
2560
|
+
}
|
2561
|
+
UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_DescriptorProto_mutable_extension(google_protobuf_DescriptorProto *msg, size_t *len) {
|
2562
|
+
return (google_protobuf_FieldDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(32, 64), len);
|
2563
|
+
}
|
2564
|
+
UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_DescriptorProto_resize_extension(google_protobuf_DescriptorProto *msg, size_t len, upb_arena *arena) {
|
2565
|
+
return (google_protobuf_FieldDescriptorProto**)_upb_array_resize_accessor2(msg, UPB_SIZE(32, 64), len, UPB_SIZE(2, 3), arena);
|
2566
|
+
}
|
2567
|
+
UPB_INLINE struct google_protobuf_FieldDescriptorProto* google_protobuf_DescriptorProto_add_extension(google_protobuf_DescriptorProto *msg, upb_arena *arena) {
|
2568
|
+
struct google_protobuf_FieldDescriptorProto* sub = (struct google_protobuf_FieldDescriptorProto*)_upb_msg_new(&google_protobuf_FieldDescriptorProto_msginit, arena);
|
2569
|
+
bool ok = _upb_array_append_accessor2(
|
2570
|
+
msg, UPB_SIZE(32, 64), UPB_SIZE(2, 3), &sub, arena);
|
2571
|
+
if (!ok) return NULL;
|
2572
|
+
return sub;
|
2573
|
+
}
|
2574
|
+
UPB_INLINE void google_protobuf_DescriptorProto_set_options(google_protobuf_DescriptorProto *msg, google_protobuf_MessageOptions* value) {
|
2575
|
+
_upb_sethas(msg, 2);
|
2576
|
+
*UPB_PTR_AT(msg, UPB_SIZE(12, 24), google_protobuf_MessageOptions*) = value;
|
2577
|
+
}
|
2578
|
+
UPB_INLINE struct google_protobuf_MessageOptions* google_protobuf_DescriptorProto_mutable_options(google_protobuf_DescriptorProto *msg, upb_arena *arena) {
|
2579
|
+
struct google_protobuf_MessageOptions* sub = (struct google_protobuf_MessageOptions*)google_protobuf_DescriptorProto_options(msg);
|
2580
|
+
if (sub == NULL) {
|
2581
|
+
sub = (struct google_protobuf_MessageOptions*)_upb_msg_new(&google_protobuf_MessageOptions_msginit, arena);
|
2582
|
+
if (!sub) return NULL;
|
2583
|
+
google_protobuf_DescriptorProto_set_options(msg, sub);
|
2584
|
+
}
|
2585
|
+
return sub;
|
2586
|
+
}
|
2587
|
+
UPB_INLINE google_protobuf_OneofDescriptorProto** google_protobuf_DescriptorProto_mutable_oneof_decl(google_protobuf_DescriptorProto *msg, size_t *len) {
|
2588
|
+
return (google_protobuf_OneofDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(36, 72), len);
|
2589
|
+
}
|
2590
|
+
UPB_INLINE google_protobuf_OneofDescriptorProto** google_protobuf_DescriptorProto_resize_oneof_decl(google_protobuf_DescriptorProto *msg, size_t len, upb_arena *arena) {
|
2591
|
+
return (google_protobuf_OneofDescriptorProto**)_upb_array_resize_accessor2(msg, UPB_SIZE(36, 72), len, UPB_SIZE(2, 3), arena);
|
2592
|
+
}
|
2593
|
+
UPB_INLINE struct google_protobuf_OneofDescriptorProto* google_protobuf_DescriptorProto_add_oneof_decl(google_protobuf_DescriptorProto *msg, upb_arena *arena) {
|
2594
|
+
struct google_protobuf_OneofDescriptorProto* sub = (struct google_protobuf_OneofDescriptorProto*)_upb_msg_new(&google_protobuf_OneofDescriptorProto_msginit, arena);
|
2595
|
+
bool ok = _upb_array_append_accessor2(
|
2596
|
+
msg, UPB_SIZE(36, 72), UPB_SIZE(2, 3), &sub, arena);
|
2597
|
+
if (!ok) return NULL;
|
2598
|
+
return sub;
|
2599
|
+
}
|
2600
|
+
UPB_INLINE google_protobuf_DescriptorProto_ReservedRange** google_protobuf_DescriptorProto_mutable_reserved_range(google_protobuf_DescriptorProto *msg, size_t *len) {
|
2601
|
+
return (google_protobuf_DescriptorProto_ReservedRange**)_upb_array_mutable_accessor(msg, UPB_SIZE(40, 80), len);
|
2602
|
+
}
|
2603
|
+
UPB_INLINE google_protobuf_DescriptorProto_ReservedRange** google_protobuf_DescriptorProto_resize_reserved_range(google_protobuf_DescriptorProto *msg, size_t len, upb_arena *arena) {
|
2604
|
+
return (google_protobuf_DescriptorProto_ReservedRange**)_upb_array_resize_accessor2(msg, UPB_SIZE(40, 80), len, UPB_SIZE(2, 3), arena);
|
2605
|
+
}
|
2606
|
+
UPB_INLINE struct google_protobuf_DescriptorProto_ReservedRange* google_protobuf_DescriptorProto_add_reserved_range(google_protobuf_DescriptorProto *msg, upb_arena *arena) {
|
2607
|
+
struct google_protobuf_DescriptorProto_ReservedRange* sub = (struct google_protobuf_DescriptorProto_ReservedRange*)_upb_msg_new(&google_protobuf_DescriptorProto_ReservedRange_msginit, arena);
|
2608
|
+
bool ok = _upb_array_append_accessor2(
|
2609
|
+
msg, UPB_SIZE(40, 80), UPB_SIZE(2, 3), &sub, arena);
|
2610
|
+
if (!ok) return NULL;
|
2611
|
+
return sub;
|
2612
|
+
}
|
2613
|
+
UPB_INLINE upb_strview* google_protobuf_DescriptorProto_mutable_reserved_name(google_protobuf_DescriptorProto *msg, size_t *len) {
|
2614
|
+
return (upb_strview*)_upb_array_mutable_accessor(msg, UPB_SIZE(44, 88), len);
|
2615
|
+
}
|
2616
|
+
UPB_INLINE upb_strview* google_protobuf_DescriptorProto_resize_reserved_name(google_protobuf_DescriptorProto *msg, size_t len, upb_arena *arena) {
|
2617
|
+
return (upb_strview*)_upb_array_resize_accessor2(msg, UPB_SIZE(44, 88), len, UPB_SIZE(3, 4), arena);
|
2618
|
+
}
|
2619
|
+
UPB_INLINE bool google_protobuf_DescriptorProto_add_reserved_name(google_protobuf_DescriptorProto *msg, upb_strview val, upb_arena *arena) {
|
2620
|
+
return _upb_array_append_accessor2(msg, UPB_SIZE(44, 88), UPB_SIZE(3, 4), &val,
|
2621
|
+
arena);
|
2622
|
+
}
|
2623
|
+
|
2624
|
+
/* google.protobuf.DescriptorProto.ExtensionRange */
|
2625
|
+
|
2626
|
+
UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange *google_protobuf_DescriptorProto_ExtensionRange_new(upb_arena *arena) {
|
2627
|
+
return (google_protobuf_DescriptorProto_ExtensionRange *)_upb_msg_new(&google_protobuf_DescriptorProto_ExtensionRange_msginit, arena);
|
2628
|
+
}
|
2629
|
+
UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange *google_protobuf_DescriptorProto_ExtensionRange_parse(const char *buf, size_t size,
|
2630
|
+
upb_arena *arena) {
|
2631
|
+
google_protobuf_DescriptorProto_ExtensionRange *ret = google_protobuf_DescriptorProto_ExtensionRange_new(arena);
|
2632
|
+
if (!ret) return NULL;
|
2633
|
+
if (!upb_decode(buf, size, ret, &google_protobuf_DescriptorProto_ExtensionRange_msginit, arena)) return NULL;
|
2634
|
+
return ret;
|
2635
|
+
}
|
2636
|
+
UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange *google_protobuf_DescriptorProto_ExtensionRange_parse_ex(const char *buf, size_t size,
|
2637
|
+
const upb_extreg *extreg, int options,
|
2638
|
+
upb_arena *arena) {
|
2639
|
+
google_protobuf_DescriptorProto_ExtensionRange *ret = google_protobuf_DescriptorProto_ExtensionRange_new(arena);
|
2640
|
+
if (!ret) return NULL;
|
2641
|
+
if (!_upb_decode(buf, size, ret, &google_protobuf_DescriptorProto_ExtensionRange_msginit, extreg, options, arena)) {
|
2642
|
+
return NULL;
|
2643
|
+
}
|
2644
|
+
return ret;
|
2645
|
+
}
|
2646
|
+
UPB_INLINE char *google_protobuf_DescriptorProto_ExtensionRange_serialize(const google_protobuf_DescriptorProto_ExtensionRange *msg, upb_arena *arena, size_t *len) {
|
2647
|
+
return upb_encode(msg, &google_protobuf_DescriptorProto_ExtensionRange_msginit, arena, len);
|
2648
|
+
}
|
2649
|
+
|
2650
|
+
UPB_INLINE bool google_protobuf_DescriptorProto_ExtensionRange_has_start(const google_protobuf_DescriptorProto_ExtensionRange *msg) { return _upb_hasbit(msg, 1); }
|
2651
|
+
UPB_INLINE int32_t google_protobuf_DescriptorProto_ExtensionRange_start(const google_protobuf_DescriptorProto_ExtensionRange *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(4, 4), int32_t); }
|
2652
|
+
UPB_INLINE bool google_protobuf_DescriptorProto_ExtensionRange_has_end(const google_protobuf_DescriptorProto_ExtensionRange *msg) { return _upb_hasbit(msg, 2); }
|
2653
|
+
UPB_INLINE int32_t google_protobuf_DescriptorProto_ExtensionRange_end(const google_protobuf_DescriptorProto_ExtensionRange *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(8, 8), int32_t); }
|
2654
|
+
UPB_INLINE bool google_protobuf_DescriptorProto_ExtensionRange_has_options(const google_protobuf_DescriptorProto_ExtensionRange *msg) { return _upb_hasbit(msg, 3); }
|
2655
|
+
UPB_INLINE const google_protobuf_ExtensionRangeOptions* google_protobuf_DescriptorProto_ExtensionRange_options(const google_protobuf_DescriptorProto_ExtensionRange *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(12, 16), const google_protobuf_ExtensionRangeOptions*); }
|
2656
|
+
|
2657
|
+
UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_set_start(google_protobuf_DescriptorProto_ExtensionRange *msg, int32_t value) {
|
2658
|
+
_upb_sethas(msg, 1);
|
2659
|
+
*UPB_PTR_AT(msg, UPB_SIZE(4, 4), int32_t) = value;
|
2660
|
+
}
|
2661
|
+
UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_set_end(google_protobuf_DescriptorProto_ExtensionRange *msg, int32_t value) {
|
2662
|
+
_upb_sethas(msg, 2);
|
2663
|
+
*UPB_PTR_AT(msg, UPB_SIZE(8, 8), int32_t) = value;
|
2664
|
+
}
|
2665
|
+
UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_set_options(google_protobuf_DescriptorProto_ExtensionRange *msg, google_protobuf_ExtensionRangeOptions* value) {
|
2666
|
+
_upb_sethas(msg, 3);
|
2667
|
+
*UPB_PTR_AT(msg, UPB_SIZE(12, 16), google_protobuf_ExtensionRangeOptions*) = value;
|
2668
|
+
}
|
2669
|
+
UPB_INLINE struct google_protobuf_ExtensionRangeOptions* google_protobuf_DescriptorProto_ExtensionRange_mutable_options(google_protobuf_DescriptorProto_ExtensionRange *msg, upb_arena *arena) {
|
2670
|
+
struct google_protobuf_ExtensionRangeOptions* sub = (struct google_protobuf_ExtensionRangeOptions*)google_protobuf_DescriptorProto_ExtensionRange_options(msg);
|
2671
|
+
if (sub == NULL) {
|
2672
|
+
sub = (struct google_protobuf_ExtensionRangeOptions*)_upb_msg_new(&google_protobuf_ExtensionRangeOptions_msginit, arena);
|
2673
|
+
if (!sub) return NULL;
|
2674
|
+
google_protobuf_DescriptorProto_ExtensionRange_set_options(msg, sub);
|
2675
|
+
}
|
2676
|
+
return sub;
|
2677
|
+
}
|
2678
|
+
|
2679
|
+
/* google.protobuf.DescriptorProto.ReservedRange */
|
2680
|
+
|
2681
|
+
UPB_INLINE google_protobuf_DescriptorProto_ReservedRange *google_protobuf_DescriptorProto_ReservedRange_new(upb_arena *arena) {
|
2682
|
+
return (google_protobuf_DescriptorProto_ReservedRange *)_upb_msg_new(&google_protobuf_DescriptorProto_ReservedRange_msginit, arena);
|
2683
|
+
}
|
2684
|
+
UPB_INLINE google_protobuf_DescriptorProto_ReservedRange *google_protobuf_DescriptorProto_ReservedRange_parse(const char *buf, size_t size,
|
2685
|
+
upb_arena *arena) {
|
2686
|
+
google_protobuf_DescriptorProto_ReservedRange *ret = google_protobuf_DescriptorProto_ReservedRange_new(arena);
|
2687
|
+
if (!ret) return NULL;
|
2688
|
+
if (!upb_decode(buf, size, ret, &google_protobuf_DescriptorProto_ReservedRange_msginit, arena)) return NULL;
|
2689
|
+
return ret;
|
2690
|
+
}
|
2691
|
+
UPB_INLINE google_protobuf_DescriptorProto_ReservedRange *google_protobuf_DescriptorProto_ReservedRange_parse_ex(const char *buf, size_t size,
|
2692
|
+
const upb_extreg *extreg, int options,
|
2693
|
+
upb_arena *arena) {
|
2694
|
+
google_protobuf_DescriptorProto_ReservedRange *ret = google_protobuf_DescriptorProto_ReservedRange_new(arena);
|
2695
|
+
if (!ret) return NULL;
|
2696
|
+
if (!_upb_decode(buf, size, ret, &google_protobuf_DescriptorProto_ReservedRange_msginit, extreg, options, arena)) {
|
2697
|
+
return NULL;
|
2698
|
+
}
|
2699
|
+
return ret;
|
2700
|
+
}
|
2701
|
+
UPB_INLINE char *google_protobuf_DescriptorProto_ReservedRange_serialize(const google_protobuf_DescriptorProto_ReservedRange *msg, upb_arena *arena, size_t *len) {
|
2702
|
+
return upb_encode(msg, &google_protobuf_DescriptorProto_ReservedRange_msginit, arena, len);
|
2703
|
+
}
|
2704
|
+
|
2705
|
+
UPB_INLINE bool google_protobuf_DescriptorProto_ReservedRange_has_start(const google_protobuf_DescriptorProto_ReservedRange *msg) { return _upb_hasbit(msg, 1); }
|
2706
|
+
UPB_INLINE int32_t google_protobuf_DescriptorProto_ReservedRange_start(const google_protobuf_DescriptorProto_ReservedRange *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(4, 4), int32_t); }
|
2707
|
+
UPB_INLINE bool google_protobuf_DescriptorProto_ReservedRange_has_end(const google_protobuf_DescriptorProto_ReservedRange *msg) { return _upb_hasbit(msg, 2); }
|
2708
|
+
UPB_INLINE int32_t google_protobuf_DescriptorProto_ReservedRange_end(const google_protobuf_DescriptorProto_ReservedRange *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(8, 8), int32_t); }
|
2709
|
+
|
2710
|
+
UPB_INLINE void google_protobuf_DescriptorProto_ReservedRange_set_start(google_protobuf_DescriptorProto_ReservedRange *msg, int32_t value) {
|
2711
|
+
_upb_sethas(msg, 1);
|
2712
|
+
*UPB_PTR_AT(msg, UPB_SIZE(4, 4), int32_t) = value;
|
2713
|
+
}
|
2714
|
+
UPB_INLINE void google_protobuf_DescriptorProto_ReservedRange_set_end(google_protobuf_DescriptorProto_ReservedRange *msg, int32_t value) {
|
2715
|
+
_upb_sethas(msg, 2);
|
2716
|
+
*UPB_PTR_AT(msg, UPB_SIZE(8, 8), int32_t) = value;
|
2717
|
+
}
|
2718
|
+
|
2719
|
+
/* google.protobuf.ExtensionRangeOptions */
|
2720
|
+
|
2721
|
+
UPB_INLINE google_protobuf_ExtensionRangeOptions *google_protobuf_ExtensionRangeOptions_new(upb_arena *arena) {
|
2722
|
+
return (google_protobuf_ExtensionRangeOptions *)_upb_msg_new(&google_protobuf_ExtensionRangeOptions_msginit, arena);
|
2723
|
+
}
|
2724
|
+
UPB_INLINE google_protobuf_ExtensionRangeOptions *google_protobuf_ExtensionRangeOptions_parse(const char *buf, size_t size,
|
2725
|
+
upb_arena *arena) {
|
2726
|
+
google_protobuf_ExtensionRangeOptions *ret = google_protobuf_ExtensionRangeOptions_new(arena);
|
2727
|
+
if (!ret) return NULL;
|
2728
|
+
if (!upb_decode(buf, size, ret, &google_protobuf_ExtensionRangeOptions_msginit, arena)) return NULL;
|
2729
|
+
return ret;
|
2730
|
+
}
|
2731
|
+
UPB_INLINE google_protobuf_ExtensionRangeOptions *google_protobuf_ExtensionRangeOptions_parse_ex(const char *buf, size_t size,
|
2732
|
+
const upb_extreg *extreg, int options,
|
2733
|
+
upb_arena *arena) {
|
2734
|
+
google_protobuf_ExtensionRangeOptions *ret = google_protobuf_ExtensionRangeOptions_new(arena);
|
2735
|
+
if (!ret) return NULL;
|
2736
|
+
if (!_upb_decode(buf, size, ret, &google_protobuf_ExtensionRangeOptions_msginit, extreg, options, arena)) {
|
2737
|
+
return NULL;
|
2738
|
+
}
|
2739
|
+
return ret;
|
2740
|
+
}
|
2741
|
+
UPB_INLINE char *google_protobuf_ExtensionRangeOptions_serialize(const google_protobuf_ExtensionRangeOptions *msg, upb_arena *arena, size_t *len) {
|
2742
|
+
return upb_encode(msg, &google_protobuf_ExtensionRangeOptions_msginit, arena, len);
|
2743
|
+
}
|
2744
|
+
|
2745
|
+
UPB_INLINE bool google_protobuf_ExtensionRangeOptions_has_uninterpreted_option(const google_protobuf_ExtensionRangeOptions *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(0, 0)); }
|
2746
|
+
UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_ExtensionRangeOptions_uninterpreted_option(const google_protobuf_ExtensionRangeOptions *msg, size_t *len) { return (const google_protobuf_UninterpretedOption* const*)_upb_array_accessor(msg, UPB_SIZE(0, 0), len); }
|
2747
|
+
|
2748
|
+
UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_ExtensionRangeOptions_mutable_uninterpreted_option(google_protobuf_ExtensionRangeOptions *msg, size_t *len) {
|
2749
|
+
return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, UPB_SIZE(0, 0), len);
|
2750
|
+
}
|
2751
|
+
UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_ExtensionRangeOptions_resize_uninterpreted_option(google_protobuf_ExtensionRangeOptions *msg, size_t len, upb_arena *arena) {
|
2752
|
+
return (google_protobuf_UninterpretedOption**)_upb_array_resize_accessor2(msg, UPB_SIZE(0, 0), len, UPB_SIZE(2, 3), arena);
|
2753
|
+
}
|
2754
|
+
UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_ExtensionRangeOptions_add_uninterpreted_option(google_protobuf_ExtensionRangeOptions *msg, upb_arena *arena) {
|
2755
|
+
struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)_upb_msg_new(&google_protobuf_UninterpretedOption_msginit, arena);
|
2756
|
+
bool ok = _upb_array_append_accessor2(
|
2757
|
+
msg, UPB_SIZE(0, 0), UPB_SIZE(2, 3), &sub, arena);
|
2758
|
+
if (!ok) return NULL;
|
2759
|
+
return sub;
|
2760
|
+
}
|
2761
|
+
|
2762
|
+
/* google.protobuf.FieldDescriptorProto */
|
2763
|
+
|
2764
|
+
UPB_INLINE google_protobuf_FieldDescriptorProto *google_protobuf_FieldDescriptorProto_new(upb_arena *arena) {
|
2765
|
+
return (google_protobuf_FieldDescriptorProto *)_upb_msg_new(&google_protobuf_FieldDescriptorProto_msginit, arena);
|
2766
|
+
}
|
2767
|
+
UPB_INLINE google_protobuf_FieldDescriptorProto *google_protobuf_FieldDescriptorProto_parse(const char *buf, size_t size,
|
2768
|
+
upb_arena *arena) {
|
2769
|
+
google_protobuf_FieldDescriptorProto *ret = google_protobuf_FieldDescriptorProto_new(arena);
|
2770
|
+
if (!ret) return NULL;
|
2771
|
+
if (!upb_decode(buf, size, ret, &google_protobuf_FieldDescriptorProto_msginit, arena)) return NULL;
|
2772
|
+
return ret;
|
2773
|
+
}
|
2774
|
+
UPB_INLINE google_protobuf_FieldDescriptorProto *google_protobuf_FieldDescriptorProto_parse_ex(const char *buf, size_t size,
|
2775
|
+
const upb_extreg *extreg, int options,
|
2776
|
+
upb_arena *arena) {
|
2777
|
+
google_protobuf_FieldDescriptorProto *ret = google_protobuf_FieldDescriptorProto_new(arena);
|
2778
|
+
if (!ret) return NULL;
|
2779
|
+
if (!_upb_decode(buf, size, ret, &google_protobuf_FieldDescriptorProto_msginit, extreg, options, arena)) {
|
2780
|
+
return NULL;
|
2781
|
+
}
|
2782
|
+
return ret;
|
2783
|
+
}
|
2784
|
+
UPB_INLINE char *google_protobuf_FieldDescriptorProto_serialize(const google_protobuf_FieldDescriptorProto *msg, upb_arena *arena, size_t *len) {
|
2785
|
+
return upb_encode(msg, &google_protobuf_FieldDescriptorProto_msginit, arena, len);
|
2786
|
+
}
|
2787
|
+
|
2788
|
+
UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_name(const google_protobuf_FieldDescriptorProto *msg) { return _upb_hasbit(msg, 1); }
|
2789
|
+
UPB_INLINE upb_strview google_protobuf_FieldDescriptorProto_name(const google_protobuf_FieldDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(24, 24), upb_strview); }
|
2790
|
+
UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_extendee(const google_protobuf_FieldDescriptorProto *msg) { return _upb_hasbit(msg, 2); }
|
2791
|
+
UPB_INLINE upb_strview google_protobuf_FieldDescriptorProto_extendee(const google_protobuf_FieldDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(32, 40), upb_strview); }
|
2792
|
+
UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_number(const google_protobuf_FieldDescriptorProto *msg) { return _upb_hasbit(msg, 3); }
|
2793
|
+
UPB_INLINE int32_t google_protobuf_FieldDescriptorProto_number(const google_protobuf_FieldDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(12, 12), int32_t); }
|
2794
|
+
UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_label(const google_protobuf_FieldDescriptorProto *msg) { return _upb_hasbit(msg, 4); }
|
2795
|
+
UPB_INLINE int32_t google_protobuf_FieldDescriptorProto_label(const google_protobuf_FieldDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(4, 4), int32_t); }
|
2796
|
+
UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_type(const google_protobuf_FieldDescriptorProto *msg) { return _upb_hasbit(msg, 5); }
|
2797
|
+
UPB_INLINE int32_t google_protobuf_FieldDescriptorProto_type(const google_protobuf_FieldDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(8, 8), int32_t); }
|
2798
|
+
UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_type_name(const google_protobuf_FieldDescriptorProto *msg) { return _upb_hasbit(msg, 6); }
|
2799
|
+
UPB_INLINE upb_strview google_protobuf_FieldDescriptorProto_type_name(const google_protobuf_FieldDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(40, 56), upb_strview); }
|
2800
|
+
UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_default_value(const google_protobuf_FieldDescriptorProto *msg) { return _upb_hasbit(msg, 7); }
|
2801
|
+
UPB_INLINE upb_strview google_protobuf_FieldDescriptorProto_default_value(const google_protobuf_FieldDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(48, 72), upb_strview); }
|
2802
|
+
UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_options(const google_protobuf_FieldDescriptorProto *msg) { return _upb_hasbit(msg, 8); }
|
2803
|
+
UPB_INLINE const google_protobuf_FieldOptions* google_protobuf_FieldDescriptorProto_options(const google_protobuf_FieldDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(64, 104), const google_protobuf_FieldOptions*); }
|
2804
|
+
UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_oneof_index(const google_protobuf_FieldDescriptorProto *msg) { return _upb_hasbit(msg, 9); }
|
2805
|
+
UPB_INLINE int32_t google_protobuf_FieldDescriptorProto_oneof_index(const google_protobuf_FieldDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(16, 16), int32_t); }
|
2806
|
+
UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_json_name(const google_protobuf_FieldDescriptorProto *msg) { return _upb_hasbit(msg, 10); }
|
2807
|
+
UPB_INLINE upb_strview google_protobuf_FieldDescriptorProto_json_name(const google_protobuf_FieldDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(56, 88), upb_strview); }
|
2808
|
+
UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_proto3_optional(const google_protobuf_FieldDescriptorProto *msg) { return _upb_hasbit(msg, 11); }
|
2809
|
+
UPB_INLINE bool google_protobuf_FieldDescriptorProto_proto3_optional(const google_protobuf_FieldDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(20, 20), bool); }
|
2810
|
+
|
2811
|
+
UPB_INLINE void google_protobuf_FieldDescriptorProto_set_name(google_protobuf_FieldDescriptorProto *msg, upb_strview value) {
|
2812
|
+
_upb_sethas(msg, 1);
|
2813
|
+
*UPB_PTR_AT(msg, UPB_SIZE(24, 24), upb_strview) = value;
|
2814
|
+
}
|
2815
|
+
UPB_INLINE void google_protobuf_FieldDescriptorProto_set_extendee(google_protobuf_FieldDescriptorProto *msg, upb_strview value) {
|
2816
|
+
_upb_sethas(msg, 2);
|
2817
|
+
*UPB_PTR_AT(msg, UPB_SIZE(32, 40), upb_strview) = value;
|
2818
|
+
}
|
2819
|
+
UPB_INLINE void google_protobuf_FieldDescriptorProto_set_number(google_protobuf_FieldDescriptorProto *msg, int32_t value) {
|
2820
|
+
_upb_sethas(msg, 3);
|
2821
|
+
*UPB_PTR_AT(msg, UPB_SIZE(12, 12), int32_t) = value;
|
2822
|
+
}
|
2823
|
+
UPB_INLINE void google_protobuf_FieldDescriptorProto_set_label(google_protobuf_FieldDescriptorProto *msg, int32_t value) {
|
2824
|
+
_upb_sethas(msg, 4);
|
2825
|
+
*UPB_PTR_AT(msg, UPB_SIZE(4, 4), int32_t) = value;
|
2826
|
+
}
|
2827
|
+
UPB_INLINE void google_protobuf_FieldDescriptorProto_set_type(google_protobuf_FieldDescriptorProto *msg, int32_t value) {
|
2828
|
+
_upb_sethas(msg, 5);
|
2829
|
+
*UPB_PTR_AT(msg, UPB_SIZE(8, 8), int32_t) = value;
|
2830
|
+
}
|
2831
|
+
UPB_INLINE void google_protobuf_FieldDescriptorProto_set_type_name(google_protobuf_FieldDescriptorProto *msg, upb_strview value) {
|
2832
|
+
_upb_sethas(msg, 6);
|
2833
|
+
*UPB_PTR_AT(msg, UPB_SIZE(40, 56), upb_strview) = value;
|
2834
|
+
}
|
2835
|
+
UPB_INLINE void google_protobuf_FieldDescriptorProto_set_default_value(google_protobuf_FieldDescriptorProto *msg, upb_strview value) {
|
2836
|
+
_upb_sethas(msg, 7);
|
2837
|
+
*UPB_PTR_AT(msg, UPB_SIZE(48, 72), upb_strview) = value;
|
2838
|
+
}
|
2839
|
+
UPB_INLINE void google_protobuf_FieldDescriptorProto_set_options(google_protobuf_FieldDescriptorProto *msg, google_protobuf_FieldOptions* value) {
|
2840
|
+
_upb_sethas(msg, 8);
|
2841
|
+
*UPB_PTR_AT(msg, UPB_SIZE(64, 104), google_protobuf_FieldOptions*) = value;
|
2842
|
+
}
|
2843
|
+
UPB_INLINE struct google_protobuf_FieldOptions* google_protobuf_FieldDescriptorProto_mutable_options(google_protobuf_FieldDescriptorProto *msg, upb_arena *arena) {
|
2844
|
+
struct google_protobuf_FieldOptions* sub = (struct google_protobuf_FieldOptions*)google_protobuf_FieldDescriptorProto_options(msg);
|
2845
|
+
if (sub == NULL) {
|
2846
|
+
sub = (struct google_protobuf_FieldOptions*)_upb_msg_new(&google_protobuf_FieldOptions_msginit, arena);
|
2847
|
+
if (!sub) return NULL;
|
2848
|
+
google_protobuf_FieldDescriptorProto_set_options(msg, sub);
|
2849
|
+
}
|
2850
|
+
return sub;
|
2851
|
+
}
|
2852
|
+
UPB_INLINE void google_protobuf_FieldDescriptorProto_set_oneof_index(google_protobuf_FieldDescriptorProto *msg, int32_t value) {
|
2853
|
+
_upb_sethas(msg, 9);
|
2854
|
+
*UPB_PTR_AT(msg, UPB_SIZE(16, 16), int32_t) = value;
|
2855
|
+
}
|
2856
|
+
UPB_INLINE void google_protobuf_FieldDescriptorProto_set_json_name(google_protobuf_FieldDescriptorProto *msg, upb_strview value) {
|
2857
|
+
_upb_sethas(msg, 10);
|
2858
|
+
*UPB_PTR_AT(msg, UPB_SIZE(56, 88), upb_strview) = value;
|
2859
|
+
}
|
2860
|
+
UPB_INLINE void google_protobuf_FieldDescriptorProto_set_proto3_optional(google_protobuf_FieldDescriptorProto *msg, bool value) {
|
2861
|
+
_upb_sethas(msg, 11);
|
2862
|
+
*UPB_PTR_AT(msg, UPB_SIZE(20, 20), bool) = value;
|
2863
|
+
}
|
2864
|
+
|
2865
|
+
/* google.protobuf.OneofDescriptorProto */
|
2866
|
+
|
2867
|
+
UPB_INLINE google_protobuf_OneofDescriptorProto *google_protobuf_OneofDescriptorProto_new(upb_arena *arena) {
|
2868
|
+
return (google_protobuf_OneofDescriptorProto *)_upb_msg_new(&google_protobuf_OneofDescriptorProto_msginit, arena);
|
2869
|
+
}
|
2870
|
+
UPB_INLINE google_protobuf_OneofDescriptorProto *google_protobuf_OneofDescriptorProto_parse(const char *buf, size_t size,
|
2871
|
+
upb_arena *arena) {
|
2872
|
+
google_protobuf_OneofDescriptorProto *ret = google_protobuf_OneofDescriptorProto_new(arena);
|
2873
|
+
if (!ret) return NULL;
|
2874
|
+
if (!upb_decode(buf, size, ret, &google_protobuf_OneofDescriptorProto_msginit, arena)) return NULL;
|
2875
|
+
return ret;
|
2876
|
+
}
|
2877
|
+
UPB_INLINE google_protobuf_OneofDescriptorProto *google_protobuf_OneofDescriptorProto_parse_ex(const char *buf, size_t size,
|
2878
|
+
const upb_extreg *extreg, int options,
|
2879
|
+
upb_arena *arena) {
|
2880
|
+
google_protobuf_OneofDescriptorProto *ret = google_protobuf_OneofDescriptorProto_new(arena);
|
2881
|
+
if (!ret) return NULL;
|
2882
|
+
if (!_upb_decode(buf, size, ret, &google_protobuf_OneofDescriptorProto_msginit, extreg, options, arena)) {
|
2883
|
+
return NULL;
|
2884
|
+
}
|
2885
|
+
return ret;
|
2886
|
+
}
|
2887
|
+
UPB_INLINE char *google_protobuf_OneofDescriptorProto_serialize(const google_protobuf_OneofDescriptorProto *msg, upb_arena *arena, size_t *len) {
|
2888
|
+
return upb_encode(msg, &google_protobuf_OneofDescriptorProto_msginit, arena, len);
|
2889
|
+
}
|
2890
|
+
|
2891
|
+
UPB_INLINE bool google_protobuf_OneofDescriptorProto_has_name(const google_protobuf_OneofDescriptorProto *msg) { return _upb_hasbit(msg, 1); }
|
2892
|
+
UPB_INLINE upb_strview google_protobuf_OneofDescriptorProto_name(const google_protobuf_OneofDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(4, 8), upb_strview); }
|
2893
|
+
UPB_INLINE bool google_protobuf_OneofDescriptorProto_has_options(const google_protobuf_OneofDescriptorProto *msg) { return _upb_hasbit(msg, 2); }
|
2894
|
+
UPB_INLINE const google_protobuf_OneofOptions* google_protobuf_OneofDescriptorProto_options(const google_protobuf_OneofDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(12, 24), const google_protobuf_OneofOptions*); }
|
2895
|
+
|
2896
|
+
UPB_INLINE void google_protobuf_OneofDescriptorProto_set_name(google_protobuf_OneofDescriptorProto *msg, upb_strview value) {
|
2897
|
+
_upb_sethas(msg, 1);
|
2898
|
+
*UPB_PTR_AT(msg, UPB_SIZE(4, 8), upb_strview) = value;
|
2899
|
+
}
|
2900
|
+
UPB_INLINE void google_protobuf_OneofDescriptorProto_set_options(google_protobuf_OneofDescriptorProto *msg, google_protobuf_OneofOptions* value) {
|
2901
|
+
_upb_sethas(msg, 2);
|
2902
|
+
*UPB_PTR_AT(msg, UPB_SIZE(12, 24), google_protobuf_OneofOptions*) = value;
|
2903
|
+
}
|
2904
|
+
UPB_INLINE struct google_protobuf_OneofOptions* google_protobuf_OneofDescriptorProto_mutable_options(google_protobuf_OneofDescriptorProto *msg, upb_arena *arena) {
|
2905
|
+
struct google_protobuf_OneofOptions* sub = (struct google_protobuf_OneofOptions*)google_protobuf_OneofDescriptorProto_options(msg);
|
2906
|
+
if (sub == NULL) {
|
2907
|
+
sub = (struct google_protobuf_OneofOptions*)_upb_msg_new(&google_protobuf_OneofOptions_msginit, arena);
|
2908
|
+
if (!sub) return NULL;
|
2909
|
+
google_protobuf_OneofDescriptorProto_set_options(msg, sub);
|
2910
|
+
}
|
2911
|
+
return sub;
|
2912
|
+
}
|
2913
|
+
|
2914
|
+
/* google.protobuf.EnumDescriptorProto */
|
2915
|
+
|
2916
|
+
UPB_INLINE google_protobuf_EnumDescriptorProto *google_protobuf_EnumDescriptorProto_new(upb_arena *arena) {
|
2917
|
+
return (google_protobuf_EnumDescriptorProto *)_upb_msg_new(&google_protobuf_EnumDescriptorProto_msginit, arena);
|
2918
|
+
}
|
2919
|
+
UPB_INLINE google_protobuf_EnumDescriptorProto *google_protobuf_EnumDescriptorProto_parse(const char *buf, size_t size,
|
2920
|
+
upb_arena *arena) {
|
2921
|
+
google_protobuf_EnumDescriptorProto *ret = google_protobuf_EnumDescriptorProto_new(arena);
|
2922
|
+
if (!ret) return NULL;
|
2923
|
+
if (!upb_decode(buf, size, ret, &google_protobuf_EnumDescriptorProto_msginit, arena)) return NULL;
|
2924
|
+
return ret;
|
2925
|
+
}
|
2926
|
+
UPB_INLINE google_protobuf_EnumDescriptorProto *google_protobuf_EnumDescriptorProto_parse_ex(const char *buf, size_t size,
|
2927
|
+
const upb_extreg *extreg, int options,
|
2928
|
+
upb_arena *arena) {
|
2929
|
+
google_protobuf_EnumDescriptorProto *ret = google_protobuf_EnumDescriptorProto_new(arena);
|
2930
|
+
if (!ret) return NULL;
|
2931
|
+
if (!_upb_decode(buf, size, ret, &google_protobuf_EnumDescriptorProto_msginit, extreg, options, arena)) {
|
2932
|
+
return NULL;
|
2933
|
+
}
|
2934
|
+
return ret;
|
2935
|
+
}
|
2936
|
+
UPB_INLINE char *google_protobuf_EnumDescriptorProto_serialize(const google_protobuf_EnumDescriptorProto *msg, upb_arena *arena, size_t *len) {
|
2937
|
+
return upb_encode(msg, &google_protobuf_EnumDescriptorProto_msginit, arena, len);
|
2938
|
+
}
|
2939
|
+
|
2940
|
+
UPB_INLINE bool google_protobuf_EnumDescriptorProto_has_name(const google_protobuf_EnumDescriptorProto *msg) { return _upb_hasbit(msg, 1); }
|
2941
|
+
UPB_INLINE upb_strview google_protobuf_EnumDescriptorProto_name(const google_protobuf_EnumDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(4, 8), upb_strview); }
|
2942
|
+
UPB_INLINE bool google_protobuf_EnumDescriptorProto_has_value(const google_protobuf_EnumDescriptorProto *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(16, 32)); }
|
2943
|
+
UPB_INLINE const google_protobuf_EnumValueDescriptorProto* const* google_protobuf_EnumDescriptorProto_value(const google_protobuf_EnumDescriptorProto *msg, size_t *len) { return (const google_protobuf_EnumValueDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(16, 32), len); }
|
2944
|
+
UPB_INLINE bool google_protobuf_EnumDescriptorProto_has_options(const google_protobuf_EnumDescriptorProto *msg) { return _upb_hasbit(msg, 2); }
|
2945
|
+
UPB_INLINE const google_protobuf_EnumOptions* google_protobuf_EnumDescriptorProto_options(const google_protobuf_EnumDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(12, 24), const google_protobuf_EnumOptions*); }
|
2946
|
+
UPB_INLINE bool google_protobuf_EnumDescriptorProto_has_reserved_range(const google_protobuf_EnumDescriptorProto *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(20, 40)); }
|
2947
|
+
UPB_INLINE const google_protobuf_EnumDescriptorProto_EnumReservedRange* const* google_protobuf_EnumDescriptorProto_reserved_range(const google_protobuf_EnumDescriptorProto *msg, size_t *len) { return (const google_protobuf_EnumDescriptorProto_EnumReservedRange* const*)_upb_array_accessor(msg, UPB_SIZE(20, 40), len); }
|
2948
|
+
UPB_INLINE upb_strview const* google_protobuf_EnumDescriptorProto_reserved_name(const google_protobuf_EnumDescriptorProto *msg, size_t *len) { return (upb_strview const*)_upb_array_accessor(msg, UPB_SIZE(24, 48), len); }
|
2949
|
+
|
2950
|
+
UPB_INLINE void google_protobuf_EnumDescriptorProto_set_name(google_protobuf_EnumDescriptorProto *msg, upb_strview value) {
|
2951
|
+
_upb_sethas(msg, 1);
|
2952
|
+
*UPB_PTR_AT(msg, UPB_SIZE(4, 8), upb_strview) = value;
|
2953
|
+
}
|
2954
|
+
UPB_INLINE google_protobuf_EnumValueDescriptorProto** google_protobuf_EnumDescriptorProto_mutable_value(google_protobuf_EnumDescriptorProto *msg, size_t *len) {
|
2955
|
+
return (google_protobuf_EnumValueDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(16, 32), len);
|
2956
|
+
}
|
2957
|
+
UPB_INLINE google_protobuf_EnumValueDescriptorProto** google_protobuf_EnumDescriptorProto_resize_value(google_protobuf_EnumDescriptorProto *msg, size_t len, upb_arena *arena) {
|
2958
|
+
return (google_protobuf_EnumValueDescriptorProto**)_upb_array_resize_accessor2(msg, UPB_SIZE(16, 32), len, UPB_SIZE(2, 3), arena);
|
2959
|
+
}
|
2960
|
+
UPB_INLINE struct google_protobuf_EnumValueDescriptorProto* google_protobuf_EnumDescriptorProto_add_value(google_protobuf_EnumDescriptorProto *msg, upb_arena *arena) {
|
2961
|
+
struct google_protobuf_EnumValueDescriptorProto* sub = (struct google_protobuf_EnumValueDescriptorProto*)_upb_msg_new(&google_protobuf_EnumValueDescriptorProto_msginit, arena);
|
2962
|
+
bool ok = _upb_array_append_accessor2(
|
2963
|
+
msg, UPB_SIZE(16, 32), UPB_SIZE(2, 3), &sub, arena);
|
2964
|
+
if (!ok) return NULL;
|
2965
|
+
return sub;
|
2966
|
+
}
|
2967
|
+
UPB_INLINE void google_protobuf_EnumDescriptorProto_set_options(google_protobuf_EnumDescriptorProto *msg, google_protobuf_EnumOptions* value) {
|
2968
|
+
_upb_sethas(msg, 2);
|
2969
|
+
*UPB_PTR_AT(msg, UPB_SIZE(12, 24), google_protobuf_EnumOptions*) = value;
|
2970
|
+
}
|
2971
|
+
UPB_INLINE struct google_protobuf_EnumOptions* google_protobuf_EnumDescriptorProto_mutable_options(google_protobuf_EnumDescriptorProto *msg, upb_arena *arena) {
|
2972
|
+
struct google_protobuf_EnumOptions* sub = (struct google_protobuf_EnumOptions*)google_protobuf_EnumDescriptorProto_options(msg);
|
2973
|
+
if (sub == NULL) {
|
2974
|
+
sub = (struct google_protobuf_EnumOptions*)_upb_msg_new(&google_protobuf_EnumOptions_msginit, arena);
|
2975
|
+
if (!sub) return NULL;
|
2976
|
+
google_protobuf_EnumDescriptorProto_set_options(msg, sub);
|
2977
|
+
}
|
2978
|
+
return sub;
|
2979
|
+
}
|
2980
|
+
UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange** google_protobuf_EnumDescriptorProto_mutable_reserved_range(google_protobuf_EnumDescriptorProto *msg, size_t *len) {
|
2981
|
+
return (google_protobuf_EnumDescriptorProto_EnumReservedRange**)_upb_array_mutable_accessor(msg, UPB_SIZE(20, 40), len);
|
2982
|
+
}
|
2983
|
+
UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange** google_protobuf_EnumDescriptorProto_resize_reserved_range(google_protobuf_EnumDescriptorProto *msg, size_t len, upb_arena *arena) {
|
2984
|
+
return (google_protobuf_EnumDescriptorProto_EnumReservedRange**)_upb_array_resize_accessor2(msg, UPB_SIZE(20, 40), len, UPB_SIZE(2, 3), arena);
|
2985
|
+
}
|
2986
|
+
UPB_INLINE struct google_protobuf_EnumDescriptorProto_EnumReservedRange* google_protobuf_EnumDescriptorProto_add_reserved_range(google_protobuf_EnumDescriptorProto *msg, upb_arena *arena) {
|
2987
|
+
struct google_protobuf_EnumDescriptorProto_EnumReservedRange* sub = (struct google_protobuf_EnumDescriptorProto_EnumReservedRange*)_upb_msg_new(&google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit, arena);
|
2988
|
+
bool ok = _upb_array_append_accessor2(
|
2989
|
+
msg, UPB_SIZE(20, 40), UPB_SIZE(2, 3), &sub, arena);
|
2990
|
+
if (!ok) return NULL;
|
2991
|
+
return sub;
|
2992
|
+
}
|
2993
|
+
UPB_INLINE upb_strview* google_protobuf_EnumDescriptorProto_mutable_reserved_name(google_protobuf_EnumDescriptorProto *msg, size_t *len) {
|
2994
|
+
return (upb_strview*)_upb_array_mutable_accessor(msg, UPB_SIZE(24, 48), len);
|
2995
|
+
}
|
2996
|
+
UPB_INLINE upb_strview* google_protobuf_EnumDescriptorProto_resize_reserved_name(google_protobuf_EnumDescriptorProto *msg, size_t len, upb_arena *arena) {
|
2997
|
+
return (upb_strview*)_upb_array_resize_accessor2(msg, UPB_SIZE(24, 48), len, UPB_SIZE(3, 4), arena);
|
2998
|
+
}
|
2999
|
+
UPB_INLINE bool google_protobuf_EnumDescriptorProto_add_reserved_name(google_protobuf_EnumDescriptorProto *msg, upb_strview val, upb_arena *arena) {
|
3000
|
+
return _upb_array_append_accessor2(msg, UPB_SIZE(24, 48), UPB_SIZE(3, 4), &val,
|
3001
|
+
arena);
|
3002
|
+
}
|
3003
|
+
|
3004
|
+
/* google.protobuf.EnumDescriptorProto.EnumReservedRange */
|
3005
|
+
|
3006
|
+
UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange *google_protobuf_EnumDescriptorProto_EnumReservedRange_new(upb_arena *arena) {
|
3007
|
+
return (google_protobuf_EnumDescriptorProto_EnumReservedRange *)_upb_msg_new(&google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit, arena);
|
3008
|
+
}
|
3009
|
+
UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange *google_protobuf_EnumDescriptorProto_EnumReservedRange_parse(const char *buf, size_t size,
|
3010
|
+
upb_arena *arena) {
|
3011
|
+
google_protobuf_EnumDescriptorProto_EnumReservedRange *ret = google_protobuf_EnumDescriptorProto_EnumReservedRange_new(arena);
|
3012
|
+
if (!ret) return NULL;
|
3013
|
+
if (!upb_decode(buf, size, ret, &google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit, arena)) return NULL;
|
3014
|
+
return ret;
|
3015
|
+
}
|
3016
|
+
UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange *google_protobuf_EnumDescriptorProto_EnumReservedRange_parse_ex(const char *buf, size_t size,
|
3017
|
+
const upb_extreg *extreg, int options,
|
3018
|
+
upb_arena *arena) {
|
3019
|
+
google_protobuf_EnumDescriptorProto_EnumReservedRange *ret = google_protobuf_EnumDescriptorProto_EnumReservedRange_new(arena);
|
3020
|
+
if (!ret) return NULL;
|
3021
|
+
if (!_upb_decode(buf, size, ret, &google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit, extreg, options, arena)) {
|
3022
|
+
return NULL;
|
3023
|
+
}
|
3024
|
+
return ret;
|
3025
|
+
}
|
3026
|
+
UPB_INLINE char *google_protobuf_EnumDescriptorProto_EnumReservedRange_serialize(const google_protobuf_EnumDescriptorProto_EnumReservedRange *msg, upb_arena *arena, size_t *len) {
|
3027
|
+
return upb_encode(msg, &google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit, arena, len);
|
3028
|
+
}
|
3029
|
+
|
3030
|
+
UPB_INLINE bool google_protobuf_EnumDescriptorProto_EnumReservedRange_has_start(const google_protobuf_EnumDescriptorProto_EnumReservedRange *msg) { return _upb_hasbit(msg, 1); }
|
3031
|
+
UPB_INLINE int32_t google_protobuf_EnumDescriptorProto_EnumReservedRange_start(const google_protobuf_EnumDescriptorProto_EnumReservedRange *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(4, 4), int32_t); }
|
3032
|
+
UPB_INLINE bool google_protobuf_EnumDescriptorProto_EnumReservedRange_has_end(const google_protobuf_EnumDescriptorProto_EnumReservedRange *msg) { return _upb_hasbit(msg, 2); }
|
3033
|
+
UPB_INLINE int32_t google_protobuf_EnumDescriptorProto_EnumReservedRange_end(const google_protobuf_EnumDescriptorProto_EnumReservedRange *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(8, 8), int32_t); }
|
3034
|
+
|
3035
|
+
UPB_INLINE void google_protobuf_EnumDescriptorProto_EnumReservedRange_set_start(google_protobuf_EnumDescriptorProto_EnumReservedRange *msg, int32_t value) {
|
3036
|
+
_upb_sethas(msg, 1);
|
3037
|
+
*UPB_PTR_AT(msg, UPB_SIZE(4, 4), int32_t) = value;
|
3038
|
+
}
|
3039
|
+
UPB_INLINE void google_protobuf_EnumDescriptorProto_EnumReservedRange_set_end(google_protobuf_EnumDescriptorProto_EnumReservedRange *msg, int32_t value) {
|
3040
|
+
_upb_sethas(msg, 2);
|
3041
|
+
*UPB_PTR_AT(msg, UPB_SIZE(8, 8), int32_t) = value;
|
3042
|
+
}
|
3043
|
+
|
3044
|
+
/* google.protobuf.EnumValueDescriptorProto */
|
3045
|
+
|
3046
|
+
UPB_INLINE google_protobuf_EnumValueDescriptorProto *google_protobuf_EnumValueDescriptorProto_new(upb_arena *arena) {
|
3047
|
+
return (google_protobuf_EnumValueDescriptorProto *)_upb_msg_new(&google_protobuf_EnumValueDescriptorProto_msginit, arena);
|
3048
|
+
}
|
3049
|
+
UPB_INLINE google_protobuf_EnumValueDescriptorProto *google_protobuf_EnumValueDescriptorProto_parse(const char *buf, size_t size,
|
3050
|
+
upb_arena *arena) {
|
3051
|
+
google_protobuf_EnumValueDescriptorProto *ret = google_protobuf_EnumValueDescriptorProto_new(arena);
|
3052
|
+
if (!ret) return NULL;
|
3053
|
+
if (!upb_decode(buf, size, ret, &google_protobuf_EnumValueDescriptorProto_msginit, arena)) return NULL;
|
3054
|
+
return ret;
|
3055
|
+
}
|
3056
|
+
UPB_INLINE google_protobuf_EnumValueDescriptorProto *google_protobuf_EnumValueDescriptorProto_parse_ex(const char *buf, size_t size,
|
3057
|
+
const upb_extreg *extreg, int options,
|
3058
|
+
upb_arena *arena) {
|
3059
|
+
google_protobuf_EnumValueDescriptorProto *ret = google_protobuf_EnumValueDescriptorProto_new(arena);
|
3060
|
+
if (!ret) return NULL;
|
3061
|
+
if (!_upb_decode(buf, size, ret, &google_protobuf_EnumValueDescriptorProto_msginit, extreg, options, arena)) {
|
3062
|
+
return NULL;
|
3063
|
+
}
|
3064
|
+
return ret;
|
3065
|
+
}
|
3066
|
+
UPB_INLINE char *google_protobuf_EnumValueDescriptorProto_serialize(const google_protobuf_EnumValueDescriptorProto *msg, upb_arena *arena, size_t *len) {
|
3067
|
+
return upb_encode(msg, &google_protobuf_EnumValueDescriptorProto_msginit, arena, len);
|
3068
|
+
}
|
3069
|
+
|
3070
|
+
UPB_INLINE bool google_protobuf_EnumValueDescriptorProto_has_name(const google_protobuf_EnumValueDescriptorProto *msg) { return _upb_hasbit(msg, 1); }
|
3071
|
+
UPB_INLINE upb_strview google_protobuf_EnumValueDescriptorProto_name(const google_protobuf_EnumValueDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(8, 8), upb_strview); }
|
3072
|
+
UPB_INLINE bool google_protobuf_EnumValueDescriptorProto_has_number(const google_protobuf_EnumValueDescriptorProto *msg) { return _upb_hasbit(msg, 2); }
|
3073
|
+
UPB_INLINE int32_t google_protobuf_EnumValueDescriptorProto_number(const google_protobuf_EnumValueDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(4, 4), int32_t); }
|
3074
|
+
UPB_INLINE bool google_protobuf_EnumValueDescriptorProto_has_options(const google_protobuf_EnumValueDescriptorProto *msg) { return _upb_hasbit(msg, 3); }
|
3075
|
+
UPB_INLINE const google_protobuf_EnumValueOptions* google_protobuf_EnumValueDescriptorProto_options(const google_protobuf_EnumValueDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(16, 24), const google_protobuf_EnumValueOptions*); }
|
3076
|
+
|
3077
|
+
UPB_INLINE void google_protobuf_EnumValueDescriptorProto_set_name(google_protobuf_EnumValueDescriptorProto *msg, upb_strview value) {
|
3078
|
+
_upb_sethas(msg, 1);
|
3079
|
+
*UPB_PTR_AT(msg, UPB_SIZE(8, 8), upb_strview) = value;
|
3080
|
+
}
|
3081
|
+
UPB_INLINE void google_protobuf_EnumValueDescriptorProto_set_number(google_protobuf_EnumValueDescriptorProto *msg, int32_t value) {
|
3082
|
+
_upb_sethas(msg, 2);
|
3083
|
+
*UPB_PTR_AT(msg, UPB_SIZE(4, 4), int32_t) = value;
|
3084
|
+
}
|
3085
|
+
UPB_INLINE void google_protobuf_EnumValueDescriptorProto_set_options(google_protobuf_EnumValueDescriptorProto *msg, google_protobuf_EnumValueOptions* value) {
|
3086
|
+
_upb_sethas(msg, 3);
|
3087
|
+
*UPB_PTR_AT(msg, UPB_SIZE(16, 24), google_protobuf_EnumValueOptions*) = value;
|
3088
|
+
}
|
3089
|
+
UPB_INLINE struct google_protobuf_EnumValueOptions* google_protobuf_EnumValueDescriptorProto_mutable_options(google_protobuf_EnumValueDescriptorProto *msg, upb_arena *arena) {
|
3090
|
+
struct google_protobuf_EnumValueOptions* sub = (struct google_protobuf_EnumValueOptions*)google_protobuf_EnumValueDescriptorProto_options(msg);
|
3091
|
+
if (sub == NULL) {
|
3092
|
+
sub = (struct google_protobuf_EnumValueOptions*)_upb_msg_new(&google_protobuf_EnumValueOptions_msginit, arena);
|
3093
|
+
if (!sub) return NULL;
|
3094
|
+
google_protobuf_EnumValueDescriptorProto_set_options(msg, sub);
|
3095
|
+
}
|
3096
|
+
return sub;
|
3097
|
+
}
|
3098
|
+
|
3099
|
+
/* google.protobuf.ServiceDescriptorProto */
|
3100
|
+
|
3101
|
+
UPB_INLINE google_protobuf_ServiceDescriptorProto *google_protobuf_ServiceDescriptorProto_new(upb_arena *arena) {
|
3102
|
+
return (google_protobuf_ServiceDescriptorProto *)_upb_msg_new(&google_protobuf_ServiceDescriptorProto_msginit, arena);
|
3103
|
+
}
|
3104
|
+
UPB_INLINE google_protobuf_ServiceDescriptorProto *google_protobuf_ServiceDescriptorProto_parse(const char *buf, size_t size,
|
3105
|
+
upb_arena *arena) {
|
3106
|
+
google_protobuf_ServiceDescriptorProto *ret = google_protobuf_ServiceDescriptorProto_new(arena);
|
3107
|
+
if (!ret) return NULL;
|
3108
|
+
if (!upb_decode(buf, size, ret, &google_protobuf_ServiceDescriptorProto_msginit, arena)) return NULL;
|
3109
|
+
return ret;
|
3110
|
+
}
|
3111
|
+
UPB_INLINE google_protobuf_ServiceDescriptorProto *google_protobuf_ServiceDescriptorProto_parse_ex(const char *buf, size_t size,
|
3112
|
+
const upb_extreg *extreg, int options,
|
3113
|
+
upb_arena *arena) {
|
3114
|
+
google_protobuf_ServiceDescriptorProto *ret = google_protobuf_ServiceDescriptorProto_new(arena);
|
3115
|
+
if (!ret) return NULL;
|
3116
|
+
if (!_upb_decode(buf, size, ret, &google_protobuf_ServiceDescriptorProto_msginit, extreg, options, arena)) {
|
3117
|
+
return NULL;
|
3118
|
+
}
|
3119
|
+
return ret;
|
3120
|
+
}
|
3121
|
+
UPB_INLINE char *google_protobuf_ServiceDescriptorProto_serialize(const google_protobuf_ServiceDescriptorProto *msg, upb_arena *arena, size_t *len) {
|
3122
|
+
return upb_encode(msg, &google_protobuf_ServiceDescriptorProto_msginit, arena, len);
|
3123
|
+
}
|
3124
|
+
|
3125
|
+
UPB_INLINE bool google_protobuf_ServiceDescriptorProto_has_name(const google_protobuf_ServiceDescriptorProto *msg) { return _upb_hasbit(msg, 1); }
|
3126
|
+
UPB_INLINE upb_strview google_protobuf_ServiceDescriptorProto_name(const google_protobuf_ServiceDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(4, 8), upb_strview); }
|
3127
|
+
UPB_INLINE bool google_protobuf_ServiceDescriptorProto_has_method(const google_protobuf_ServiceDescriptorProto *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(16, 32)); }
|
3128
|
+
UPB_INLINE const google_protobuf_MethodDescriptorProto* const* google_protobuf_ServiceDescriptorProto_method(const google_protobuf_ServiceDescriptorProto *msg, size_t *len) { return (const google_protobuf_MethodDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(16, 32), len); }
|
3129
|
+
UPB_INLINE bool google_protobuf_ServiceDescriptorProto_has_options(const google_protobuf_ServiceDescriptorProto *msg) { return _upb_hasbit(msg, 2); }
|
3130
|
+
UPB_INLINE const google_protobuf_ServiceOptions* google_protobuf_ServiceDescriptorProto_options(const google_protobuf_ServiceDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(12, 24), const google_protobuf_ServiceOptions*); }
|
3131
|
+
|
3132
|
+
UPB_INLINE void google_protobuf_ServiceDescriptorProto_set_name(google_protobuf_ServiceDescriptorProto *msg, upb_strview value) {
|
3133
|
+
_upb_sethas(msg, 1);
|
3134
|
+
*UPB_PTR_AT(msg, UPB_SIZE(4, 8), upb_strview) = value;
|
3135
|
+
}
|
3136
|
+
UPB_INLINE google_protobuf_MethodDescriptorProto** google_protobuf_ServiceDescriptorProto_mutable_method(google_protobuf_ServiceDescriptorProto *msg, size_t *len) {
|
3137
|
+
return (google_protobuf_MethodDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(16, 32), len);
|
3138
|
+
}
|
3139
|
+
UPB_INLINE google_protobuf_MethodDescriptorProto** google_protobuf_ServiceDescriptorProto_resize_method(google_protobuf_ServiceDescriptorProto *msg, size_t len, upb_arena *arena) {
|
3140
|
+
return (google_protobuf_MethodDescriptorProto**)_upb_array_resize_accessor2(msg, UPB_SIZE(16, 32), len, UPB_SIZE(2, 3), arena);
|
3141
|
+
}
|
3142
|
+
UPB_INLINE struct google_protobuf_MethodDescriptorProto* google_protobuf_ServiceDescriptorProto_add_method(google_protobuf_ServiceDescriptorProto *msg, upb_arena *arena) {
|
3143
|
+
struct google_protobuf_MethodDescriptorProto* sub = (struct google_protobuf_MethodDescriptorProto*)_upb_msg_new(&google_protobuf_MethodDescriptorProto_msginit, arena);
|
3144
|
+
bool ok = _upb_array_append_accessor2(
|
3145
|
+
msg, UPB_SIZE(16, 32), UPB_SIZE(2, 3), &sub, arena);
|
3146
|
+
if (!ok) return NULL;
|
3147
|
+
return sub;
|
3148
|
+
}
|
3149
|
+
UPB_INLINE void google_protobuf_ServiceDescriptorProto_set_options(google_protobuf_ServiceDescriptorProto *msg, google_protobuf_ServiceOptions* value) {
|
3150
|
+
_upb_sethas(msg, 2);
|
3151
|
+
*UPB_PTR_AT(msg, UPB_SIZE(12, 24), google_protobuf_ServiceOptions*) = value;
|
3152
|
+
}
|
3153
|
+
UPB_INLINE struct google_protobuf_ServiceOptions* google_protobuf_ServiceDescriptorProto_mutable_options(google_protobuf_ServiceDescriptorProto *msg, upb_arena *arena) {
|
3154
|
+
struct google_protobuf_ServiceOptions* sub = (struct google_protobuf_ServiceOptions*)google_protobuf_ServiceDescriptorProto_options(msg);
|
3155
|
+
if (sub == NULL) {
|
3156
|
+
sub = (struct google_protobuf_ServiceOptions*)_upb_msg_new(&google_protobuf_ServiceOptions_msginit, arena);
|
3157
|
+
if (!sub) return NULL;
|
3158
|
+
google_protobuf_ServiceDescriptorProto_set_options(msg, sub);
|
3159
|
+
}
|
3160
|
+
return sub;
|
3161
|
+
}
|
3162
|
+
|
3163
|
+
/* google.protobuf.MethodDescriptorProto */
|
3164
|
+
|
3165
|
+
UPB_INLINE google_protobuf_MethodDescriptorProto *google_protobuf_MethodDescriptorProto_new(upb_arena *arena) {
|
3166
|
+
return (google_protobuf_MethodDescriptorProto *)_upb_msg_new(&google_protobuf_MethodDescriptorProto_msginit, arena);
|
3167
|
+
}
|
3168
|
+
UPB_INLINE google_protobuf_MethodDescriptorProto *google_protobuf_MethodDescriptorProto_parse(const char *buf, size_t size,
|
3169
|
+
upb_arena *arena) {
|
3170
|
+
google_protobuf_MethodDescriptorProto *ret = google_protobuf_MethodDescriptorProto_new(arena);
|
3171
|
+
if (!ret) return NULL;
|
3172
|
+
if (!upb_decode(buf, size, ret, &google_protobuf_MethodDescriptorProto_msginit, arena)) return NULL;
|
3173
|
+
return ret;
|
3174
|
+
}
|
3175
|
+
UPB_INLINE google_protobuf_MethodDescriptorProto *google_protobuf_MethodDescriptorProto_parse_ex(const char *buf, size_t size,
|
3176
|
+
const upb_extreg *extreg, int options,
|
3177
|
+
upb_arena *arena) {
|
3178
|
+
google_protobuf_MethodDescriptorProto *ret = google_protobuf_MethodDescriptorProto_new(arena);
|
3179
|
+
if (!ret) return NULL;
|
3180
|
+
if (!_upb_decode(buf, size, ret, &google_protobuf_MethodDescriptorProto_msginit, extreg, options, arena)) {
|
3181
|
+
return NULL;
|
3182
|
+
}
|
3183
|
+
return ret;
|
3184
|
+
}
|
3185
|
+
UPB_INLINE char *google_protobuf_MethodDescriptorProto_serialize(const google_protobuf_MethodDescriptorProto *msg, upb_arena *arena, size_t *len) {
|
3186
|
+
return upb_encode(msg, &google_protobuf_MethodDescriptorProto_msginit, arena, len);
|
3187
|
+
}
|
3188
|
+
|
3189
|
+
UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_name(const google_protobuf_MethodDescriptorProto *msg) { return _upb_hasbit(msg, 1); }
|
3190
|
+
UPB_INLINE upb_strview google_protobuf_MethodDescriptorProto_name(const google_protobuf_MethodDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(4, 8), upb_strview); }
|
3191
|
+
UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_input_type(const google_protobuf_MethodDescriptorProto *msg) { return _upb_hasbit(msg, 2); }
|
3192
|
+
UPB_INLINE upb_strview google_protobuf_MethodDescriptorProto_input_type(const google_protobuf_MethodDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(12, 24), upb_strview); }
|
3193
|
+
UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_output_type(const google_protobuf_MethodDescriptorProto *msg) { return _upb_hasbit(msg, 3); }
|
3194
|
+
UPB_INLINE upb_strview google_protobuf_MethodDescriptorProto_output_type(const google_protobuf_MethodDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(20, 40), upb_strview); }
|
3195
|
+
UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_options(const google_protobuf_MethodDescriptorProto *msg) { return _upb_hasbit(msg, 4); }
|
3196
|
+
UPB_INLINE const google_protobuf_MethodOptions* google_protobuf_MethodDescriptorProto_options(const google_protobuf_MethodDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(28, 56), const google_protobuf_MethodOptions*); }
|
3197
|
+
UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_client_streaming(const google_protobuf_MethodDescriptorProto *msg) { return _upb_hasbit(msg, 5); }
|
3198
|
+
UPB_INLINE bool google_protobuf_MethodDescriptorProto_client_streaming(const google_protobuf_MethodDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(1, 1), bool); }
|
3199
|
+
UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_server_streaming(const google_protobuf_MethodDescriptorProto *msg) { return _upb_hasbit(msg, 6); }
|
3200
|
+
UPB_INLINE bool google_protobuf_MethodDescriptorProto_server_streaming(const google_protobuf_MethodDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(2, 2), bool); }
|
3201
|
+
|
3202
|
+
UPB_INLINE void google_protobuf_MethodDescriptorProto_set_name(google_protobuf_MethodDescriptorProto *msg, upb_strview value) {
|
3203
|
+
_upb_sethas(msg, 1);
|
3204
|
+
*UPB_PTR_AT(msg, UPB_SIZE(4, 8), upb_strview) = value;
|
3205
|
+
}
|
3206
|
+
UPB_INLINE void google_protobuf_MethodDescriptorProto_set_input_type(google_protobuf_MethodDescriptorProto *msg, upb_strview value) {
|
3207
|
+
_upb_sethas(msg, 2);
|
3208
|
+
*UPB_PTR_AT(msg, UPB_SIZE(12, 24), upb_strview) = value;
|
3209
|
+
}
|
3210
|
+
UPB_INLINE void google_protobuf_MethodDescriptorProto_set_output_type(google_protobuf_MethodDescriptorProto *msg, upb_strview value) {
|
3211
|
+
_upb_sethas(msg, 3);
|
3212
|
+
*UPB_PTR_AT(msg, UPB_SIZE(20, 40), upb_strview) = value;
|
3213
|
+
}
|
3214
|
+
UPB_INLINE void google_protobuf_MethodDescriptorProto_set_options(google_protobuf_MethodDescriptorProto *msg, google_protobuf_MethodOptions* value) {
|
3215
|
+
_upb_sethas(msg, 4);
|
3216
|
+
*UPB_PTR_AT(msg, UPB_SIZE(28, 56), google_protobuf_MethodOptions*) = value;
|
3217
|
+
}
|
3218
|
+
UPB_INLINE struct google_protobuf_MethodOptions* google_protobuf_MethodDescriptorProto_mutable_options(google_protobuf_MethodDescriptorProto *msg, upb_arena *arena) {
|
3219
|
+
struct google_protobuf_MethodOptions* sub = (struct google_protobuf_MethodOptions*)google_protobuf_MethodDescriptorProto_options(msg);
|
3220
|
+
if (sub == NULL) {
|
3221
|
+
sub = (struct google_protobuf_MethodOptions*)_upb_msg_new(&google_protobuf_MethodOptions_msginit, arena);
|
3222
|
+
if (!sub) return NULL;
|
3223
|
+
google_protobuf_MethodDescriptorProto_set_options(msg, sub);
|
3224
|
+
}
|
3225
|
+
return sub;
|
3226
|
+
}
|
3227
|
+
UPB_INLINE void google_protobuf_MethodDescriptorProto_set_client_streaming(google_protobuf_MethodDescriptorProto *msg, bool value) {
|
3228
|
+
_upb_sethas(msg, 5);
|
3229
|
+
*UPB_PTR_AT(msg, UPB_SIZE(1, 1), bool) = value;
|
3230
|
+
}
|
3231
|
+
UPB_INLINE void google_protobuf_MethodDescriptorProto_set_server_streaming(google_protobuf_MethodDescriptorProto *msg, bool value) {
|
3232
|
+
_upb_sethas(msg, 6);
|
3233
|
+
*UPB_PTR_AT(msg, UPB_SIZE(2, 2), bool) = value;
|
3234
|
+
}
|
3235
|
+
|
3236
|
+
/* google.protobuf.FileOptions */
|
3237
|
+
|
3238
|
+
UPB_INLINE google_protobuf_FileOptions *google_protobuf_FileOptions_new(upb_arena *arena) {
|
3239
|
+
return (google_protobuf_FileOptions *)_upb_msg_new(&google_protobuf_FileOptions_msginit, arena);
|
3240
|
+
}
|
3241
|
+
UPB_INLINE google_protobuf_FileOptions *google_protobuf_FileOptions_parse(const char *buf, size_t size,
|
3242
|
+
upb_arena *arena) {
|
3243
|
+
google_protobuf_FileOptions *ret = google_protobuf_FileOptions_new(arena);
|
3244
|
+
if (!ret) return NULL;
|
3245
|
+
if (!upb_decode(buf, size, ret, &google_protobuf_FileOptions_msginit, arena)) return NULL;
|
3246
|
+
return ret;
|
3247
|
+
}
|
3248
|
+
UPB_INLINE google_protobuf_FileOptions *google_protobuf_FileOptions_parse_ex(const char *buf, size_t size,
|
3249
|
+
const upb_extreg *extreg, int options,
|
3250
|
+
upb_arena *arena) {
|
3251
|
+
google_protobuf_FileOptions *ret = google_protobuf_FileOptions_new(arena);
|
3252
|
+
if (!ret) return NULL;
|
3253
|
+
if (!_upb_decode(buf, size, ret, &google_protobuf_FileOptions_msginit, extreg, options, arena)) {
|
3254
|
+
return NULL;
|
3255
|
+
}
|
3256
|
+
return ret;
|
3257
|
+
}
|
3258
|
+
UPB_INLINE char *google_protobuf_FileOptions_serialize(const google_protobuf_FileOptions *msg, upb_arena *arena, size_t *len) {
|
3259
|
+
return upb_encode(msg, &google_protobuf_FileOptions_msginit, arena, len);
|
3260
|
+
}
|
3261
|
+
|
3262
|
+
UPB_INLINE bool google_protobuf_FileOptions_has_java_package(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 1); }
|
3263
|
+
UPB_INLINE upb_strview google_protobuf_FileOptions_java_package(const google_protobuf_FileOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(20, 24), upb_strview); }
|
3264
|
+
UPB_INLINE bool google_protobuf_FileOptions_has_java_outer_classname(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 2); }
|
3265
|
+
UPB_INLINE upb_strview google_protobuf_FileOptions_java_outer_classname(const google_protobuf_FileOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(28, 40), upb_strview); }
|
3266
|
+
UPB_INLINE bool google_protobuf_FileOptions_has_optimize_for(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 3); }
|
3267
|
+
UPB_INLINE int32_t google_protobuf_FileOptions_optimize_for(const google_protobuf_FileOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(4, 4), int32_t); }
|
3268
|
+
UPB_INLINE bool google_protobuf_FileOptions_has_java_multiple_files(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 4); }
|
3269
|
+
UPB_INLINE bool google_protobuf_FileOptions_java_multiple_files(const google_protobuf_FileOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(8, 8), bool); }
|
3270
|
+
UPB_INLINE bool google_protobuf_FileOptions_has_go_package(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 5); }
|
3271
|
+
UPB_INLINE upb_strview google_protobuf_FileOptions_go_package(const google_protobuf_FileOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(36, 56), upb_strview); }
|
3272
|
+
UPB_INLINE bool google_protobuf_FileOptions_has_cc_generic_services(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 6); }
|
3273
|
+
UPB_INLINE bool google_protobuf_FileOptions_cc_generic_services(const google_protobuf_FileOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(9, 9), bool); }
|
3274
|
+
UPB_INLINE bool google_protobuf_FileOptions_has_java_generic_services(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 7); }
|
3275
|
+
UPB_INLINE bool google_protobuf_FileOptions_java_generic_services(const google_protobuf_FileOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(10, 10), bool); }
|
3276
|
+
UPB_INLINE bool google_protobuf_FileOptions_has_py_generic_services(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 8); }
|
3277
|
+
UPB_INLINE bool google_protobuf_FileOptions_py_generic_services(const google_protobuf_FileOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(11, 11), bool); }
|
3278
|
+
UPB_INLINE bool google_protobuf_FileOptions_has_java_generate_equals_and_hash(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 9); }
|
3279
|
+
UPB_INLINE bool google_protobuf_FileOptions_java_generate_equals_and_hash(const google_protobuf_FileOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(12, 12), bool); }
|
3280
|
+
UPB_INLINE bool google_protobuf_FileOptions_has_deprecated(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 10); }
|
3281
|
+
UPB_INLINE bool google_protobuf_FileOptions_deprecated(const google_protobuf_FileOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(13, 13), bool); }
|
3282
|
+
UPB_INLINE bool google_protobuf_FileOptions_has_java_string_check_utf8(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 11); }
|
3283
|
+
UPB_INLINE bool google_protobuf_FileOptions_java_string_check_utf8(const google_protobuf_FileOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(14, 14), bool); }
|
3284
|
+
UPB_INLINE bool google_protobuf_FileOptions_has_cc_enable_arenas(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 12); }
|
3285
|
+
UPB_INLINE bool google_protobuf_FileOptions_cc_enable_arenas(const google_protobuf_FileOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(15, 15), bool); }
|
3286
|
+
UPB_INLINE bool google_protobuf_FileOptions_has_objc_class_prefix(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 13); }
|
3287
|
+
UPB_INLINE upb_strview google_protobuf_FileOptions_objc_class_prefix(const google_protobuf_FileOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(44, 72), upb_strview); }
|
3288
|
+
UPB_INLINE bool google_protobuf_FileOptions_has_csharp_namespace(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 14); }
|
3289
|
+
UPB_INLINE upb_strview google_protobuf_FileOptions_csharp_namespace(const google_protobuf_FileOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(52, 88), upb_strview); }
|
3290
|
+
UPB_INLINE bool google_protobuf_FileOptions_has_swift_prefix(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 15); }
|
3291
|
+
UPB_INLINE upb_strview google_protobuf_FileOptions_swift_prefix(const google_protobuf_FileOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(60, 104), upb_strview); }
|
3292
|
+
UPB_INLINE bool google_protobuf_FileOptions_has_php_class_prefix(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 16); }
|
3293
|
+
UPB_INLINE upb_strview google_protobuf_FileOptions_php_class_prefix(const google_protobuf_FileOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(68, 120), upb_strview); }
|
3294
|
+
UPB_INLINE bool google_protobuf_FileOptions_has_php_namespace(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 17); }
|
3295
|
+
UPB_INLINE upb_strview google_protobuf_FileOptions_php_namespace(const google_protobuf_FileOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(76, 136), upb_strview); }
|
3296
|
+
UPB_INLINE bool google_protobuf_FileOptions_has_php_generic_services(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 18); }
|
3297
|
+
UPB_INLINE bool google_protobuf_FileOptions_php_generic_services(const google_protobuf_FileOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(16, 16), bool); }
|
3298
|
+
UPB_INLINE bool google_protobuf_FileOptions_has_php_metadata_namespace(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 19); }
|
3299
|
+
UPB_INLINE upb_strview google_protobuf_FileOptions_php_metadata_namespace(const google_protobuf_FileOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(84, 152), upb_strview); }
|
3300
|
+
UPB_INLINE bool google_protobuf_FileOptions_has_ruby_package(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 20); }
|
3301
|
+
UPB_INLINE upb_strview google_protobuf_FileOptions_ruby_package(const google_protobuf_FileOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(92, 168), upb_strview); }
|
3302
|
+
UPB_INLINE bool google_protobuf_FileOptions_has_uninterpreted_option(const google_protobuf_FileOptions *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(100, 184)); }
|
3303
|
+
UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_FileOptions_uninterpreted_option(const google_protobuf_FileOptions *msg, size_t *len) { return (const google_protobuf_UninterpretedOption* const*)_upb_array_accessor(msg, UPB_SIZE(100, 184), len); }
|
3304
|
+
|
3305
|
+
UPB_INLINE void google_protobuf_FileOptions_set_java_package(google_protobuf_FileOptions *msg, upb_strview value) {
|
3306
|
+
_upb_sethas(msg, 1);
|
3307
|
+
*UPB_PTR_AT(msg, UPB_SIZE(20, 24), upb_strview) = value;
|
3308
|
+
}
|
3309
|
+
UPB_INLINE void google_protobuf_FileOptions_set_java_outer_classname(google_protobuf_FileOptions *msg, upb_strview value) {
|
3310
|
+
_upb_sethas(msg, 2);
|
3311
|
+
*UPB_PTR_AT(msg, UPB_SIZE(28, 40), upb_strview) = value;
|
3312
|
+
}
|
3313
|
+
UPB_INLINE void google_protobuf_FileOptions_set_optimize_for(google_protobuf_FileOptions *msg, int32_t value) {
|
3314
|
+
_upb_sethas(msg, 3);
|
3315
|
+
*UPB_PTR_AT(msg, UPB_SIZE(4, 4), int32_t) = value;
|
3316
|
+
}
|
3317
|
+
UPB_INLINE void google_protobuf_FileOptions_set_java_multiple_files(google_protobuf_FileOptions *msg, bool value) {
|
3318
|
+
_upb_sethas(msg, 4);
|
3319
|
+
*UPB_PTR_AT(msg, UPB_SIZE(8, 8), bool) = value;
|
3320
|
+
}
|
3321
|
+
UPB_INLINE void google_protobuf_FileOptions_set_go_package(google_protobuf_FileOptions *msg, upb_strview value) {
|
3322
|
+
_upb_sethas(msg, 5);
|
3323
|
+
*UPB_PTR_AT(msg, UPB_SIZE(36, 56), upb_strview) = value;
|
3324
|
+
}
|
3325
|
+
UPB_INLINE void google_protobuf_FileOptions_set_cc_generic_services(google_protobuf_FileOptions *msg, bool value) {
|
3326
|
+
_upb_sethas(msg, 6);
|
3327
|
+
*UPB_PTR_AT(msg, UPB_SIZE(9, 9), bool) = value;
|
3328
|
+
}
|
3329
|
+
UPB_INLINE void google_protobuf_FileOptions_set_java_generic_services(google_protobuf_FileOptions *msg, bool value) {
|
3330
|
+
_upb_sethas(msg, 7);
|
3331
|
+
*UPB_PTR_AT(msg, UPB_SIZE(10, 10), bool) = value;
|
3332
|
+
}
|
3333
|
+
UPB_INLINE void google_protobuf_FileOptions_set_py_generic_services(google_protobuf_FileOptions *msg, bool value) {
|
3334
|
+
_upb_sethas(msg, 8);
|
3335
|
+
*UPB_PTR_AT(msg, UPB_SIZE(11, 11), bool) = value;
|
3336
|
+
}
|
3337
|
+
UPB_INLINE void google_protobuf_FileOptions_set_java_generate_equals_and_hash(google_protobuf_FileOptions *msg, bool value) {
|
3338
|
+
_upb_sethas(msg, 9);
|
3339
|
+
*UPB_PTR_AT(msg, UPB_SIZE(12, 12), bool) = value;
|
3340
|
+
}
|
3341
|
+
UPB_INLINE void google_protobuf_FileOptions_set_deprecated(google_protobuf_FileOptions *msg, bool value) {
|
3342
|
+
_upb_sethas(msg, 10);
|
3343
|
+
*UPB_PTR_AT(msg, UPB_SIZE(13, 13), bool) = value;
|
3344
|
+
}
|
3345
|
+
UPB_INLINE void google_protobuf_FileOptions_set_java_string_check_utf8(google_protobuf_FileOptions *msg, bool value) {
|
3346
|
+
_upb_sethas(msg, 11);
|
3347
|
+
*UPB_PTR_AT(msg, UPB_SIZE(14, 14), bool) = value;
|
3348
|
+
}
|
3349
|
+
UPB_INLINE void google_protobuf_FileOptions_set_cc_enable_arenas(google_protobuf_FileOptions *msg, bool value) {
|
3350
|
+
_upb_sethas(msg, 12);
|
3351
|
+
*UPB_PTR_AT(msg, UPB_SIZE(15, 15), bool) = value;
|
3352
|
+
}
|
3353
|
+
UPB_INLINE void google_protobuf_FileOptions_set_objc_class_prefix(google_protobuf_FileOptions *msg, upb_strview value) {
|
3354
|
+
_upb_sethas(msg, 13);
|
3355
|
+
*UPB_PTR_AT(msg, UPB_SIZE(44, 72), upb_strview) = value;
|
3356
|
+
}
|
3357
|
+
UPB_INLINE void google_protobuf_FileOptions_set_csharp_namespace(google_protobuf_FileOptions *msg, upb_strview value) {
|
3358
|
+
_upb_sethas(msg, 14);
|
3359
|
+
*UPB_PTR_AT(msg, UPB_SIZE(52, 88), upb_strview) = value;
|
3360
|
+
}
|
3361
|
+
UPB_INLINE void google_protobuf_FileOptions_set_swift_prefix(google_protobuf_FileOptions *msg, upb_strview value) {
|
3362
|
+
_upb_sethas(msg, 15);
|
3363
|
+
*UPB_PTR_AT(msg, UPB_SIZE(60, 104), upb_strview) = value;
|
3364
|
+
}
|
3365
|
+
UPB_INLINE void google_protobuf_FileOptions_set_php_class_prefix(google_protobuf_FileOptions *msg, upb_strview value) {
|
3366
|
+
_upb_sethas(msg, 16);
|
3367
|
+
*UPB_PTR_AT(msg, UPB_SIZE(68, 120), upb_strview) = value;
|
3368
|
+
}
|
3369
|
+
UPB_INLINE void google_protobuf_FileOptions_set_php_namespace(google_protobuf_FileOptions *msg, upb_strview value) {
|
3370
|
+
_upb_sethas(msg, 17);
|
3371
|
+
*UPB_PTR_AT(msg, UPB_SIZE(76, 136), upb_strview) = value;
|
3372
|
+
}
|
3373
|
+
UPB_INLINE void google_protobuf_FileOptions_set_php_generic_services(google_protobuf_FileOptions *msg, bool value) {
|
3374
|
+
_upb_sethas(msg, 18);
|
3375
|
+
*UPB_PTR_AT(msg, UPB_SIZE(16, 16), bool) = value;
|
3376
|
+
}
|
3377
|
+
UPB_INLINE void google_protobuf_FileOptions_set_php_metadata_namespace(google_protobuf_FileOptions *msg, upb_strview value) {
|
3378
|
+
_upb_sethas(msg, 19);
|
3379
|
+
*UPB_PTR_AT(msg, UPB_SIZE(84, 152), upb_strview) = value;
|
3380
|
+
}
|
3381
|
+
UPB_INLINE void google_protobuf_FileOptions_set_ruby_package(google_protobuf_FileOptions *msg, upb_strview value) {
|
3382
|
+
_upb_sethas(msg, 20);
|
3383
|
+
*UPB_PTR_AT(msg, UPB_SIZE(92, 168), upb_strview) = value;
|
3384
|
+
}
|
3385
|
+
UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FileOptions_mutable_uninterpreted_option(google_protobuf_FileOptions *msg, size_t *len) {
|
3386
|
+
return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, UPB_SIZE(100, 184), len);
|
3387
|
+
}
|
3388
|
+
UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FileOptions_resize_uninterpreted_option(google_protobuf_FileOptions *msg, size_t len, upb_arena *arena) {
|
3389
|
+
return (google_protobuf_UninterpretedOption**)_upb_array_resize_accessor2(msg, UPB_SIZE(100, 184), len, UPB_SIZE(2, 3), arena);
|
3390
|
+
}
|
3391
|
+
UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_FileOptions_add_uninterpreted_option(google_protobuf_FileOptions *msg, upb_arena *arena) {
|
3392
|
+
struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)_upb_msg_new(&google_protobuf_UninterpretedOption_msginit, arena);
|
3393
|
+
bool ok = _upb_array_append_accessor2(
|
3394
|
+
msg, UPB_SIZE(100, 184), UPB_SIZE(2, 3), &sub, arena);
|
3395
|
+
if (!ok) return NULL;
|
3396
|
+
return sub;
|
3397
|
+
}
|
3398
|
+
|
3399
|
+
/* google.protobuf.MessageOptions */
|
3400
|
+
|
3401
|
+
UPB_INLINE google_protobuf_MessageOptions *google_protobuf_MessageOptions_new(upb_arena *arena) {
|
3402
|
+
return (google_protobuf_MessageOptions *)_upb_msg_new(&google_protobuf_MessageOptions_msginit, arena);
|
3403
|
+
}
|
3404
|
+
UPB_INLINE google_protobuf_MessageOptions *google_protobuf_MessageOptions_parse(const char *buf, size_t size,
|
3405
|
+
upb_arena *arena) {
|
3406
|
+
google_protobuf_MessageOptions *ret = google_protobuf_MessageOptions_new(arena);
|
3407
|
+
if (!ret) return NULL;
|
3408
|
+
if (!upb_decode(buf, size, ret, &google_protobuf_MessageOptions_msginit, arena)) return NULL;
|
3409
|
+
return ret;
|
3410
|
+
}
|
3411
|
+
UPB_INLINE google_protobuf_MessageOptions *google_protobuf_MessageOptions_parse_ex(const char *buf, size_t size,
|
3412
|
+
const upb_extreg *extreg, int options,
|
3413
|
+
upb_arena *arena) {
|
3414
|
+
google_protobuf_MessageOptions *ret = google_protobuf_MessageOptions_new(arena);
|
3415
|
+
if (!ret) return NULL;
|
3416
|
+
if (!_upb_decode(buf, size, ret, &google_protobuf_MessageOptions_msginit, extreg, options, arena)) {
|
3417
|
+
return NULL;
|
3418
|
+
}
|
3419
|
+
return ret;
|
3420
|
+
}
|
3421
|
+
UPB_INLINE char *google_protobuf_MessageOptions_serialize(const google_protobuf_MessageOptions *msg, upb_arena *arena, size_t *len) {
|
3422
|
+
return upb_encode(msg, &google_protobuf_MessageOptions_msginit, arena, len);
|
3423
|
+
}
|
3424
|
+
|
3425
|
+
UPB_INLINE bool google_protobuf_MessageOptions_has_message_set_wire_format(const google_protobuf_MessageOptions *msg) { return _upb_hasbit(msg, 1); }
|
3426
|
+
UPB_INLINE bool google_protobuf_MessageOptions_message_set_wire_format(const google_protobuf_MessageOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(1, 1), bool); }
|
3427
|
+
UPB_INLINE bool google_protobuf_MessageOptions_has_no_standard_descriptor_accessor(const google_protobuf_MessageOptions *msg) { return _upb_hasbit(msg, 2); }
|
3428
|
+
UPB_INLINE bool google_protobuf_MessageOptions_no_standard_descriptor_accessor(const google_protobuf_MessageOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(2, 2), bool); }
|
3429
|
+
UPB_INLINE bool google_protobuf_MessageOptions_has_deprecated(const google_protobuf_MessageOptions *msg) { return _upb_hasbit(msg, 3); }
|
3430
|
+
UPB_INLINE bool google_protobuf_MessageOptions_deprecated(const google_protobuf_MessageOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(3, 3), bool); }
|
3431
|
+
UPB_INLINE bool google_protobuf_MessageOptions_has_map_entry(const google_protobuf_MessageOptions *msg) { return _upb_hasbit(msg, 4); }
|
3432
|
+
UPB_INLINE bool google_protobuf_MessageOptions_map_entry(const google_protobuf_MessageOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(4, 4), bool); }
|
3433
|
+
UPB_INLINE bool google_protobuf_MessageOptions_has_uninterpreted_option(const google_protobuf_MessageOptions *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(8, 8)); }
|
3434
|
+
UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_MessageOptions_uninterpreted_option(const google_protobuf_MessageOptions *msg, size_t *len) { return (const google_protobuf_UninterpretedOption* const*)_upb_array_accessor(msg, UPB_SIZE(8, 8), len); }
|
3435
|
+
|
3436
|
+
UPB_INLINE void google_protobuf_MessageOptions_set_message_set_wire_format(google_protobuf_MessageOptions *msg, bool value) {
|
3437
|
+
_upb_sethas(msg, 1);
|
3438
|
+
*UPB_PTR_AT(msg, UPB_SIZE(1, 1), bool) = value;
|
3439
|
+
}
|
3440
|
+
UPB_INLINE void google_protobuf_MessageOptions_set_no_standard_descriptor_accessor(google_protobuf_MessageOptions *msg, bool value) {
|
3441
|
+
_upb_sethas(msg, 2);
|
3442
|
+
*UPB_PTR_AT(msg, UPB_SIZE(2, 2), bool) = value;
|
3443
|
+
}
|
3444
|
+
UPB_INLINE void google_protobuf_MessageOptions_set_deprecated(google_protobuf_MessageOptions *msg, bool value) {
|
3445
|
+
_upb_sethas(msg, 3);
|
3446
|
+
*UPB_PTR_AT(msg, UPB_SIZE(3, 3), bool) = value;
|
3447
|
+
}
|
3448
|
+
UPB_INLINE void google_protobuf_MessageOptions_set_map_entry(google_protobuf_MessageOptions *msg, bool value) {
|
3449
|
+
_upb_sethas(msg, 4);
|
3450
|
+
*UPB_PTR_AT(msg, UPB_SIZE(4, 4), bool) = value;
|
3451
|
+
}
|
3452
|
+
UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_MessageOptions_mutable_uninterpreted_option(google_protobuf_MessageOptions *msg, size_t *len) {
|
3453
|
+
return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, UPB_SIZE(8, 8), len);
|
3454
|
+
}
|
3455
|
+
UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_MessageOptions_resize_uninterpreted_option(google_protobuf_MessageOptions *msg, size_t len, upb_arena *arena) {
|
3456
|
+
return (google_protobuf_UninterpretedOption**)_upb_array_resize_accessor2(msg, UPB_SIZE(8, 8), len, UPB_SIZE(2, 3), arena);
|
3457
|
+
}
|
3458
|
+
UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_MessageOptions_add_uninterpreted_option(google_protobuf_MessageOptions *msg, upb_arena *arena) {
|
3459
|
+
struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)_upb_msg_new(&google_protobuf_UninterpretedOption_msginit, arena);
|
3460
|
+
bool ok = _upb_array_append_accessor2(
|
3461
|
+
msg, UPB_SIZE(8, 8), UPB_SIZE(2, 3), &sub, arena);
|
3462
|
+
if (!ok) return NULL;
|
3463
|
+
return sub;
|
3464
|
+
}
|
3465
|
+
|
3466
|
+
/* google.protobuf.FieldOptions */
|
3467
|
+
|
3468
|
+
UPB_INLINE google_protobuf_FieldOptions *google_protobuf_FieldOptions_new(upb_arena *arena) {
|
3469
|
+
return (google_protobuf_FieldOptions *)_upb_msg_new(&google_protobuf_FieldOptions_msginit, arena);
|
3470
|
+
}
|
3471
|
+
UPB_INLINE google_protobuf_FieldOptions *google_protobuf_FieldOptions_parse(const char *buf, size_t size,
|
3472
|
+
upb_arena *arena) {
|
3473
|
+
google_protobuf_FieldOptions *ret = google_protobuf_FieldOptions_new(arena);
|
3474
|
+
if (!ret) return NULL;
|
3475
|
+
if (!upb_decode(buf, size, ret, &google_protobuf_FieldOptions_msginit, arena)) return NULL;
|
3476
|
+
return ret;
|
3477
|
+
}
|
3478
|
+
UPB_INLINE google_protobuf_FieldOptions *google_protobuf_FieldOptions_parse_ex(const char *buf, size_t size,
|
3479
|
+
const upb_extreg *extreg, int options,
|
3480
|
+
upb_arena *arena) {
|
3481
|
+
google_protobuf_FieldOptions *ret = google_protobuf_FieldOptions_new(arena);
|
3482
|
+
if (!ret) return NULL;
|
3483
|
+
if (!_upb_decode(buf, size, ret, &google_protobuf_FieldOptions_msginit, extreg, options, arena)) {
|
3484
|
+
return NULL;
|
3485
|
+
}
|
3486
|
+
return ret;
|
3487
|
+
}
|
3488
|
+
UPB_INLINE char *google_protobuf_FieldOptions_serialize(const google_protobuf_FieldOptions *msg, upb_arena *arena, size_t *len) {
|
3489
|
+
return upb_encode(msg, &google_protobuf_FieldOptions_msginit, arena, len);
|
3490
|
+
}
|
3491
|
+
|
3492
|
+
UPB_INLINE bool google_protobuf_FieldOptions_has_ctype(const google_protobuf_FieldOptions *msg) { return _upb_hasbit(msg, 1); }
|
3493
|
+
UPB_INLINE int32_t google_protobuf_FieldOptions_ctype(const google_protobuf_FieldOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(4, 4), int32_t); }
|
3494
|
+
UPB_INLINE bool google_protobuf_FieldOptions_has_packed(const google_protobuf_FieldOptions *msg) { return _upb_hasbit(msg, 2); }
|
3495
|
+
UPB_INLINE bool google_protobuf_FieldOptions_packed(const google_protobuf_FieldOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(12, 12), bool); }
|
3496
|
+
UPB_INLINE bool google_protobuf_FieldOptions_has_deprecated(const google_protobuf_FieldOptions *msg) { return _upb_hasbit(msg, 3); }
|
3497
|
+
UPB_INLINE bool google_protobuf_FieldOptions_deprecated(const google_protobuf_FieldOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(13, 13), bool); }
|
3498
|
+
UPB_INLINE bool google_protobuf_FieldOptions_has_lazy(const google_protobuf_FieldOptions *msg) { return _upb_hasbit(msg, 4); }
|
3499
|
+
UPB_INLINE bool google_protobuf_FieldOptions_lazy(const google_protobuf_FieldOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(14, 14), bool); }
|
3500
|
+
UPB_INLINE bool google_protobuf_FieldOptions_has_jstype(const google_protobuf_FieldOptions *msg) { return _upb_hasbit(msg, 5); }
|
3501
|
+
UPB_INLINE int32_t google_protobuf_FieldOptions_jstype(const google_protobuf_FieldOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(8, 8), int32_t); }
|
3502
|
+
UPB_INLINE bool google_protobuf_FieldOptions_has_weak(const google_protobuf_FieldOptions *msg) { return _upb_hasbit(msg, 6); }
|
3503
|
+
UPB_INLINE bool google_protobuf_FieldOptions_weak(const google_protobuf_FieldOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(15, 15), bool); }
|
3504
|
+
UPB_INLINE bool google_protobuf_FieldOptions_has_uninterpreted_option(const google_protobuf_FieldOptions *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(16, 16)); }
|
3505
|
+
UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_FieldOptions_uninterpreted_option(const google_protobuf_FieldOptions *msg, size_t *len) { return (const google_protobuf_UninterpretedOption* const*)_upb_array_accessor(msg, UPB_SIZE(16, 16), len); }
|
3506
|
+
|
3507
|
+
UPB_INLINE void google_protobuf_FieldOptions_set_ctype(google_protobuf_FieldOptions *msg, int32_t value) {
|
3508
|
+
_upb_sethas(msg, 1);
|
3509
|
+
*UPB_PTR_AT(msg, UPB_SIZE(4, 4), int32_t) = value;
|
3510
|
+
}
|
3511
|
+
UPB_INLINE void google_protobuf_FieldOptions_set_packed(google_protobuf_FieldOptions *msg, bool value) {
|
3512
|
+
_upb_sethas(msg, 2);
|
3513
|
+
*UPB_PTR_AT(msg, UPB_SIZE(12, 12), bool) = value;
|
3514
|
+
}
|
3515
|
+
UPB_INLINE void google_protobuf_FieldOptions_set_deprecated(google_protobuf_FieldOptions *msg, bool value) {
|
3516
|
+
_upb_sethas(msg, 3);
|
3517
|
+
*UPB_PTR_AT(msg, UPB_SIZE(13, 13), bool) = value;
|
3518
|
+
}
|
3519
|
+
UPB_INLINE void google_protobuf_FieldOptions_set_lazy(google_protobuf_FieldOptions *msg, bool value) {
|
3520
|
+
_upb_sethas(msg, 4);
|
3521
|
+
*UPB_PTR_AT(msg, UPB_SIZE(14, 14), bool) = value;
|
3522
|
+
}
|
3523
|
+
UPB_INLINE void google_protobuf_FieldOptions_set_jstype(google_protobuf_FieldOptions *msg, int32_t value) {
|
3524
|
+
_upb_sethas(msg, 5);
|
3525
|
+
*UPB_PTR_AT(msg, UPB_SIZE(8, 8), int32_t) = value;
|
3526
|
+
}
|
3527
|
+
UPB_INLINE void google_protobuf_FieldOptions_set_weak(google_protobuf_FieldOptions *msg, bool value) {
|
3528
|
+
_upb_sethas(msg, 6);
|
3529
|
+
*UPB_PTR_AT(msg, UPB_SIZE(15, 15), bool) = value;
|
3530
|
+
}
|
3531
|
+
UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FieldOptions_mutable_uninterpreted_option(google_protobuf_FieldOptions *msg, size_t *len) {
|
3532
|
+
return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, UPB_SIZE(16, 16), len);
|
3533
|
+
}
|
3534
|
+
UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FieldOptions_resize_uninterpreted_option(google_protobuf_FieldOptions *msg, size_t len, upb_arena *arena) {
|
3535
|
+
return (google_protobuf_UninterpretedOption**)_upb_array_resize_accessor2(msg, UPB_SIZE(16, 16), len, UPB_SIZE(2, 3), arena);
|
3536
|
+
}
|
3537
|
+
UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_FieldOptions_add_uninterpreted_option(google_protobuf_FieldOptions *msg, upb_arena *arena) {
|
3538
|
+
struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)_upb_msg_new(&google_protobuf_UninterpretedOption_msginit, arena);
|
3539
|
+
bool ok = _upb_array_append_accessor2(
|
3540
|
+
msg, UPB_SIZE(16, 16), UPB_SIZE(2, 3), &sub, arena);
|
3541
|
+
if (!ok) return NULL;
|
3542
|
+
return sub;
|
3543
|
+
}
|
3544
|
+
|
3545
|
+
/* google.protobuf.OneofOptions */
|
3546
|
+
|
3547
|
+
UPB_INLINE google_protobuf_OneofOptions *google_protobuf_OneofOptions_new(upb_arena *arena) {
|
3548
|
+
return (google_protobuf_OneofOptions *)_upb_msg_new(&google_protobuf_OneofOptions_msginit, arena);
|
3549
|
+
}
|
3550
|
+
UPB_INLINE google_protobuf_OneofOptions *google_protobuf_OneofOptions_parse(const char *buf, size_t size,
|
3551
|
+
upb_arena *arena) {
|
3552
|
+
google_protobuf_OneofOptions *ret = google_protobuf_OneofOptions_new(arena);
|
3553
|
+
if (!ret) return NULL;
|
3554
|
+
if (!upb_decode(buf, size, ret, &google_protobuf_OneofOptions_msginit, arena)) return NULL;
|
3555
|
+
return ret;
|
3556
|
+
}
|
3557
|
+
UPB_INLINE google_protobuf_OneofOptions *google_protobuf_OneofOptions_parse_ex(const char *buf, size_t size,
|
3558
|
+
const upb_extreg *extreg, int options,
|
3559
|
+
upb_arena *arena) {
|
3560
|
+
google_protobuf_OneofOptions *ret = google_protobuf_OneofOptions_new(arena);
|
3561
|
+
if (!ret) return NULL;
|
3562
|
+
if (!_upb_decode(buf, size, ret, &google_protobuf_OneofOptions_msginit, extreg, options, arena)) {
|
3563
|
+
return NULL;
|
3564
|
+
}
|
3565
|
+
return ret;
|
3566
|
+
}
|
3567
|
+
UPB_INLINE char *google_protobuf_OneofOptions_serialize(const google_protobuf_OneofOptions *msg, upb_arena *arena, size_t *len) {
|
3568
|
+
return upb_encode(msg, &google_protobuf_OneofOptions_msginit, arena, len);
|
3569
|
+
}
|
3570
|
+
|
3571
|
+
UPB_INLINE bool google_protobuf_OneofOptions_has_uninterpreted_option(const google_protobuf_OneofOptions *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(0, 0)); }
|
3572
|
+
UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_OneofOptions_uninterpreted_option(const google_protobuf_OneofOptions *msg, size_t *len) { return (const google_protobuf_UninterpretedOption* const*)_upb_array_accessor(msg, UPB_SIZE(0, 0), len); }
|
3573
|
+
|
3574
|
+
UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_OneofOptions_mutable_uninterpreted_option(google_protobuf_OneofOptions *msg, size_t *len) {
|
3575
|
+
return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, UPB_SIZE(0, 0), len);
|
3576
|
+
}
|
3577
|
+
UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_OneofOptions_resize_uninterpreted_option(google_protobuf_OneofOptions *msg, size_t len, upb_arena *arena) {
|
3578
|
+
return (google_protobuf_UninterpretedOption**)_upb_array_resize_accessor2(msg, UPB_SIZE(0, 0), len, UPB_SIZE(2, 3), arena);
|
3579
|
+
}
|
3580
|
+
UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_OneofOptions_add_uninterpreted_option(google_protobuf_OneofOptions *msg, upb_arena *arena) {
|
3581
|
+
struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)_upb_msg_new(&google_protobuf_UninterpretedOption_msginit, arena);
|
3582
|
+
bool ok = _upb_array_append_accessor2(
|
3583
|
+
msg, UPB_SIZE(0, 0), UPB_SIZE(2, 3), &sub, arena);
|
3584
|
+
if (!ok) return NULL;
|
3585
|
+
return sub;
|
3586
|
+
}
|
3587
|
+
|
3588
|
+
/* google.protobuf.EnumOptions */
|
3589
|
+
|
3590
|
+
UPB_INLINE google_protobuf_EnumOptions *google_protobuf_EnumOptions_new(upb_arena *arena) {
|
3591
|
+
return (google_protobuf_EnumOptions *)_upb_msg_new(&google_protobuf_EnumOptions_msginit, arena);
|
3592
|
+
}
|
3593
|
+
UPB_INLINE google_protobuf_EnumOptions *google_protobuf_EnumOptions_parse(const char *buf, size_t size,
|
3594
|
+
upb_arena *arena) {
|
3595
|
+
google_protobuf_EnumOptions *ret = google_protobuf_EnumOptions_new(arena);
|
3596
|
+
if (!ret) return NULL;
|
3597
|
+
if (!upb_decode(buf, size, ret, &google_protobuf_EnumOptions_msginit, arena)) return NULL;
|
3598
|
+
return ret;
|
3599
|
+
}
|
3600
|
+
UPB_INLINE google_protobuf_EnumOptions *google_protobuf_EnumOptions_parse_ex(const char *buf, size_t size,
|
3601
|
+
const upb_extreg *extreg, int options,
|
3602
|
+
upb_arena *arena) {
|
3603
|
+
google_protobuf_EnumOptions *ret = google_protobuf_EnumOptions_new(arena);
|
3604
|
+
if (!ret) return NULL;
|
3605
|
+
if (!_upb_decode(buf, size, ret, &google_protobuf_EnumOptions_msginit, extreg, options, arena)) {
|
3606
|
+
return NULL;
|
3607
|
+
}
|
3608
|
+
return ret;
|
3609
|
+
}
|
3610
|
+
UPB_INLINE char *google_protobuf_EnumOptions_serialize(const google_protobuf_EnumOptions *msg, upb_arena *arena, size_t *len) {
|
3611
|
+
return upb_encode(msg, &google_protobuf_EnumOptions_msginit, arena, len);
|
3612
|
+
}
|
3613
|
+
|
3614
|
+
UPB_INLINE bool google_protobuf_EnumOptions_has_allow_alias(const google_protobuf_EnumOptions *msg) { return _upb_hasbit(msg, 1); }
|
3615
|
+
UPB_INLINE bool google_protobuf_EnumOptions_allow_alias(const google_protobuf_EnumOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(1, 1), bool); }
|
3616
|
+
UPB_INLINE bool google_protobuf_EnumOptions_has_deprecated(const google_protobuf_EnumOptions *msg) { return _upb_hasbit(msg, 2); }
|
3617
|
+
UPB_INLINE bool google_protobuf_EnumOptions_deprecated(const google_protobuf_EnumOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(2, 2), bool); }
|
3618
|
+
UPB_INLINE bool google_protobuf_EnumOptions_has_uninterpreted_option(const google_protobuf_EnumOptions *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(4, 8)); }
|
3619
|
+
UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_EnumOptions_uninterpreted_option(const google_protobuf_EnumOptions *msg, size_t *len) { return (const google_protobuf_UninterpretedOption* const*)_upb_array_accessor(msg, UPB_SIZE(4, 8), len); }
|
3620
|
+
|
3621
|
+
UPB_INLINE void google_protobuf_EnumOptions_set_allow_alias(google_protobuf_EnumOptions *msg, bool value) {
|
3622
|
+
_upb_sethas(msg, 1);
|
3623
|
+
*UPB_PTR_AT(msg, UPB_SIZE(1, 1), bool) = value;
|
3624
|
+
}
|
3625
|
+
UPB_INLINE void google_protobuf_EnumOptions_set_deprecated(google_protobuf_EnumOptions *msg, bool value) {
|
3626
|
+
_upb_sethas(msg, 2);
|
3627
|
+
*UPB_PTR_AT(msg, UPB_SIZE(2, 2), bool) = value;
|
3628
|
+
}
|
3629
|
+
UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_EnumOptions_mutable_uninterpreted_option(google_protobuf_EnumOptions *msg, size_t *len) {
|
3630
|
+
return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, UPB_SIZE(4, 8), len);
|
3631
|
+
}
|
3632
|
+
UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_EnumOptions_resize_uninterpreted_option(google_protobuf_EnumOptions *msg, size_t len, upb_arena *arena) {
|
3633
|
+
return (google_protobuf_UninterpretedOption**)_upb_array_resize_accessor2(msg, UPB_SIZE(4, 8), len, UPB_SIZE(2, 3), arena);
|
3634
|
+
}
|
3635
|
+
UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_EnumOptions_add_uninterpreted_option(google_protobuf_EnumOptions *msg, upb_arena *arena) {
|
3636
|
+
struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)_upb_msg_new(&google_protobuf_UninterpretedOption_msginit, arena);
|
3637
|
+
bool ok = _upb_array_append_accessor2(
|
3638
|
+
msg, UPB_SIZE(4, 8), UPB_SIZE(2, 3), &sub, arena);
|
3639
|
+
if (!ok) return NULL;
|
3640
|
+
return sub;
|
3641
|
+
}
|
3642
|
+
|
3643
|
+
/* google.protobuf.EnumValueOptions */
|
3644
|
+
|
3645
|
+
UPB_INLINE google_protobuf_EnumValueOptions *google_protobuf_EnumValueOptions_new(upb_arena *arena) {
|
3646
|
+
return (google_protobuf_EnumValueOptions *)_upb_msg_new(&google_protobuf_EnumValueOptions_msginit, arena);
|
3647
|
+
}
|
3648
|
+
UPB_INLINE google_protobuf_EnumValueOptions *google_protobuf_EnumValueOptions_parse(const char *buf, size_t size,
|
3649
|
+
upb_arena *arena) {
|
3650
|
+
google_protobuf_EnumValueOptions *ret = google_protobuf_EnumValueOptions_new(arena);
|
3651
|
+
if (!ret) return NULL;
|
3652
|
+
if (!upb_decode(buf, size, ret, &google_protobuf_EnumValueOptions_msginit, arena)) return NULL;
|
3653
|
+
return ret;
|
3654
|
+
}
|
3655
|
+
UPB_INLINE google_protobuf_EnumValueOptions *google_protobuf_EnumValueOptions_parse_ex(const char *buf, size_t size,
|
3656
|
+
const upb_extreg *extreg, int options,
|
3657
|
+
upb_arena *arena) {
|
3658
|
+
google_protobuf_EnumValueOptions *ret = google_protobuf_EnumValueOptions_new(arena);
|
3659
|
+
if (!ret) return NULL;
|
3660
|
+
if (!_upb_decode(buf, size, ret, &google_protobuf_EnumValueOptions_msginit, extreg, options, arena)) {
|
3661
|
+
return NULL;
|
3662
|
+
}
|
3663
|
+
return ret;
|
3664
|
+
}
|
3665
|
+
UPB_INLINE char *google_protobuf_EnumValueOptions_serialize(const google_protobuf_EnumValueOptions *msg, upb_arena *arena, size_t *len) {
|
3666
|
+
return upb_encode(msg, &google_protobuf_EnumValueOptions_msginit, arena, len);
|
3667
|
+
}
|
3668
|
+
|
3669
|
+
UPB_INLINE bool google_protobuf_EnumValueOptions_has_deprecated(const google_protobuf_EnumValueOptions *msg) { return _upb_hasbit(msg, 1); }
|
3670
|
+
UPB_INLINE bool google_protobuf_EnumValueOptions_deprecated(const google_protobuf_EnumValueOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(1, 1), bool); }
|
3671
|
+
UPB_INLINE bool google_protobuf_EnumValueOptions_has_uninterpreted_option(const google_protobuf_EnumValueOptions *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(4, 8)); }
|
3672
|
+
UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_EnumValueOptions_uninterpreted_option(const google_protobuf_EnumValueOptions *msg, size_t *len) { return (const google_protobuf_UninterpretedOption* const*)_upb_array_accessor(msg, UPB_SIZE(4, 8), len); }
|
3673
|
+
|
3674
|
+
UPB_INLINE void google_protobuf_EnumValueOptions_set_deprecated(google_protobuf_EnumValueOptions *msg, bool value) {
|
3675
|
+
_upb_sethas(msg, 1);
|
3676
|
+
*UPB_PTR_AT(msg, UPB_SIZE(1, 1), bool) = value;
|
3677
|
+
}
|
3678
|
+
UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_EnumValueOptions_mutable_uninterpreted_option(google_protobuf_EnumValueOptions *msg, size_t *len) {
|
3679
|
+
return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, UPB_SIZE(4, 8), len);
|
3680
|
+
}
|
3681
|
+
UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_EnumValueOptions_resize_uninterpreted_option(google_protobuf_EnumValueOptions *msg, size_t len, upb_arena *arena) {
|
3682
|
+
return (google_protobuf_UninterpretedOption**)_upb_array_resize_accessor2(msg, UPB_SIZE(4, 8), len, UPB_SIZE(2, 3), arena);
|
3683
|
+
}
|
3684
|
+
UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_EnumValueOptions_add_uninterpreted_option(google_protobuf_EnumValueOptions *msg, upb_arena *arena) {
|
3685
|
+
struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)_upb_msg_new(&google_protobuf_UninterpretedOption_msginit, arena);
|
3686
|
+
bool ok = _upb_array_append_accessor2(
|
3687
|
+
msg, UPB_SIZE(4, 8), UPB_SIZE(2, 3), &sub, arena);
|
3688
|
+
if (!ok) return NULL;
|
3689
|
+
return sub;
|
3690
|
+
}
|
3691
|
+
|
3692
|
+
/* google.protobuf.ServiceOptions */
|
3693
|
+
|
3694
|
+
UPB_INLINE google_protobuf_ServiceOptions *google_protobuf_ServiceOptions_new(upb_arena *arena) {
|
3695
|
+
return (google_protobuf_ServiceOptions *)_upb_msg_new(&google_protobuf_ServiceOptions_msginit, arena);
|
3696
|
+
}
|
3697
|
+
UPB_INLINE google_protobuf_ServiceOptions *google_protobuf_ServiceOptions_parse(const char *buf, size_t size,
|
3698
|
+
upb_arena *arena) {
|
3699
|
+
google_protobuf_ServiceOptions *ret = google_protobuf_ServiceOptions_new(arena);
|
3700
|
+
if (!ret) return NULL;
|
3701
|
+
if (!upb_decode(buf, size, ret, &google_protobuf_ServiceOptions_msginit, arena)) return NULL;
|
3702
|
+
return ret;
|
3703
|
+
}
|
3704
|
+
UPB_INLINE google_protobuf_ServiceOptions *google_protobuf_ServiceOptions_parse_ex(const char *buf, size_t size,
|
3705
|
+
const upb_extreg *extreg, int options,
|
3706
|
+
upb_arena *arena) {
|
3707
|
+
google_protobuf_ServiceOptions *ret = google_protobuf_ServiceOptions_new(arena);
|
3708
|
+
if (!ret) return NULL;
|
3709
|
+
if (!_upb_decode(buf, size, ret, &google_protobuf_ServiceOptions_msginit, extreg, options, arena)) {
|
3710
|
+
return NULL;
|
3711
|
+
}
|
3712
|
+
return ret;
|
3713
|
+
}
|
3714
|
+
UPB_INLINE char *google_protobuf_ServiceOptions_serialize(const google_protobuf_ServiceOptions *msg, upb_arena *arena, size_t *len) {
|
3715
|
+
return upb_encode(msg, &google_protobuf_ServiceOptions_msginit, arena, len);
|
3716
|
+
}
|
3717
|
+
|
3718
|
+
UPB_INLINE bool google_protobuf_ServiceOptions_has_deprecated(const google_protobuf_ServiceOptions *msg) { return _upb_hasbit(msg, 1); }
|
3719
|
+
UPB_INLINE bool google_protobuf_ServiceOptions_deprecated(const google_protobuf_ServiceOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(1, 1), bool); }
|
3720
|
+
UPB_INLINE bool google_protobuf_ServiceOptions_has_uninterpreted_option(const google_protobuf_ServiceOptions *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(4, 8)); }
|
3721
|
+
UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_ServiceOptions_uninterpreted_option(const google_protobuf_ServiceOptions *msg, size_t *len) { return (const google_protobuf_UninterpretedOption* const*)_upb_array_accessor(msg, UPB_SIZE(4, 8), len); }
|
3722
|
+
|
3723
|
+
UPB_INLINE void google_protobuf_ServiceOptions_set_deprecated(google_protobuf_ServiceOptions *msg, bool value) {
|
3724
|
+
_upb_sethas(msg, 1);
|
3725
|
+
*UPB_PTR_AT(msg, UPB_SIZE(1, 1), bool) = value;
|
3726
|
+
}
|
3727
|
+
UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_ServiceOptions_mutable_uninterpreted_option(google_protobuf_ServiceOptions *msg, size_t *len) {
|
3728
|
+
return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, UPB_SIZE(4, 8), len);
|
3729
|
+
}
|
3730
|
+
UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_ServiceOptions_resize_uninterpreted_option(google_protobuf_ServiceOptions *msg, size_t len, upb_arena *arena) {
|
3731
|
+
return (google_protobuf_UninterpretedOption**)_upb_array_resize_accessor2(msg, UPB_SIZE(4, 8), len, UPB_SIZE(2, 3), arena);
|
3732
|
+
}
|
3733
|
+
UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_ServiceOptions_add_uninterpreted_option(google_protobuf_ServiceOptions *msg, upb_arena *arena) {
|
3734
|
+
struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)_upb_msg_new(&google_protobuf_UninterpretedOption_msginit, arena);
|
3735
|
+
bool ok = _upb_array_append_accessor2(
|
3736
|
+
msg, UPB_SIZE(4, 8), UPB_SIZE(2, 3), &sub, arena);
|
3737
|
+
if (!ok) return NULL;
|
3738
|
+
return sub;
|
3739
|
+
}
|
3740
|
+
|
3741
|
+
/* google.protobuf.MethodOptions */
|
3742
|
+
|
3743
|
+
UPB_INLINE google_protobuf_MethodOptions *google_protobuf_MethodOptions_new(upb_arena *arena) {
|
3744
|
+
return (google_protobuf_MethodOptions *)_upb_msg_new(&google_protobuf_MethodOptions_msginit, arena);
|
3745
|
+
}
|
3746
|
+
UPB_INLINE google_protobuf_MethodOptions *google_protobuf_MethodOptions_parse(const char *buf, size_t size,
|
3747
|
+
upb_arena *arena) {
|
3748
|
+
google_protobuf_MethodOptions *ret = google_protobuf_MethodOptions_new(arena);
|
3749
|
+
if (!ret) return NULL;
|
3750
|
+
if (!upb_decode(buf, size, ret, &google_protobuf_MethodOptions_msginit, arena)) return NULL;
|
3751
|
+
return ret;
|
3752
|
+
}
|
3753
|
+
UPB_INLINE google_protobuf_MethodOptions *google_protobuf_MethodOptions_parse_ex(const char *buf, size_t size,
|
3754
|
+
const upb_extreg *extreg, int options,
|
3755
|
+
upb_arena *arena) {
|
3756
|
+
google_protobuf_MethodOptions *ret = google_protobuf_MethodOptions_new(arena);
|
3757
|
+
if (!ret) return NULL;
|
3758
|
+
if (!_upb_decode(buf, size, ret, &google_protobuf_MethodOptions_msginit, extreg, options, arena)) {
|
3759
|
+
return NULL;
|
3760
|
+
}
|
3761
|
+
return ret;
|
3762
|
+
}
|
3763
|
+
UPB_INLINE char *google_protobuf_MethodOptions_serialize(const google_protobuf_MethodOptions *msg, upb_arena *arena, size_t *len) {
|
3764
|
+
return upb_encode(msg, &google_protobuf_MethodOptions_msginit, arena, len);
|
3765
|
+
}
|
3766
|
+
|
3767
|
+
UPB_INLINE bool google_protobuf_MethodOptions_has_deprecated(const google_protobuf_MethodOptions *msg) { return _upb_hasbit(msg, 1); }
|
3768
|
+
UPB_INLINE bool google_protobuf_MethodOptions_deprecated(const google_protobuf_MethodOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(8, 8), bool); }
|
3769
|
+
UPB_INLINE bool google_protobuf_MethodOptions_has_idempotency_level(const google_protobuf_MethodOptions *msg) { return _upb_hasbit(msg, 2); }
|
3770
|
+
UPB_INLINE int32_t google_protobuf_MethodOptions_idempotency_level(const google_protobuf_MethodOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(4, 4), int32_t); }
|
3771
|
+
UPB_INLINE bool google_protobuf_MethodOptions_has_uninterpreted_option(const google_protobuf_MethodOptions *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(12, 16)); }
|
3772
|
+
UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_MethodOptions_uninterpreted_option(const google_protobuf_MethodOptions *msg, size_t *len) { return (const google_protobuf_UninterpretedOption* const*)_upb_array_accessor(msg, UPB_SIZE(12, 16), len); }
|
3773
|
+
|
3774
|
+
UPB_INLINE void google_protobuf_MethodOptions_set_deprecated(google_protobuf_MethodOptions *msg, bool value) {
|
3775
|
+
_upb_sethas(msg, 1);
|
3776
|
+
*UPB_PTR_AT(msg, UPB_SIZE(8, 8), bool) = value;
|
3777
|
+
}
|
3778
|
+
UPB_INLINE void google_protobuf_MethodOptions_set_idempotency_level(google_protobuf_MethodOptions *msg, int32_t value) {
|
3779
|
+
_upb_sethas(msg, 2);
|
3780
|
+
*UPB_PTR_AT(msg, UPB_SIZE(4, 4), int32_t) = value;
|
3781
|
+
}
|
3782
|
+
UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_MethodOptions_mutable_uninterpreted_option(google_protobuf_MethodOptions *msg, size_t *len) {
|
3783
|
+
return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, UPB_SIZE(12, 16), len);
|
3784
|
+
}
|
3785
|
+
UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_MethodOptions_resize_uninterpreted_option(google_protobuf_MethodOptions *msg, size_t len, upb_arena *arena) {
|
3786
|
+
return (google_protobuf_UninterpretedOption**)_upb_array_resize_accessor2(msg, UPB_SIZE(12, 16), len, UPB_SIZE(2, 3), arena);
|
3787
|
+
}
|
3788
|
+
UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_MethodOptions_add_uninterpreted_option(google_protobuf_MethodOptions *msg, upb_arena *arena) {
|
3789
|
+
struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)_upb_msg_new(&google_protobuf_UninterpretedOption_msginit, arena);
|
3790
|
+
bool ok = _upb_array_append_accessor2(
|
3791
|
+
msg, UPB_SIZE(12, 16), UPB_SIZE(2, 3), &sub, arena);
|
3792
|
+
if (!ok) return NULL;
|
3793
|
+
return sub;
|
3794
|
+
}
|
3795
|
+
|
3796
|
+
/* google.protobuf.UninterpretedOption */
|
3797
|
+
|
3798
|
+
UPB_INLINE google_protobuf_UninterpretedOption *google_protobuf_UninterpretedOption_new(upb_arena *arena) {
|
3799
|
+
return (google_protobuf_UninterpretedOption *)_upb_msg_new(&google_protobuf_UninterpretedOption_msginit, arena);
|
3800
|
+
}
|
3801
|
+
UPB_INLINE google_protobuf_UninterpretedOption *google_protobuf_UninterpretedOption_parse(const char *buf, size_t size,
|
3802
|
+
upb_arena *arena) {
|
3803
|
+
google_protobuf_UninterpretedOption *ret = google_protobuf_UninterpretedOption_new(arena);
|
3804
|
+
if (!ret) return NULL;
|
3805
|
+
if (!upb_decode(buf, size, ret, &google_protobuf_UninterpretedOption_msginit, arena)) return NULL;
|
3806
|
+
return ret;
|
3807
|
+
}
|
3808
|
+
UPB_INLINE google_protobuf_UninterpretedOption *google_protobuf_UninterpretedOption_parse_ex(const char *buf, size_t size,
|
3809
|
+
const upb_extreg *extreg, int options,
|
3810
|
+
upb_arena *arena) {
|
3811
|
+
google_protobuf_UninterpretedOption *ret = google_protobuf_UninterpretedOption_new(arena);
|
3812
|
+
if (!ret) return NULL;
|
3813
|
+
if (!_upb_decode(buf, size, ret, &google_protobuf_UninterpretedOption_msginit, extreg, options, arena)) {
|
3814
|
+
return NULL;
|
3815
|
+
}
|
3816
|
+
return ret;
|
3817
|
+
}
|
3818
|
+
UPB_INLINE char *google_protobuf_UninterpretedOption_serialize(const google_protobuf_UninterpretedOption *msg, upb_arena *arena, size_t *len) {
|
3819
|
+
return upb_encode(msg, &google_protobuf_UninterpretedOption_msginit, arena, len);
|
3820
|
+
}
|
3821
|
+
|
3822
|
+
UPB_INLINE bool google_protobuf_UninterpretedOption_has_name(const google_protobuf_UninterpretedOption *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(56, 80)); }
|
3823
|
+
UPB_INLINE const google_protobuf_UninterpretedOption_NamePart* const* google_protobuf_UninterpretedOption_name(const google_protobuf_UninterpretedOption *msg, size_t *len) { return (const google_protobuf_UninterpretedOption_NamePart* const*)_upb_array_accessor(msg, UPB_SIZE(56, 80), len); }
|
3824
|
+
UPB_INLINE bool google_protobuf_UninterpretedOption_has_identifier_value(const google_protobuf_UninterpretedOption *msg) { return _upb_hasbit(msg, 1); }
|
3825
|
+
UPB_INLINE upb_strview google_protobuf_UninterpretedOption_identifier_value(const google_protobuf_UninterpretedOption *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(32, 32), upb_strview); }
|
3826
|
+
UPB_INLINE bool google_protobuf_UninterpretedOption_has_positive_int_value(const google_protobuf_UninterpretedOption *msg) { return _upb_hasbit(msg, 2); }
|
3827
|
+
UPB_INLINE uint64_t google_protobuf_UninterpretedOption_positive_int_value(const google_protobuf_UninterpretedOption *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(8, 8), uint64_t); }
|
3828
|
+
UPB_INLINE bool google_protobuf_UninterpretedOption_has_negative_int_value(const google_protobuf_UninterpretedOption *msg) { return _upb_hasbit(msg, 3); }
|
3829
|
+
UPB_INLINE int64_t google_protobuf_UninterpretedOption_negative_int_value(const google_protobuf_UninterpretedOption *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(16, 16), int64_t); }
|
3830
|
+
UPB_INLINE bool google_protobuf_UninterpretedOption_has_double_value(const google_protobuf_UninterpretedOption *msg) { return _upb_hasbit(msg, 4); }
|
3831
|
+
UPB_INLINE double google_protobuf_UninterpretedOption_double_value(const google_protobuf_UninterpretedOption *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(24, 24), double); }
|
3832
|
+
UPB_INLINE bool google_protobuf_UninterpretedOption_has_string_value(const google_protobuf_UninterpretedOption *msg) { return _upb_hasbit(msg, 5); }
|
3833
|
+
UPB_INLINE upb_strview google_protobuf_UninterpretedOption_string_value(const google_protobuf_UninterpretedOption *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(40, 48), upb_strview); }
|
3834
|
+
UPB_INLINE bool google_protobuf_UninterpretedOption_has_aggregate_value(const google_protobuf_UninterpretedOption *msg) { return _upb_hasbit(msg, 6); }
|
3835
|
+
UPB_INLINE upb_strview google_protobuf_UninterpretedOption_aggregate_value(const google_protobuf_UninterpretedOption *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(48, 64), upb_strview); }
|
3836
|
+
|
3837
|
+
UPB_INLINE google_protobuf_UninterpretedOption_NamePart** google_protobuf_UninterpretedOption_mutable_name(google_protobuf_UninterpretedOption *msg, size_t *len) {
|
3838
|
+
return (google_protobuf_UninterpretedOption_NamePart**)_upb_array_mutable_accessor(msg, UPB_SIZE(56, 80), len);
|
3839
|
+
}
|
3840
|
+
UPB_INLINE google_protobuf_UninterpretedOption_NamePart** google_protobuf_UninterpretedOption_resize_name(google_protobuf_UninterpretedOption *msg, size_t len, upb_arena *arena) {
|
3841
|
+
return (google_protobuf_UninterpretedOption_NamePart**)_upb_array_resize_accessor2(msg, UPB_SIZE(56, 80), len, UPB_SIZE(2, 3), arena);
|
3842
|
+
}
|
3843
|
+
UPB_INLINE struct google_protobuf_UninterpretedOption_NamePart* google_protobuf_UninterpretedOption_add_name(google_protobuf_UninterpretedOption *msg, upb_arena *arena) {
|
3844
|
+
struct google_protobuf_UninterpretedOption_NamePart* sub = (struct google_protobuf_UninterpretedOption_NamePart*)_upb_msg_new(&google_protobuf_UninterpretedOption_NamePart_msginit, arena);
|
3845
|
+
bool ok = _upb_array_append_accessor2(
|
3846
|
+
msg, UPB_SIZE(56, 80), UPB_SIZE(2, 3), &sub, arena);
|
3847
|
+
if (!ok) return NULL;
|
3848
|
+
return sub;
|
3849
|
+
}
|
3850
|
+
UPB_INLINE void google_protobuf_UninterpretedOption_set_identifier_value(google_protobuf_UninterpretedOption *msg, upb_strview value) {
|
3851
|
+
_upb_sethas(msg, 1);
|
3852
|
+
*UPB_PTR_AT(msg, UPB_SIZE(32, 32), upb_strview) = value;
|
3853
|
+
}
|
3854
|
+
UPB_INLINE void google_protobuf_UninterpretedOption_set_positive_int_value(google_protobuf_UninterpretedOption *msg, uint64_t value) {
|
3855
|
+
_upb_sethas(msg, 2);
|
3856
|
+
*UPB_PTR_AT(msg, UPB_SIZE(8, 8), uint64_t) = value;
|
3857
|
+
}
|
3858
|
+
UPB_INLINE void google_protobuf_UninterpretedOption_set_negative_int_value(google_protobuf_UninterpretedOption *msg, int64_t value) {
|
3859
|
+
_upb_sethas(msg, 3);
|
3860
|
+
*UPB_PTR_AT(msg, UPB_SIZE(16, 16), int64_t) = value;
|
3861
|
+
}
|
3862
|
+
UPB_INLINE void google_protobuf_UninterpretedOption_set_double_value(google_protobuf_UninterpretedOption *msg, double value) {
|
3863
|
+
_upb_sethas(msg, 4);
|
3864
|
+
*UPB_PTR_AT(msg, UPB_SIZE(24, 24), double) = value;
|
3865
|
+
}
|
3866
|
+
UPB_INLINE void google_protobuf_UninterpretedOption_set_string_value(google_protobuf_UninterpretedOption *msg, upb_strview value) {
|
3867
|
+
_upb_sethas(msg, 5);
|
3868
|
+
*UPB_PTR_AT(msg, UPB_SIZE(40, 48), upb_strview) = value;
|
3869
|
+
}
|
3870
|
+
UPB_INLINE void google_protobuf_UninterpretedOption_set_aggregate_value(google_protobuf_UninterpretedOption *msg, upb_strview value) {
|
3871
|
+
_upb_sethas(msg, 6);
|
3872
|
+
*UPB_PTR_AT(msg, UPB_SIZE(48, 64), upb_strview) = value;
|
3873
|
+
}
|
3874
|
+
|
3875
|
+
/* google.protobuf.UninterpretedOption.NamePart */
|
3876
|
+
|
3877
|
+
UPB_INLINE google_protobuf_UninterpretedOption_NamePart *google_protobuf_UninterpretedOption_NamePart_new(upb_arena *arena) {
|
3878
|
+
return (google_protobuf_UninterpretedOption_NamePart *)_upb_msg_new(&google_protobuf_UninterpretedOption_NamePart_msginit, arena);
|
3879
|
+
}
|
3880
|
+
UPB_INLINE google_protobuf_UninterpretedOption_NamePart *google_protobuf_UninterpretedOption_NamePart_parse(const char *buf, size_t size,
|
3881
|
+
upb_arena *arena) {
|
3882
|
+
google_protobuf_UninterpretedOption_NamePart *ret = google_protobuf_UninterpretedOption_NamePart_new(arena);
|
3883
|
+
if (!ret) return NULL;
|
3884
|
+
if (!upb_decode(buf, size, ret, &google_protobuf_UninterpretedOption_NamePart_msginit, arena)) return NULL;
|
3885
|
+
return ret;
|
3886
|
+
}
|
3887
|
+
UPB_INLINE google_protobuf_UninterpretedOption_NamePart *google_protobuf_UninterpretedOption_NamePart_parse_ex(const char *buf, size_t size,
|
3888
|
+
const upb_extreg *extreg, int options,
|
3889
|
+
upb_arena *arena) {
|
3890
|
+
google_protobuf_UninterpretedOption_NamePart *ret = google_protobuf_UninterpretedOption_NamePart_new(arena);
|
3891
|
+
if (!ret) return NULL;
|
3892
|
+
if (!_upb_decode(buf, size, ret, &google_protobuf_UninterpretedOption_NamePart_msginit, extreg, options, arena)) {
|
3893
|
+
return NULL;
|
3894
|
+
}
|
3895
|
+
return ret;
|
3896
|
+
}
|
3897
|
+
UPB_INLINE char *google_protobuf_UninterpretedOption_NamePart_serialize(const google_protobuf_UninterpretedOption_NamePart *msg, upb_arena *arena, size_t *len) {
|
3898
|
+
return upb_encode(msg, &google_protobuf_UninterpretedOption_NamePart_msginit, arena, len);
|
3899
|
+
}
|
3900
|
+
|
3901
|
+
UPB_INLINE bool google_protobuf_UninterpretedOption_NamePart_has_name_part(const google_protobuf_UninterpretedOption_NamePart *msg) { return _upb_hasbit(msg, 1); }
|
3902
|
+
UPB_INLINE upb_strview google_protobuf_UninterpretedOption_NamePart_name_part(const google_protobuf_UninterpretedOption_NamePart *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(4, 8), upb_strview); }
|
3903
|
+
UPB_INLINE bool google_protobuf_UninterpretedOption_NamePart_has_is_extension(const google_protobuf_UninterpretedOption_NamePart *msg) { return _upb_hasbit(msg, 2); }
|
3904
|
+
UPB_INLINE bool google_protobuf_UninterpretedOption_NamePart_is_extension(const google_protobuf_UninterpretedOption_NamePart *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(1, 1), bool); }
|
3905
|
+
|
3906
|
+
UPB_INLINE void google_protobuf_UninterpretedOption_NamePart_set_name_part(google_protobuf_UninterpretedOption_NamePart *msg, upb_strview value) {
|
3907
|
+
_upb_sethas(msg, 1);
|
3908
|
+
*UPB_PTR_AT(msg, UPB_SIZE(4, 8), upb_strview) = value;
|
3909
|
+
}
|
3910
|
+
UPB_INLINE void google_protobuf_UninterpretedOption_NamePart_set_is_extension(google_protobuf_UninterpretedOption_NamePart *msg, bool value) {
|
3911
|
+
_upb_sethas(msg, 2);
|
3912
|
+
*UPB_PTR_AT(msg, UPB_SIZE(1, 1), bool) = value;
|
3913
|
+
}
|
3914
|
+
|
3915
|
+
/* google.protobuf.SourceCodeInfo */
|
3916
|
+
|
3917
|
+
UPB_INLINE google_protobuf_SourceCodeInfo *google_protobuf_SourceCodeInfo_new(upb_arena *arena) {
|
3918
|
+
return (google_protobuf_SourceCodeInfo *)_upb_msg_new(&google_protobuf_SourceCodeInfo_msginit, arena);
|
3919
|
+
}
|
3920
|
+
UPB_INLINE google_protobuf_SourceCodeInfo *google_protobuf_SourceCodeInfo_parse(const char *buf, size_t size,
|
3921
|
+
upb_arena *arena) {
|
3922
|
+
google_protobuf_SourceCodeInfo *ret = google_protobuf_SourceCodeInfo_new(arena);
|
3923
|
+
if (!ret) return NULL;
|
3924
|
+
if (!upb_decode(buf, size, ret, &google_protobuf_SourceCodeInfo_msginit, arena)) return NULL;
|
3925
|
+
return ret;
|
3926
|
+
}
|
3927
|
+
UPB_INLINE google_protobuf_SourceCodeInfo *google_protobuf_SourceCodeInfo_parse_ex(const char *buf, size_t size,
|
3928
|
+
const upb_extreg *extreg, int options,
|
3929
|
+
upb_arena *arena) {
|
3930
|
+
google_protobuf_SourceCodeInfo *ret = google_protobuf_SourceCodeInfo_new(arena);
|
3931
|
+
if (!ret) return NULL;
|
3932
|
+
if (!_upb_decode(buf, size, ret, &google_protobuf_SourceCodeInfo_msginit, extreg, options, arena)) {
|
3933
|
+
return NULL;
|
3934
|
+
}
|
3935
|
+
return ret;
|
3936
|
+
}
|
3937
|
+
UPB_INLINE char *google_protobuf_SourceCodeInfo_serialize(const google_protobuf_SourceCodeInfo *msg, upb_arena *arena, size_t *len) {
|
3938
|
+
return upb_encode(msg, &google_protobuf_SourceCodeInfo_msginit, arena, len);
|
3939
|
+
}
|
3940
|
+
|
3941
|
+
UPB_INLINE bool google_protobuf_SourceCodeInfo_has_location(const google_protobuf_SourceCodeInfo *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(0, 0)); }
|
3942
|
+
UPB_INLINE const google_protobuf_SourceCodeInfo_Location* const* google_protobuf_SourceCodeInfo_location(const google_protobuf_SourceCodeInfo *msg, size_t *len) { return (const google_protobuf_SourceCodeInfo_Location* const*)_upb_array_accessor(msg, UPB_SIZE(0, 0), len); }
|
3943
|
+
|
3944
|
+
UPB_INLINE google_protobuf_SourceCodeInfo_Location** google_protobuf_SourceCodeInfo_mutable_location(google_protobuf_SourceCodeInfo *msg, size_t *len) {
|
3945
|
+
return (google_protobuf_SourceCodeInfo_Location**)_upb_array_mutable_accessor(msg, UPB_SIZE(0, 0), len);
|
3946
|
+
}
|
3947
|
+
UPB_INLINE google_protobuf_SourceCodeInfo_Location** google_protobuf_SourceCodeInfo_resize_location(google_protobuf_SourceCodeInfo *msg, size_t len, upb_arena *arena) {
|
3948
|
+
return (google_protobuf_SourceCodeInfo_Location**)_upb_array_resize_accessor2(msg, UPB_SIZE(0, 0), len, UPB_SIZE(2, 3), arena);
|
3949
|
+
}
|
3950
|
+
UPB_INLINE struct google_protobuf_SourceCodeInfo_Location* google_protobuf_SourceCodeInfo_add_location(google_protobuf_SourceCodeInfo *msg, upb_arena *arena) {
|
3951
|
+
struct google_protobuf_SourceCodeInfo_Location* sub = (struct google_protobuf_SourceCodeInfo_Location*)_upb_msg_new(&google_protobuf_SourceCodeInfo_Location_msginit, arena);
|
3952
|
+
bool ok = _upb_array_append_accessor2(
|
3953
|
+
msg, UPB_SIZE(0, 0), UPB_SIZE(2, 3), &sub, arena);
|
3954
|
+
if (!ok) return NULL;
|
3955
|
+
return sub;
|
3956
|
+
}
|
3957
|
+
|
3958
|
+
/* google.protobuf.SourceCodeInfo.Location */
|
3959
|
+
|
3960
|
+
UPB_INLINE google_protobuf_SourceCodeInfo_Location *google_protobuf_SourceCodeInfo_Location_new(upb_arena *arena) {
|
3961
|
+
return (google_protobuf_SourceCodeInfo_Location *)_upb_msg_new(&google_protobuf_SourceCodeInfo_Location_msginit, arena);
|
3962
|
+
}
|
3963
|
+
UPB_INLINE google_protobuf_SourceCodeInfo_Location *google_protobuf_SourceCodeInfo_Location_parse(const char *buf, size_t size,
|
3964
|
+
upb_arena *arena) {
|
3965
|
+
google_protobuf_SourceCodeInfo_Location *ret = google_protobuf_SourceCodeInfo_Location_new(arena);
|
3966
|
+
if (!ret) return NULL;
|
3967
|
+
if (!upb_decode(buf, size, ret, &google_protobuf_SourceCodeInfo_Location_msginit, arena)) return NULL;
|
3968
|
+
return ret;
|
3969
|
+
}
|
3970
|
+
UPB_INLINE google_protobuf_SourceCodeInfo_Location *google_protobuf_SourceCodeInfo_Location_parse_ex(const char *buf, size_t size,
|
3971
|
+
const upb_extreg *extreg, int options,
|
3972
|
+
upb_arena *arena) {
|
3973
|
+
google_protobuf_SourceCodeInfo_Location *ret = google_protobuf_SourceCodeInfo_Location_new(arena);
|
3974
|
+
if (!ret) return NULL;
|
3975
|
+
if (!_upb_decode(buf, size, ret, &google_protobuf_SourceCodeInfo_Location_msginit, extreg, options, arena)) {
|
3976
|
+
return NULL;
|
3977
|
+
}
|
3978
|
+
return ret;
|
3979
|
+
}
|
3980
|
+
UPB_INLINE char *google_protobuf_SourceCodeInfo_Location_serialize(const google_protobuf_SourceCodeInfo_Location *msg, upb_arena *arena, size_t *len) {
|
3981
|
+
return upb_encode(msg, &google_protobuf_SourceCodeInfo_Location_msginit, arena, len);
|
3982
|
+
}
|
3983
|
+
|
3984
|
+
UPB_INLINE int32_t const* google_protobuf_SourceCodeInfo_Location_path(const google_protobuf_SourceCodeInfo_Location *msg, size_t *len) { return (int32_t const*)_upb_array_accessor(msg, UPB_SIZE(20, 40), len); }
|
3985
|
+
UPB_INLINE int32_t const* google_protobuf_SourceCodeInfo_Location_span(const google_protobuf_SourceCodeInfo_Location *msg, size_t *len) { return (int32_t const*)_upb_array_accessor(msg, UPB_SIZE(24, 48), len); }
|
3986
|
+
UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_has_leading_comments(const google_protobuf_SourceCodeInfo_Location *msg) { return _upb_hasbit(msg, 1); }
|
3987
|
+
UPB_INLINE upb_strview google_protobuf_SourceCodeInfo_Location_leading_comments(const google_protobuf_SourceCodeInfo_Location *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(4, 8), upb_strview); }
|
3988
|
+
UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_has_trailing_comments(const google_protobuf_SourceCodeInfo_Location *msg) { return _upb_hasbit(msg, 2); }
|
3989
|
+
UPB_INLINE upb_strview google_protobuf_SourceCodeInfo_Location_trailing_comments(const google_protobuf_SourceCodeInfo_Location *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(12, 24), upb_strview); }
|
3990
|
+
UPB_INLINE upb_strview const* google_protobuf_SourceCodeInfo_Location_leading_detached_comments(const google_protobuf_SourceCodeInfo_Location *msg, size_t *len) { return (upb_strview const*)_upb_array_accessor(msg, UPB_SIZE(28, 56), len); }
|
3991
|
+
|
3992
|
+
UPB_INLINE int32_t* google_protobuf_SourceCodeInfo_Location_mutable_path(google_protobuf_SourceCodeInfo_Location *msg, size_t *len) {
|
3993
|
+
return (int32_t*)_upb_array_mutable_accessor(msg, UPB_SIZE(20, 40), len);
|
3994
|
+
}
|
3995
|
+
UPB_INLINE int32_t* google_protobuf_SourceCodeInfo_Location_resize_path(google_protobuf_SourceCodeInfo_Location *msg, size_t len, upb_arena *arena) {
|
3996
|
+
return (int32_t*)_upb_array_resize_accessor2(msg, UPB_SIZE(20, 40), len, 2, arena);
|
3997
|
+
}
|
3998
|
+
UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_add_path(google_protobuf_SourceCodeInfo_Location *msg, int32_t val, upb_arena *arena) {
|
3999
|
+
return _upb_array_append_accessor2(msg, UPB_SIZE(20, 40), 2, &val,
|
4000
|
+
arena);
|
4001
|
+
}
|
4002
|
+
UPB_INLINE int32_t* google_protobuf_SourceCodeInfo_Location_mutable_span(google_protobuf_SourceCodeInfo_Location *msg, size_t *len) {
|
4003
|
+
return (int32_t*)_upb_array_mutable_accessor(msg, UPB_SIZE(24, 48), len);
|
4004
|
+
}
|
4005
|
+
UPB_INLINE int32_t* google_protobuf_SourceCodeInfo_Location_resize_span(google_protobuf_SourceCodeInfo_Location *msg, size_t len, upb_arena *arena) {
|
4006
|
+
return (int32_t*)_upb_array_resize_accessor2(msg, UPB_SIZE(24, 48), len, 2, arena);
|
4007
|
+
}
|
4008
|
+
UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_add_span(google_protobuf_SourceCodeInfo_Location *msg, int32_t val, upb_arena *arena) {
|
4009
|
+
return _upb_array_append_accessor2(msg, UPB_SIZE(24, 48), 2, &val,
|
4010
|
+
arena);
|
4011
|
+
}
|
4012
|
+
UPB_INLINE void google_protobuf_SourceCodeInfo_Location_set_leading_comments(google_protobuf_SourceCodeInfo_Location *msg, upb_strview value) {
|
4013
|
+
_upb_sethas(msg, 1);
|
4014
|
+
*UPB_PTR_AT(msg, UPB_SIZE(4, 8), upb_strview) = value;
|
4015
|
+
}
|
4016
|
+
UPB_INLINE void google_protobuf_SourceCodeInfo_Location_set_trailing_comments(google_protobuf_SourceCodeInfo_Location *msg, upb_strview value) {
|
4017
|
+
_upb_sethas(msg, 2);
|
4018
|
+
*UPB_PTR_AT(msg, UPB_SIZE(12, 24), upb_strview) = value;
|
4019
|
+
}
|
4020
|
+
UPB_INLINE upb_strview* google_protobuf_SourceCodeInfo_Location_mutable_leading_detached_comments(google_protobuf_SourceCodeInfo_Location *msg, size_t *len) {
|
4021
|
+
return (upb_strview*)_upb_array_mutable_accessor(msg, UPB_SIZE(28, 56), len);
|
4022
|
+
}
|
4023
|
+
UPB_INLINE upb_strview* google_protobuf_SourceCodeInfo_Location_resize_leading_detached_comments(google_protobuf_SourceCodeInfo_Location *msg, size_t len, upb_arena *arena) {
|
4024
|
+
return (upb_strview*)_upb_array_resize_accessor2(msg, UPB_SIZE(28, 56), len, UPB_SIZE(3, 4), arena);
|
4025
|
+
}
|
4026
|
+
UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_add_leading_detached_comments(google_protobuf_SourceCodeInfo_Location *msg, upb_strview val, upb_arena *arena) {
|
4027
|
+
return _upb_array_append_accessor2(msg, UPB_SIZE(28, 56), UPB_SIZE(3, 4), &val,
|
4028
|
+
arena);
|
4029
|
+
}
|
4030
|
+
|
4031
|
+
/* google.protobuf.GeneratedCodeInfo */
|
4032
|
+
|
4033
|
+
UPB_INLINE google_protobuf_GeneratedCodeInfo *google_protobuf_GeneratedCodeInfo_new(upb_arena *arena) {
|
4034
|
+
return (google_protobuf_GeneratedCodeInfo *)_upb_msg_new(&google_protobuf_GeneratedCodeInfo_msginit, arena);
|
4035
|
+
}
|
4036
|
+
UPB_INLINE google_protobuf_GeneratedCodeInfo *google_protobuf_GeneratedCodeInfo_parse(const char *buf, size_t size,
|
4037
|
+
upb_arena *arena) {
|
4038
|
+
google_protobuf_GeneratedCodeInfo *ret = google_protobuf_GeneratedCodeInfo_new(arena);
|
4039
|
+
if (!ret) return NULL;
|
4040
|
+
if (!upb_decode(buf, size, ret, &google_protobuf_GeneratedCodeInfo_msginit, arena)) return NULL;
|
4041
|
+
return ret;
|
4042
|
+
}
|
4043
|
+
UPB_INLINE google_protobuf_GeneratedCodeInfo *google_protobuf_GeneratedCodeInfo_parse_ex(const char *buf, size_t size,
|
4044
|
+
const upb_extreg *extreg, int options,
|
4045
|
+
upb_arena *arena) {
|
4046
|
+
google_protobuf_GeneratedCodeInfo *ret = google_protobuf_GeneratedCodeInfo_new(arena);
|
4047
|
+
if (!ret) return NULL;
|
4048
|
+
if (!_upb_decode(buf, size, ret, &google_protobuf_GeneratedCodeInfo_msginit, extreg, options, arena)) {
|
4049
|
+
return NULL;
|
4050
|
+
}
|
4051
|
+
return ret;
|
4052
|
+
}
|
4053
|
+
UPB_INLINE char *google_protobuf_GeneratedCodeInfo_serialize(const google_protobuf_GeneratedCodeInfo *msg, upb_arena *arena, size_t *len) {
|
4054
|
+
return upb_encode(msg, &google_protobuf_GeneratedCodeInfo_msginit, arena, len);
|
4055
|
+
}
|
4056
|
+
|
4057
|
+
UPB_INLINE bool google_protobuf_GeneratedCodeInfo_has_annotation(const google_protobuf_GeneratedCodeInfo *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(0, 0)); }
|
4058
|
+
UPB_INLINE const google_protobuf_GeneratedCodeInfo_Annotation* const* google_protobuf_GeneratedCodeInfo_annotation(const google_protobuf_GeneratedCodeInfo *msg, size_t *len) { return (const google_protobuf_GeneratedCodeInfo_Annotation* const*)_upb_array_accessor(msg, UPB_SIZE(0, 0), len); }
|
4059
|
+
|
4060
|
+
UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation** google_protobuf_GeneratedCodeInfo_mutable_annotation(google_protobuf_GeneratedCodeInfo *msg, size_t *len) {
|
4061
|
+
return (google_protobuf_GeneratedCodeInfo_Annotation**)_upb_array_mutable_accessor(msg, UPB_SIZE(0, 0), len);
|
4062
|
+
}
|
4063
|
+
UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation** google_protobuf_GeneratedCodeInfo_resize_annotation(google_protobuf_GeneratedCodeInfo *msg, size_t len, upb_arena *arena) {
|
4064
|
+
return (google_protobuf_GeneratedCodeInfo_Annotation**)_upb_array_resize_accessor2(msg, UPB_SIZE(0, 0), len, UPB_SIZE(2, 3), arena);
|
4065
|
+
}
|
4066
|
+
UPB_INLINE struct google_protobuf_GeneratedCodeInfo_Annotation* google_protobuf_GeneratedCodeInfo_add_annotation(google_protobuf_GeneratedCodeInfo *msg, upb_arena *arena) {
|
4067
|
+
struct google_protobuf_GeneratedCodeInfo_Annotation* sub = (struct google_protobuf_GeneratedCodeInfo_Annotation*)_upb_msg_new(&google_protobuf_GeneratedCodeInfo_Annotation_msginit, arena);
|
4068
|
+
bool ok = _upb_array_append_accessor2(
|
4069
|
+
msg, UPB_SIZE(0, 0), UPB_SIZE(2, 3), &sub, arena);
|
4070
|
+
if (!ok) return NULL;
|
4071
|
+
return sub;
|
4072
|
+
}
|
4073
|
+
|
4074
|
+
/* google.protobuf.GeneratedCodeInfo.Annotation */
|
4075
|
+
|
4076
|
+
UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation *google_protobuf_GeneratedCodeInfo_Annotation_new(upb_arena *arena) {
|
4077
|
+
return (google_protobuf_GeneratedCodeInfo_Annotation *)_upb_msg_new(&google_protobuf_GeneratedCodeInfo_Annotation_msginit, arena);
|
4078
|
+
}
|
4079
|
+
UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation *google_protobuf_GeneratedCodeInfo_Annotation_parse(const char *buf, size_t size,
|
4080
|
+
upb_arena *arena) {
|
4081
|
+
google_protobuf_GeneratedCodeInfo_Annotation *ret = google_protobuf_GeneratedCodeInfo_Annotation_new(arena);
|
4082
|
+
if (!ret) return NULL;
|
4083
|
+
if (!upb_decode(buf, size, ret, &google_protobuf_GeneratedCodeInfo_Annotation_msginit, arena)) return NULL;
|
4084
|
+
return ret;
|
4085
|
+
}
|
4086
|
+
UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation *google_protobuf_GeneratedCodeInfo_Annotation_parse_ex(const char *buf, size_t size,
|
4087
|
+
const upb_extreg *extreg, int options,
|
4088
|
+
upb_arena *arena) {
|
4089
|
+
google_protobuf_GeneratedCodeInfo_Annotation *ret = google_protobuf_GeneratedCodeInfo_Annotation_new(arena);
|
4090
|
+
if (!ret) return NULL;
|
4091
|
+
if (!_upb_decode(buf, size, ret, &google_protobuf_GeneratedCodeInfo_Annotation_msginit, extreg, options, arena)) {
|
4092
|
+
return NULL;
|
4093
|
+
}
|
4094
|
+
return ret;
|
4095
|
+
}
|
4096
|
+
UPB_INLINE char *google_protobuf_GeneratedCodeInfo_Annotation_serialize(const google_protobuf_GeneratedCodeInfo_Annotation *msg, upb_arena *arena, size_t *len) {
|
4097
|
+
return upb_encode(msg, &google_protobuf_GeneratedCodeInfo_Annotation_msginit, arena, len);
|
4098
|
+
}
|
4099
|
+
|
4100
|
+
UPB_INLINE int32_t const* google_protobuf_GeneratedCodeInfo_Annotation_path(const google_protobuf_GeneratedCodeInfo_Annotation *msg, size_t *len) { return (int32_t const*)_upb_array_accessor(msg, UPB_SIZE(20, 32), len); }
|
4101
|
+
UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_source_file(const google_protobuf_GeneratedCodeInfo_Annotation *msg) { return _upb_hasbit(msg, 1); }
|
4102
|
+
UPB_INLINE upb_strview google_protobuf_GeneratedCodeInfo_Annotation_source_file(const google_protobuf_GeneratedCodeInfo_Annotation *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(12, 16), upb_strview); }
|
4103
|
+
UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_begin(const google_protobuf_GeneratedCodeInfo_Annotation *msg) { return _upb_hasbit(msg, 2); }
|
4104
|
+
UPB_INLINE int32_t google_protobuf_GeneratedCodeInfo_Annotation_begin(const google_protobuf_GeneratedCodeInfo_Annotation *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(4, 4), int32_t); }
|
4105
|
+
UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_end(const google_protobuf_GeneratedCodeInfo_Annotation *msg) { return _upb_hasbit(msg, 3); }
|
4106
|
+
UPB_INLINE int32_t google_protobuf_GeneratedCodeInfo_Annotation_end(const google_protobuf_GeneratedCodeInfo_Annotation *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(8, 8), int32_t); }
|
4107
|
+
|
4108
|
+
UPB_INLINE int32_t* google_protobuf_GeneratedCodeInfo_Annotation_mutable_path(google_protobuf_GeneratedCodeInfo_Annotation *msg, size_t *len) {
|
4109
|
+
return (int32_t*)_upb_array_mutable_accessor(msg, UPB_SIZE(20, 32), len);
|
4110
|
+
}
|
4111
|
+
UPB_INLINE int32_t* google_protobuf_GeneratedCodeInfo_Annotation_resize_path(google_protobuf_GeneratedCodeInfo_Annotation *msg, size_t len, upb_arena *arena) {
|
4112
|
+
return (int32_t*)_upb_array_resize_accessor2(msg, UPB_SIZE(20, 32), len, 2, arena);
|
4113
|
+
}
|
4114
|
+
UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_add_path(google_protobuf_GeneratedCodeInfo_Annotation *msg, int32_t val, upb_arena *arena) {
|
4115
|
+
return _upb_array_append_accessor2(msg, UPB_SIZE(20, 32), 2, &val,
|
4116
|
+
arena);
|
4117
|
+
}
|
4118
|
+
UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_set_source_file(google_protobuf_GeneratedCodeInfo_Annotation *msg, upb_strview value) {
|
4119
|
+
_upb_sethas(msg, 1);
|
4120
|
+
*UPB_PTR_AT(msg, UPB_SIZE(12, 16), upb_strview) = value;
|
4121
|
+
}
|
4122
|
+
UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_set_begin(google_protobuf_GeneratedCodeInfo_Annotation *msg, int32_t value) {
|
4123
|
+
_upb_sethas(msg, 2);
|
4124
|
+
*UPB_PTR_AT(msg, UPB_SIZE(4, 4), int32_t) = value;
|
4125
|
+
}
|
4126
|
+
UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_set_end(google_protobuf_GeneratedCodeInfo_Annotation *msg, int32_t value) {
|
4127
|
+
_upb_sethas(msg, 3);
|
4128
|
+
*UPB_PTR_AT(msg, UPB_SIZE(8, 8), int32_t) = value;
|
4129
|
+
}
|
4130
|
+
|
4131
|
+
#ifdef __cplusplus
|
4132
|
+
} /* extern "C" */
|
4133
|
+
#endif
|
4134
|
+
|
4135
|
+
|
4136
|
+
#endif /* GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_H_ */
|
4137
|
+
|
4138
|
+
/** upb/def.h ************************************************************/
|
4139
|
+
/*
|
4140
|
+
* Defs are upb's internal representation of the constructs that can appear
|
4141
|
+
* in a .proto file:
|
4142
|
+
*
|
4143
|
+
* - upb_msgdef: describes a "message" construct.
|
4144
|
+
* - upb_fielddef: describes a message field.
|
4145
|
+
* - upb_filedef: describes a .proto file and its defs.
|
4146
|
+
* - upb_enumdef: describes an enum.
|
4147
|
+
* - upb_oneofdef: describes a oneof.
|
4148
|
+
*
|
4149
|
+
* TODO: definitions of services.
|
4150
|
+
*/
|
4151
|
+
|
4152
|
+
#ifndef UPB_DEF_H_
|
4153
|
+
#define UPB_DEF_H_
|
4154
|
+
|
4155
|
+
|
4156
|
+
/* Must be last. */
|
4157
|
+
|
4158
|
+
#ifdef __cplusplus
|
4159
|
+
extern "C" {
|
4160
|
+
#endif /* __cplusplus */
|
4161
|
+
|
4162
|
+
struct upb_enumdef;
|
4163
|
+
typedef struct upb_enumdef upb_enumdef;
|
4164
|
+
struct upb_fielddef;
|
4165
|
+
typedef struct upb_fielddef upb_fielddef;
|
4166
|
+
struct upb_filedef;
|
4167
|
+
typedef struct upb_filedef upb_filedef;
|
4168
|
+
struct upb_msgdef;
|
4169
|
+
typedef struct upb_msgdef upb_msgdef;
|
4170
|
+
struct upb_oneofdef;
|
4171
|
+
typedef struct upb_oneofdef upb_oneofdef;
|
4172
|
+
struct upb_symtab;
|
4173
|
+
typedef struct upb_symtab upb_symtab;
|
4174
|
+
|
4175
|
+
typedef enum {
|
4176
|
+
UPB_SYNTAX_PROTO2 = 2,
|
4177
|
+
UPB_SYNTAX_PROTO3 = 3
|
4178
|
+
} upb_syntax_t;
|
4179
|
+
|
4180
|
+
/* All the different kind of well known type messages. For simplicity of check,
|
4181
|
+
* number wrappers and string wrappers are grouped together. Make sure the
|
4182
|
+
* order and merber of these groups are not changed.
|
4183
|
+
*/
|
4184
|
+
typedef enum {
|
4185
|
+
UPB_WELLKNOWN_UNSPECIFIED,
|
4186
|
+
UPB_WELLKNOWN_ANY,
|
4187
|
+
UPB_WELLKNOWN_FIELDMASK,
|
4188
|
+
UPB_WELLKNOWN_DURATION,
|
4189
|
+
UPB_WELLKNOWN_TIMESTAMP,
|
4190
|
+
/* number wrappers */
|
4191
|
+
UPB_WELLKNOWN_DOUBLEVALUE,
|
4192
|
+
UPB_WELLKNOWN_FLOATVALUE,
|
4193
|
+
UPB_WELLKNOWN_INT64VALUE,
|
4194
|
+
UPB_WELLKNOWN_UINT64VALUE,
|
4195
|
+
UPB_WELLKNOWN_INT32VALUE,
|
4196
|
+
UPB_WELLKNOWN_UINT32VALUE,
|
4197
|
+
/* string wrappers */
|
4198
|
+
UPB_WELLKNOWN_STRINGVALUE,
|
4199
|
+
UPB_WELLKNOWN_BYTESVALUE,
|
4200
|
+
UPB_WELLKNOWN_BOOLVALUE,
|
4201
|
+
UPB_WELLKNOWN_VALUE,
|
4202
|
+
UPB_WELLKNOWN_LISTVALUE,
|
4203
|
+
UPB_WELLKNOWN_STRUCT
|
4204
|
+
} upb_wellknowntype_t;
|
4205
|
+
|
4206
|
+
/* upb_fielddef ***************************************************************/
|
4207
|
+
|
4208
|
+
/* Maximum field number allowed for FieldDefs. This is an inherent limit of the
|
4209
|
+
* protobuf wire format. */
|
4210
|
+
#define UPB_MAX_FIELDNUMBER ((1 << 29) - 1)
|
4211
|
+
|
4212
|
+
const char *upb_fielddef_fullname(const upb_fielddef *f);
|
4213
|
+
upb_fieldtype_t upb_fielddef_type(const upb_fielddef *f);
|
4214
|
+
upb_descriptortype_t upb_fielddef_descriptortype(const upb_fielddef *f);
|
4215
|
+
upb_label_t upb_fielddef_label(const upb_fielddef *f);
|
4216
|
+
uint32_t upb_fielddef_number(const upb_fielddef *f);
|
4217
|
+
const char *upb_fielddef_name(const upb_fielddef *f);
|
4218
|
+
const char *upb_fielddef_jsonname(const upb_fielddef *f);
|
4219
|
+
bool upb_fielddef_isextension(const upb_fielddef *f);
|
4220
|
+
bool upb_fielddef_lazy(const upb_fielddef *f);
|
4221
|
+
bool upb_fielddef_packed(const upb_fielddef *f);
|
4222
|
+
const upb_filedef *upb_fielddef_file(const upb_fielddef *f);
|
4223
|
+
const upb_msgdef *upb_fielddef_containingtype(const upb_fielddef *f);
|
4224
|
+
const upb_oneofdef *upb_fielddef_containingoneof(const upb_fielddef *f);
|
4225
|
+
const upb_oneofdef *upb_fielddef_realcontainingoneof(const upb_fielddef *f);
|
4226
|
+
uint32_t upb_fielddef_index(const upb_fielddef *f);
|
4227
|
+
bool upb_fielddef_issubmsg(const upb_fielddef *f);
|
4228
|
+
bool upb_fielddef_isstring(const upb_fielddef *f);
|
4229
|
+
bool upb_fielddef_isseq(const upb_fielddef *f);
|
4230
|
+
bool upb_fielddef_isprimitive(const upb_fielddef *f);
|
4231
|
+
bool upb_fielddef_ismap(const upb_fielddef *f);
|
4232
|
+
int64_t upb_fielddef_defaultint64(const upb_fielddef *f);
|
4233
|
+
int32_t upb_fielddef_defaultint32(const upb_fielddef *f);
|
4234
|
+
uint64_t upb_fielddef_defaultuint64(const upb_fielddef *f);
|
4235
|
+
uint32_t upb_fielddef_defaultuint32(const upb_fielddef *f);
|
4236
|
+
bool upb_fielddef_defaultbool(const upb_fielddef *f);
|
4237
|
+
float upb_fielddef_defaultfloat(const upb_fielddef *f);
|
4238
|
+
double upb_fielddef_defaultdouble(const upb_fielddef *f);
|
4239
|
+
const char *upb_fielddef_defaultstr(const upb_fielddef *f, size_t *len);
|
4240
|
+
bool upb_fielddef_hassubdef(const upb_fielddef *f);
|
4241
|
+
bool upb_fielddef_haspresence(const upb_fielddef *f);
|
4242
|
+
const upb_msgdef *upb_fielddef_msgsubdef(const upb_fielddef *f);
|
4243
|
+
const upb_enumdef *upb_fielddef_enumsubdef(const upb_fielddef *f);
|
4244
|
+
const upb_msglayout_field *upb_fielddef_layout(const upb_fielddef *f);
|
4245
|
+
|
4246
|
+
/* upb_oneofdef ***************************************************************/
|
4247
|
+
|
4248
|
+
typedef upb_inttable_iter upb_oneof_iter;
|
4249
|
+
|
4250
|
+
const char *upb_oneofdef_name(const upb_oneofdef *o);
|
4251
|
+
const upb_msgdef *upb_oneofdef_containingtype(const upb_oneofdef *o);
|
4252
|
+
uint32_t upb_oneofdef_index(const upb_oneofdef *o);
|
4253
|
+
bool upb_oneofdef_issynthetic(const upb_oneofdef *o);
|
4254
|
+
int upb_oneofdef_fieldcount(const upb_oneofdef *o);
|
4255
|
+
const upb_fielddef *upb_oneofdef_field(const upb_oneofdef *o, int i);
|
4256
|
+
|
4257
|
+
/* Oneof lookups:
|
4258
|
+
* - ntof: look up a field by name.
|
4259
|
+
* - ntofz: look up a field by name (as a null-terminated string).
|
4260
|
+
* - itof: look up a field by number. */
|
4261
|
+
const upb_fielddef *upb_oneofdef_ntof(const upb_oneofdef *o,
|
4262
|
+
const char *name, size_t length);
|
4263
|
+
UPB_INLINE const upb_fielddef *upb_oneofdef_ntofz(const upb_oneofdef *o,
|
4264
|
+
const char *name) {
|
4265
|
+
return upb_oneofdef_ntof(o, name, strlen(name));
|
4266
|
+
}
|
4267
|
+
const upb_fielddef *upb_oneofdef_itof(const upb_oneofdef *o, uint32_t num);
|
4268
|
+
|
4269
|
+
/* DEPRECATED, slated for removal. */
|
4270
|
+
int upb_oneofdef_numfields(const upb_oneofdef *o);
|
4271
|
+
void upb_oneof_begin(upb_oneof_iter *iter, const upb_oneofdef *o);
|
4272
|
+
void upb_oneof_next(upb_oneof_iter *iter);
|
4273
|
+
bool upb_oneof_done(upb_oneof_iter *iter);
|
4274
|
+
upb_fielddef *upb_oneof_iter_field(const upb_oneof_iter *iter);
|
4275
|
+
void upb_oneof_iter_setdone(upb_oneof_iter *iter);
|
4276
|
+
bool upb_oneof_iter_isequal(const upb_oneof_iter *iter1,
|
4277
|
+
const upb_oneof_iter *iter2);
|
4278
|
+
/* END DEPRECATED */
|
4279
|
+
|
4280
|
+
/* upb_msgdef *****************************************************************/
|
4281
|
+
|
4282
|
+
typedef upb_inttable_iter upb_msg_field_iter;
|
4283
|
+
typedef upb_strtable_iter upb_msg_oneof_iter;
|
4284
|
+
|
4285
|
+
/* Well-known field tag numbers for map-entry messages. */
|
4286
|
+
#define UPB_MAPENTRY_KEY 1
|
4287
|
+
#define UPB_MAPENTRY_VALUE 2
|
4288
|
+
|
4289
|
+
/* Well-known field tag numbers for Any messages. */
|
4290
|
+
#define UPB_ANY_TYPE 1
|
4291
|
+
#define UPB_ANY_VALUE 2
|
4292
|
+
|
4293
|
+
/* Well-known field tag numbers for timestamp messages. */
|
4294
|
+
#define UPB_DURATION_SECONDS 1
|
4295
|
+
#define UPB_DURATION_NANOS 2
|
4296
|
+
|
4297
|
+
/* Well-known field tag numbers for duration messages. */
|
4298
|
+
#define UPB_TIMESTAMP_SECONDS 1
|
4299
|
+
#define UPB_TIMESTAMP_NANOS 2
|
4300
|
+
|
4301
|
+
const char *upb_msgdef_fullname(const upb_msgdef *m);
|
4302
|
+
const upb_filedef *upb_msgdef_file(const upb_msgdef *m);
|
4303
|
+
const char *upb_msgdef_name(const upb_msgdef *m);
|
4304
|
+
upb_syntax_t upb_msgdef_syntax(const upb_msgdef *m);
|
4305
|
+
bool upb_msgdef_mapentry(const upb_msgdef *m);
|
4306
|
+
upb_wellknowntype_t upb_msgdef_wellknowntype(const upb_msgdef *m);
|
4307
|
+
bool upb_msgdef_iswrapper(const upb_msgdef *m);
|
4308
|
+
bool upb_msgdef_isnumberwrapper(const upb_msgdef *m);
|
4309
|
+
int upb_msgdef_fieldcount(const upb_msgdef *m);
|
4310
|
+
int upb_msgdef_oneofcount(const upb_msgdef *m);
|
4311
|
+
const upb_fielddef *upb_msgdef_field(const upb_msgdef *m, int i);
|
4312
|
+
const upb_oneofdef *upb_msgdef_oneof(const upb_msgdef *m, int i);
|
4313
|
+
const upb_fielddef *upb_msgdef_itof(const upb_msgdef *m, uint32_t i);
|
4314
|
+
const upb_fielddef *upb_msgdef_ntof(const upb_msgdef *m, const char *name,
|
4315
|
+
size_t len);
|
4316
|
+
const upb_oneofdef *upb_msgdef_ntoo(const upb_msgdef *m, const char *name,
|
4317
|
+
size_t len);
|
4318
|
+
const upb_msglayout *upb_msgdef_layout(const upb_msgdef *m);
|
4319
|
+
|
4320
|
+
UPB_INLINE const upb_oneofdef *upb_msgdef_ntooz(const upb_msgdef *m,
|
4321
|
+
const char *name) {
|
4322
|
+
return upb_msgdef_ntoo(m, name, strlen(name));
|
4323
|
+
}
|
4324
|
+
|
4325
|
+
UPB_INLINE const upb_fielddef *upb_msgdef_ntofz(const upb_msgdef *m,
|
4326
|
+
const char *name) {
|
4327
|
+
return upb_msgdef_ntof(m, name, strlen(name));
|
4328
|
+
}
|
4329
|
+
|
4330
|
+
/* Lookup of either field or oneof by name. Returns whether either was found.
|
4331
|
+
* If the return is true, then the found def will be set, and the non-found
|
4332
|
+
* one set to NULL. */
|
4333
|
+
bool upb_msgdef_lookupname(const upb_msgdef *m, const char *name, size_t len,
|
4334
|
+
const upb_fielddef **f, const upb_oneofdef **o);
|
4335
|
+
|
4336
|
+
UPB_INLINE bool upb_msgdef_lookupnamez(const upb_msgdef *m, const char *name,
|
4337
|
+
const upb_fielddef **f,
|
4338
|
+
const upb_oneofdef **o) {
|
4339
|
+
return upb_msgdef_lookupname(m, name, strlen(name), f, o);
|
4340
|
+
}
|
4341
|
+
|
4342
|
+
/* Returns a field by either JSON name or regular proto name. */
|
4343
|
+
const upb_fielddef *upb_msgdef_lookupjsonname(const upb_msgdef *m,
|
4344
|
+
const char *name, size_t len);
|
4345
|
+
|
4346
|
+
/* DEPRECATED, slated for removal */
|
4347
|
+
int upb_msgdef_numfields(const upb_msgdef *m);
|
4348
|
+
int upb_msgdef_numoneofs(const upb_msgdef *m);
|
4349
|
+
int upb_msgdef_numrealoneofs(const upb_msgdef *m);
|
4350
|
+
void upb_msg_field_begin(upb_msg_field_iter *iter, const upb_msgdef *m);
|
4351
|
+
void upb_msg_field_next(upb_msg_field_iter *iter);
|
4352
|
+
bool upb_msg_field_done(const upb_msg_field_iter *iter);
|
4353
|
+
upb_fielddef *upb_msg_iter_field(const upb_msg_field_iter *iter);
|
4354
|
+
void upb_msg_field_iter_setdone(upb_msg_field_iter *iter);
|
4355
|
+
bool upb_msg_field_iter_isequal(const upb_msg_field_iter * iter1,
|
4356
|
+
const upb_msg_field_iter * iter2);
|
4357
|
+
void upb_msg_oneof_begin(upb_msg_oneof_iter * iter, const upb_msgdef *m);
|
4358
|
+
void upb_msg_oneof_next(upb_msg_oneof_iter * iter);
|
4359
|
+
bool upb_msg_oneof_done(const upb_msg_oneof_iter *iter);
|
4360
|
+
const upb_oneofdef *upb_msg_iter_oneof(const upb_msg_oneof_iter *iter);
|
4361
|
+
void upb_msg_oneof_iter_setdone(upb_msg_oneof_iter * iter);
|
4362
|
+
bool upb_msg_oneof_iter_isequal(const upb_msg_oneof_iter *iter1,
|
4363
|
+
const upb_msg_oneof_iter *iter2);
|
4364
|
+
/* END DEPRECATED */
|
4365
|
+
|
4366
|
+
/* upb_enumdef ****************************************************************/
|
4367
|
+
|
4368
|
+
typedef upb_strtable_iter upb_enum_iter;
|
4369
|
+
|
4370
|
+
const char *upb_enumdef_fullname(const upb_enumdef *e);
|
4371
|
+
const char *upb_enumdef_name(const upb_enumdef *e);
|
4372
|
+
const upb_filedef *upb_enumdef_file(const upb_enumdef *e);
|
4373
|
+
int32_t upb_enumdef_default(const upb_enumdef *e);
|
4374
|
+
int upb_enumdef_numvals(const upb_enumdef *e);
|
4375
|
+
|
4376
|
+
/* Enum lookups:
|
4377
|
+
* - ntoi: look up a name with specified length.
|
4378
|
+
* - ntoiz: look up a name provided as a null-terminated string.
|
4379
|
+
* - iton: look up an integer, returning the name as a null-terminated
|
4380
|
+
* string. */
|
4381
|
+
bool upb_enumdef_ntoi(const upb_enumdef *e, const char *name, size_t len,
|
4382
|
+
int32_t *num);
|
4383
|
+
UPB_INLINE bool upb_enumdef_ntoiz(const upb_enumdef *e,
|
4384
|
+
const char *name, int32_t *num) {
|
4385
|
+
return upb_enumdef_ntoi(e, name, strlen(name), num);
|
4386
|
+
}
|
4387
|
+
const char *upb_enumdef_iton(const upb_enumdef *e, int32_t num);
|
4388
|
+
|
4389
|
+
void upb_enum_begin(upb_enum_iter *iter, const upb_enumdef *e);
|
4390
|
+
void upb_enum_next(upb_enum_iter *iter);
|
4391
|
+
bool upb_enum_done(upb_enum_iter *iter);
|
4392
|
+
const char *upb_enum_iter_name(upb_enum_iter *iter);
|
4393
|
+
int32_t upb_enum_iter_number(upb_enum_iter *iter);
|
4394
|
+
|
4395
|
+
/* upb_filedef ****************************************************************/
|
4396
|
+
|
4397
|
+
const char *upb_filedef_name(const upb_filedef *f);
|
4398
|
+
const char *upb_filedef_package(const upb_filedef *f);
|
4399
|
+
const char *upb_filedef_phpprefix(const upb_filedef *f);
|
4400
|
+
const char *upb_filedef_phpnamespace(const upb_filedef *f);
|
4401
|
+
upb_syntax_t upb_filedef_syntax(const upb_filedef *f);
|
4402
|
+
int upb_filedef_depcount(const upb_filedef *f);
|
4403
|
+
int upb_filedef_msgcount(const upb_filedef *f);
|
4404
|
+
int upb_filedef_enumcount(const upb_filedef *f);
|
4405
|
+
const upb_filedef *upb_filedef_dep(const upb_filedef *f, int i);
|
4406
|
+
const upb_msgdef *upb_filedef_msg(const upb_filedef *f, int i);
|
4407
|
+
const upb_enumdef *upb_filedef_enum(const upb_filedef *f, int i);
|
4408
|
+
const upb_symtab *upb_filedef_symtab(const upb_filedef *f);
|
4409
|
+
|
4410
|
+
/* upb_symtab *****************************************************************/
|
4411
|
+
|
4412
|
+
upb_symtab *upb_symtab_new(void);
|
4413
|
+
void upb_symtab_free(upb_symtab* s);
|
4414
|
+
const upb_msgdef *upb_symtab_lookupmsg(const upb_symtab *s, const char *sym);
|
4415
|
+
const upb_msgdef *upb_symtab_lookupmsg2(
|
4416
|
+
const upb_symtab *s, const char *sym, size_t len);
|
4417
|
+
const upb_enumdef *upb_symtab_lookupenum(const upb_symtab *s, const char *sym);
|
4418
|
+
const upb_filedef *upb_symtab_lookupfile(const upb_symtab *s, const char *name);
|
4419
|
+
const upb_filedef *upb_symtab_lookupfile2(
|
4420
|
+
const upb_symtab *s, const char *name, size_t len);
|
4421
|
+
int upb_symtab_filecount(const upb_symtab *s);
|
4422
|
+
const upb_filedef *upb_symtab_addfile(
|
4423
|
+
upb_symtab *s, const google_protobuf_FileDescriptorProto *file,
|
4424
|
+
upb_status *status);
|
4425
|
+
size_t _upb_symtab_bytesloaded(const upb_symtab *s);
|
4426
|
+
upb_arena *_upb_symtab_arena(const upb_symtab *s);
|
4427
|
+
|
4428
|
+
/* For generated code only: loads a generated descriptor. */
|
4429
|
+
typedef struct upb_def_init {
|
4430
|
+
struct upb_def_init **deps; /* Dependencies of this file. */
|
4431
|
+
const upb_msglayout **layouts; /* Pre-order layouts of all messages. */
|
4432
|
+
const char *filename;
|
4433
|
+
upb_strview descriptor; /* Serialized descriptor. */
|
4434
|
+
} upb_def_init;
|
4435
|
+
|
4436
|
+
bool _upb_symtab_loaddefinit(upb_symtab *s, const upb_def_init *init);
|
4437
|
+
|
4438
|
+
|
4439
|
+
#ifdef __cplusplus
|
4440
|
+
} /* extern "C" */
|
4441
|
+
#endif /* __cplusplus */
|
4442
|
+
|
4443
|
+
#endif /* UPB_DEF_H_ */
|
4444
|
+
|
4445
|
+
/** upb/reflection.h ************************************************************/
|
4446
|
+
#ifndef UPB_REFLECTION_H_
|
4447
|
+
#define UPB_REFLECTION_H_
|
4448
|
+
|
4449
|
+
|
4450
|
+
|
4451
|
+
#ifdef __cplusplus
|
4452
|
+
extern "C" {
|
4453
|
+
#endif
|
4454
|
+
|
4455
|
+
typedef union {
|
4456
|
+
bool bool_val;
|
4457
|
+
float float_val;
|
4458
|
+
double double_val;
|
4459
|
+
int32_t int32_val;
|
4460
|
+
int64_t int64_val;
|
4461
|
+
uint32_t uint32_val;
|
4462
|
+
uint64_t uint64_val;
|
4463
|
+
const upb_map* map_val;
|
4464
|
+
const upb_msg* msg_val;
|
4465
|
+
const upb_array* array_val;
|
4466
|
+
upb_strview str_val;
|
4467
|
+
} upb_msgval;
|
4468
|
+
|
4469
|
+
typedef union {
|
4470
|
+
upb_map* map;
|
4471
|
+
upb_msg* msg;
|
4472
|
+
upb_array* array;
|
4473
|
+
} upb_mutmsgval;
|
4474
|
+
|
4475
|
+
upb_msgval upb_fielddef_default(const upb_fielddef *f);
|
4476
|
+
|
4477
|
+
/** upb_msg *******************************************************************/
|
4478
|
+
|
4479
|
+
/* Creates a new message of the given type in the given arena. */
|
4480
|
+
upb_msg *upb_msg_new(const upb_msgdef *m, upb_arena *a);
|
4481
|
+
|
4482
|
+
/* Returns the value associated with this field. */
|
4483
|
+
upb_msgval upb_msg_get(const upb_msg *msg, const upb_fielddef *f);
|
4484
|
+
|
4485
|
+
/* Returns a mutable pointer to a map, array, or submessage value. If the given
|
4486
|
+
* arena is non-NULL this will construct a new object if it was not previously
|
4487
|
+
* present. May not be called for primitive fields. */
|
4488
|
+
upb_mutmsgval upb_msg_mutable(upb_msg *msg, const upb_fielddef *f, upb_arena *a);
|
4489
|
+
|
4490
|
+
/* May only be called for fields where upb_fielddef_haspresence(f) == true. */
|
4491
|
+
bool upb_msg_has(const upb_msg *msg, const upb_fielddef *f);
|
4492
|
+
|
4493
|
+
/* Returns the field that is set in the oneof, or NULL if none are set. */
|
4494
|
+
const upb_fielddef *upb_msg_whichoneof(const upb_msg *msg,
|
4495
|
+
const upb_oneofdef *o);
|
4496
|
+
|
4497
|
+
/* Sets the given field to the given value. For a msg/array/map/string, the
|
4498
|
+
* value must be in the same arena. */
|
4499
|
+
void upb_msg_set(upb_msg *msg, const upb_fielddef *f, upb_msgval val,
|
4500
|
+
upb_arena *a);
|
4501
|
+
|
4502
|
+
/* Clears any field presence and sets the value back to its default. */
|
4503
|
+
void upb_msg_clearfield(upb_msg *msg, const upb_fielddef *f);
|
4504
|
+
|
4505
|
+
/* Clear all data and unknown fields. */
|
4506
|
+
void upb_msg_clear(upb_msg *msg, const upb_msgdef *m);
|
4507
|
+
|
4508
|
+
/* Iterate over present fields.
|
4509
|
+
*
|
4510
|
+
* size_t iter = UPB_MSG_BEGIN;
|
4511
|
+
* const upb_fielddef *f;
|
4512
|
+
* upb_msgval val;
|
4513
|
+
* while (upb_msg_next(msg, m, ext_pool, &f, &val, &iter)) {
|
4514
|
+
* process_field(f, val);
|
4515
|
+
* }
|
4516
|
+
*
|
4517
|
+
* If ext_pool is NULL, no extensions will be returned. If the given symtab
|
4518
|
+
* returns extensions that don't match what is in this message, those extensions
|
4519
|
+
* will be skipped.
|
4520
|
+
*/
|
4521
|
+
|
4522
|
+
#define UPB_MSG_BEGIN -1
|
4523
|
+
bool upb_msg_next(const upb_msg *msg, const upb_msgdef *m,
|
4524
|
+
const upb_symtab *ext_pool, const upb_fielddef **f,
|
4525
|
+
upb_msgval *val, size_t *iter);
|
4526
|
+
|
4527
|
+
/* Clears all unknown field data from this message and all submessages. */
|
4528
|
+
bool upb_msg_discardunknown(upb_msg *msg, const upb_msgdef *m, int maxdepth);
|
4529
|
+
|
4530
|
+
/** upb_array *****************************************************************/
|
4531
|
+
|
4532
|
+
/* Creates a new array on the given arena that holds elements of this type. */
|
4533
|
+
upb_array *upb_array_new(upb_arena *a, upb_fieldtype_t type);
|
4534
|
+
|
4535
|
+
/* Returns the size of the array. */
|
4536
|
+
size_t upb_array_size(const upb_array *arr);
|
4537
|
+
|
4538
|
+
/* Returns the given element, which must be within the array's current size. */
|
4539
|
+
upb_msgval upb_array_get(const upb_array *arr, size_t i);
|
4540
|
+
|
4541
|
+
/* Sets the given element, which must be within the array's current size. */
|
4542
|
+
void upb_array_set(upb_array *arr, size_t i, upb_msgval val);
|
4543
|
+
|
4544
|
+
/* Appends an element to the array. Returns false on allocation failure. */
|
4545
|
+
bool upb_array_append(upb_array *array, upb_msgval val, upb_arena *arena);
|
4546
|
+
|
4547
|
+
/* Changes the size of a vector. New elements are initialized to empty/0.
|
4548
|
+
* Returns false on allocation failure. */
|
4549
|
+
bool upb_array_resize(upb_array *array, size_t size, upb_arena *arena);
|
4550
|
+
|
4551
|
+
/** upb_map *******************************************************************/
|
4552
|
+
|
4553
|
+
/* Creates a new map on the given arena with the given key/value size. */
|
4554
|
+
upb_map *upb_map_new(upb_arena *a, upb_fieldtype_t key_type,
|
4555
|
+
upb_fieldtype_t value_type);
|
4556
|
+
|
4557
|
+
/* Returns the number of entries in the map. */
|
4558
|
+
size_t upb_map_size(const upb_map *map);
|
4559
|
+
|
4560
|
+
/* Stores a value for the given key into |*val| (or the zero value if the key is
|
4561
|
+
* not present). Returns whether the key was present. The |val| pointer may be
|
4562
|
+
* NULL, in which case the function tests whether the given key is present. */
|
4563
|
+
bool upb_map_get(const upb_map *map, upb_msgval key, upb_msgval *val);
|
4564
|
+
|
4565
|
+
/* Removes all entries in the map. */
|
4566
|
+
void upb_map_clear(upb_map *map);
|
4567
|
+
|
4568
|
+
/* Sets the given key to the given value. Returns true if this was a new key in
|
4569
|
+
* the map, or false if an existing key was replaced. */
|
4570
|
+
bool upb_map_set(upb_map *map, upb_msgval key, upb_msgval val,
|
4571
|
+
upb_arena *arena);
|
4572
|
+
|
4573
|
+
/* Deletes this key from the table. Returns true if the key was present. */
|
4574
|
+
bool upb_map_delete(upb_map *map, upb_msgval key);
|
4575
|
+
|
4576
|
+
/* Map iteration:
|
4577
|
+
*
|
4578
|
+
* size_t iter = UPB_MAP_BEGIN;
|
4579
|
+
* while (upb_mapiter_next(map, &iter)) {
|
4580
|
+
* upb_msgval key = upb_mapiter_key(map, iter);
|
4581
|
+
* upb_msgval val = upb_mapiter_value(map, iter);
|
4582
|
+
*
|
4583
|
+
* // If mutating is desired.
|
4584
|
+
* upb_mapiter_setvalue(map, iter, value2);
|
4585
|
+
* }
|
4586
|
+
*/
|
4587
|
+
|
4588
|
+
/* Advances to the next entry. Returns false if no more entries are present. */
|
4589
|
+
bool upb_mapiter_next(const upb_map *map, size_t *iter);
|
4590
|
+
|
4591
|
+
/* Returns true if the iterator still points to a valid entry, or false if the
|
4592
|
+
* iterator is past the last element. It is an error to call this function with
|
4593
|
+
* UPB_MAP_BEGIN (you must call next() at least once first). */
|
4594
|
+
bool upb_mapiter_done(const upb_map *map, size_t iter);
|
4595
|
+
|
4596
|
+
/* Returns the key and value for this entry of the map. */
|
4597
|
+
upb_msgval upb_mapiter_key(const upb_map *map, size_t iter);
|
4598
|
+
upb_msgval upb_mapiter_value(const upb_map *map, size_t iter);
|
4599
|
+
|
4600
|
+
/* Sets the value for this entry. The iterator must not be done, and the
|
4601
|
+
* iterator must not have been initialized const. */
|
4602
|
+
void upb_mapiter_setvalue(upb_map *map, size_t iter, upb_msgval value);
|
4603
|
+
|
4604
|
+
#ifdef __cplusplus
|
4605
|
+
} /* extern "C" */
|
4606
|
+
#endif
|
4607
|
+
|
4608
|
+
|
4609
|
+
#endif /* UPB_REFLECTION_H_ */
|
4610
|
+
|
4611
|
+
/** upb/json_decode.h ************************************************************/
|
4612
|
+
#ifndef UPB_JSONDECODE_H_
|
4613
|
+
#define UPB_JSONDECODE_H_
|
4614
|
+
|
4615
|
+
|
4616
|
+
#ifdef __cplusplus
|
4617
|
+
extern "C" {
|
4618
|
+
#endif
|
4619
|
+
|
4620
|
+
enum {
|
4621
|
+
UPB_JSONDEC_IGNOREUNKNOWN = 1
|
4622
|
+
};
|
4623
|
+
|
4624
|
+
bool upb_json_decode(const char *buf, size_t size, upb_msg *msg,
|
4625
|
+
const upb_msgdef *m, const upb_symtab *any_pool,
|
4626
|
+
int options, upb_arena *arena, upb_status *status);
|
4627
|
+
|
4628
|
+
#ifdef __cplusplus
|
4629
|
+
} /* extern "C" */
|
4630
|
+
#endif
|
4631
|
+
|
4632
|
+
#endif /* UPB_JSONDECODE_H_ */
|
4633
|
+
|
4634
|
+
/** upb/json_encode.h ************************************************************/
|
4635
|
+
#ifndef UPB_JSONENCODE_H_
|
4636
|
+
#define UPB_JSONENCODE_H_
|
4637
|
+
|
4638
|
+
|
4639
|
+
#ifdef __cplusplus
|
4640
|
+
extern "C" {
|
4641
|
+
#endif
|
4642
|
+
|
4643
|
+
enum {
|
4644
|
+
/* When set, emits 0/default values. TODO(haberman): proto3 only? */
|
4645
|
+
UPB_JSONENC_EMITDEFAULTS = 1,
|
4646
|
+
|
4647
|
+
/* When set, use normal (snake_caes) field names instead of JSON (camelCase)
|
4648
|
+
names. */
|
4649
|
+
UPB_JSONENC_PROTONAMES = 2
|
4650
|
+
};
|
4651
|
+
|
4652
|
+
/* Encodes the given |msg| to JSON format. The message's reflection is given in
|
4653
|
+
* |m|. The symtab in |symtab| is used to find extensions (if NULL, extensions
|
4654
|
+
* will not be printed).
|
4655
|
+
*
|
4656
|
+
* Output is placed in the given buffer, and always NULL-terminated. The output
|
4657
|
+
* size (excluding NULL) is returned. This means that a return value >= |size|
|
4658
|
+
* implies that the output was truncated. (These are the same semantics as
|
4659
|
+
* snprintf()). */
|
4660
|
+
size_t upb_json_encode(const upb_msg *msg, const upb_msgdef *m,
|
4661
|
+
const upb_symtab *ext_pool, int options, char *buf,
|
4662
|
+
size_t size, upb_status *status);
|
4663
|
+
|
4664
|
+
#ifdef __cplusplus
|
4665
|
+
} /* extern "C" */
|
4666
|
+
#endif
|
4667
|
+
|
4668
|
+
#endif /* UPB_JSONENCODE_H_ */
|
4669
|
+
|
4670
|
+
/** upb/port_undef.inc ************************************************************/
|
4671
|
+
/* See port_def.inc. This should #undef all macros #defined there. */
|
4672
|
+
|
4673
|
+
#undef UPB_SIZE
|
4674
|
+
#undef UPB_PTR_AT
|
4675
|
+
#undef UPB_READ_ONEOF
|
4676
|
+
#undef UPB_WRITE_ONEOF
|
4677
|
+
#undef UPB_MAPTYPE_STRING
|
4678
|
+
#undef UPB_INLINE
|
4679
|
+
#undef UPB_ALIGN_UP
|
4680
|
+
#undef UPB_ALIGN_DOWN
|
4681
|
+
#undef UPB_ALIGN_MALLOC
|
4682
|
+
#undef UPB_ALIGN_OF
|
4683
|
+
#undef UPB_LIKELY
|
4684
|
+
#undef UPB_UNLIKELY
|
4685
|
+
#undef UPB_FORCEINLINE
|
4686
|
+
#undef UPB_NOINLINE
|
4687
|
+
#undef UPB_NORETURN
|
4688
|
+
#undef UPB_PRINTF
|
4689
|
+
#undef UPB_MAX
|
4690
|
+
#undef UPB_MIN
|
4691
|
+
#undef UPB_UNUSED
|
4692
|
+
#undef UPB_ASSUME
|
4693
|
+
#undef UPB_ASSERT
|
4694
|
+
#undef UPB_UNREACHABLE
|
4695
|
+
#undef UPB_SETJMP
|
4696
|
+
#undef UPB_LONGJMP
|
4697
|
+
#undef UPB_PTRADD
|
4698
|
+
#undef UPB_MUSTTAIL
|
4699
|
+
#undef UPB_FASTTABLE_SUPPORTED
|
4700
|
+
#undef UPB_FASTTABLE
|
4701
|
+
#undef UPB_FASTTABLE_INIT
|
4702
|
+
#undef UPB_POISON_MEMORY_REGION
|
4703
|
+
#undef UPB_UNPOISON_MEMORY_REGION
|
4704
|
+
#undef UPB_ASAN
|