Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 1 | // Ruby is still using proto3 enum semantics for proto2 |
| 2 | #define UPB_DISABLE_PROTO2_ENUM_CHECKING |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3 | /* Amalgamated source file */ |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 4 | |
| 5 | /* |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6 | * This is where we define internal portability macros used across upb. |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 7 | * |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8 | * All of these macros are undef'd in undef.inc to avoid leaking them to users. |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 9 | * |
| 10 | * The correct usage is: |
| 11 | * |
Protobuf Team Bot | fea7645 | 2023-09-12 20:32:11 +0000 | [diff] [blame] | 12 | * #include "upb/upb/foobar.h" |
| 13 | * #include "upb/upb/baz.h" |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 14 | * |
| 15 | * // MUST be last included header. |
Protobuf Team Bot | fea7645 | 2023-09-12 20:32:11 +0000 | [diff] [blame] | 16 | * #include "upb/upb/port/def.inc" |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 17 | * |
| 18 | * // Code for this file. |
| 19 | * // <...> |
| 20 | * |
| 21 | * // Can be omitted for .c files, required for .h. |
Protobuf Team Bot | fea7645 | 2023-09-12 20:32:11 +0000 | [diff] [blame] | 22 | * #include "upb/upb/port/undef.inc" |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 23 | * |
| 24 | * This file is private and must not be included by users! |
| 25 | */ |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 26 | |
| 27 | #if !((defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \ |
Mike Kruskal | fd0b1a5 | 2022-10-14 16:27:22 -0700 | [diff] [blame] | 28 | (defined(__cplusplus) && __cplusplus >= 201402L) || \ |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 29 | (defined(_MSC_VER) && _MSC_VER >= 1900)) |
Mike Kruskal | fd0b1a5 | 2022-10-14 16:27:22 -0700 | [diff] [blame] | 30 | #error upb requires C99 or C++14 or MSVC >= 2015. |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 31 | #endif |
| 32 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 33 | // Portable check for GCC minimum version: |
| 34 | // https://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html |
| 35 | #if defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__GNUC_PATCHLEVEL__) |
| 36 | #define UPB_GNUC_MIN(x, y) \ |
| 37 | (__GNUC__ > (x) || __GNUC__ == (x) && __GNUC_MINOR__ >= (y)) |
| 38 | #else |
| 39 | #define UPB_GNUC_MIN(x, y) 0 |
| 40 | #endif |
| 41 | |
| 42 | #include <assert.h> |
| 43 | #include <setjmp.h> |
| 44 | #include <stdbool.h> |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 45 | #include <stdint.h> |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 46 | #include <stdio.h> |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 47 | |
Adam Cozzette | 7d5592e | 2023-08-23 12:15:26 -0700 | [diff] [blame] | 48 | #ifndef UINTPTR_MAX |
| 49 | Error, UINTPTR_MAX is undefined |
| 50 | #endif |
| 51 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 52 | #if UINTPTR_MAX == 0xffffffff |
| 53 | #define UPB_SIZE(size32, size64) size32 |
| 54 | #else |
| 55 | #define UPB_SIZE(size32, size64) size64 |
| 56 | #endif |
| 57 | |
| 58 | /* If we always read/write as a consistent type to each address, this shouldn't |
| 59 | * violate aliasing. |
| 60 | */ |
| 61 | #define UPB_PTR_AT(msg, ofs, type) ((type*)((char*)(msg) + (ofs))) |
| 62 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 63 | #define UPB_MAPTYPE_STRING 0 |
| 64 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 65 | // UPB_EXPORT: always generate a public symbol. |
| 66 | #if defined(__GNUC__) || defined(__clang__) |
| 67 | #define UPB_EXPORT __attribute__((visibility("default"))) __attribute__((used)) |
| 68 | #else |
| 69 | #define UPB_EXPORT |
| 70 | #endif |
| 71 | |
| 72 | // UPB_INLINE: inline if possible, emit standalone code if required. |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 73 | #ifdef __cplusplus |
| 74 | #define UPB_INLINE inline |
| 75 | #elif defined (__GNUC__) || defined(__clang__) |
| 76 | #define UPB_INLINE static __inline__ |
| 77 | #else |
| 78 | #define UPB_INLINE static |
| 79 | #endif |
| 80 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 81 | #ifdef UPB_BUILD_API |
| 82 | #define UPB_API UPB_EXPORT |
| 83 | #define UPB_API_INLINE UPB_EXPORT |
| 84 | #else |
| 85 | #define UPB_API |
| 86 | #define UPB_API_INLINE UPB_INLINE |
| 87 | #endif |
| 88 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 89 | #define UPB_MALLOC_ALIGN 8 |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 90 | #define UPB_ALIGN_UP(size, align) (((size) + (align) - 1) / (align) * (align)) |
| 91 | #define UPB_ALIGN_DOWN(size, align) ((size) / (align) * (align)) |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 92 | #define UPB_ALIGN_MALLOC(size) UPB_ALIGN_UP(size, UPB_MALLOC_ALIGN) |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 93 | #ifdef __clang__ |
| 94 | #define UPB_ALIGN_OF(type) _Alignof(type) |
| 95 | #else |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 96 | #define UPB_ALIGN_OF(type) offsetof (struct { char c; type member; }, member) |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 97 | #endif |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 98 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 99 | // Hints to the compiler about likely/unlikely branches. |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 100 | #if defined (__GNUC__) || defined(__clang__) |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 101 | #define UPB_LIKELY(x) __builtin_expect((bool)(x), 1) |
| 102 | #define UPB_UNLIKELY(x) __builtin_expect((bool)(x), 0) |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 103 | #else |
| 104 | #define UPB_LIKELY(x) (x) |
| 105 | #define UPB_UNLIKELY(x) (x) |
| 106 | #endif |
| 107 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 108 | // Macros for function attributes on compilers that support them. |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 109 | #ifdef __GNUC__ |
| 110 | #define UPB_FORCEINLINE __inline__ __attribute__((always_inline)) |
| 111 | #define UPB_NOINLINE __attribute__((noinline)) |
| 112 | #define UPB_NORETURN __attribute__((__noreturn__)) |
| 113 | #define UPB_PRINTF(str, first_vararg) __attribute__((format (printf, str, first_vararg))) |
| 114 | #elif defined(_MSC_VER) |
| 115 | #define UPB_NOINLINE |
| 116 | #define UPB_FORCEINLINE |
| 117 | #define UPB_NORETURN __declspec(noreturn) |
| 118 | #define UPB_PRINTF(str, first_vararg) |
| 119 | #else /* !defined(__GNUC__) */ |
| 120 | #define UPB_FORCEINLINE |
| 121 | #define UPB_NOINLINE |
| 122 | #define UPB_NORETURN |
| 123 | #define UPB_PRINTF(str, first_vararg) |
| 124 | #endif |
| 125 | |
| 126 | #define UPB_MAX(x, y) ((x) > (y) ? (x) : (y)) |
| 127 | #define UPB_MIN(x, y) ((x) < (y) ? (x) : (y)) |
| 128 | |
| 129 | #define UPB_UNUSED(var) (void)var |
| 130 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 131 | // UPB_ASSUME(): in release mode, we tell the compiler to assume this is true. |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 132 | #ifdef NDEBUG |
| 133 | #ifdef __GNUC__ |
| 134 | #define UPB_ASSUME(expr) if (!(expr)) __builtin_unreachable() |
| 135 | #elif defined _MSC_VER |
| 136 | #define UPB_ASSUME(expr) if (!(expr)) __assume(0) |
| 137 | #else |
| 138 | #define UPB_ASSUME(expr) do {} while (false && (expr)) |
| 139 | #endif |
| 140 | #else |
| 141 | #define UPB_ASSUME(expr) assert(expr) |
| 142 | #endif |
| 143 | |
| 144 | /* UPB_ASSERT(): in release mode, we use the expression without letting it be |
| 145 | * evaluated. This prevents "unused variable" warnings. */ |
| 146 | #ifdef NDEBUG |
| 147 | #define UPB_ASSERT(expr) do {} while (false && (expr)) |
| 148 | #else |
| 149 | #define UPB_ASSERT(expr) assert(expr) |
| 150 | #endif |
| 151 | |
| 152 | #if defined(__GNUC__) || defined(__clang__) |
| 153 | #define UPB_UNREACHABLE() do { assert(0); __builtin_unreachable(); } while(0) |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 154 | #elif defined(_MSC_VER) |
| 155 | #define UPB_UNREACHABLE() \ |
| 156 | do { \ |
| 157 | assert(0); \ |
| 158 | __assume(0); \ |
| 159 | } while (0) |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 160 | #else |
| 161 | #define UPB_UNREACHABLE() do { assert(0); } while(0) |
| 162 | #endif |
| 163 | |
| 164 | /* UPB_SETJMP() / UPB_LONGJMP(): avoid setting/restoring signal mask. */ |
| 165 | #ifdef __APPLE__ |
| 166 | #define UPB_SETJMP(buf) _setjmp(buf) |
| 167 | #define UPB_LONGJMP(buf, val) _longjmp(buf, val) |
| 168 | #else |
| 169 | #define UPB_SETJMP(buf) setjmp(buf) |
| 170 | #define UPB_LONGJMP(buf, val) longjmp(buf, val) |
| 171 | #endif |
| 172 | |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 173 | #ifdef __GNUC__ |
| 174 | #define UPB_USE_C11_ATOMICS |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 175 | #define UPB_ATOMIC(T) _Atomic(T) |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 176 | #else |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 177 | #define UPB_ATOMIC(T) T |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 178 | #endif |
| 179 | |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 180 | /* UPB_PTRADD(ptr, ofs): add pointer while avoiding "NULL + 0" UB */ |
| 181 | #define UPB_PTRADD(ptr, ofs) ((ofs) ? (ptr) + (ofs) : (ptr)) |
| 182 | |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 183 | #define UPB_PRIVATE(x) x##_dont_copy_me__upb_internal_use_only |
| 184 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 185 | /* Configure whether fasttable is switched on or not. *************************/ |
| 186 | |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 187 | #ifdef __has_attribute |
| 188 | #define UPB_HAS_ATTRIBUTE(x) __has_attribute(x) |
| 189 | #else |
| 190 | #define UPB_HAS_ATTRIBUTE(x) 0 |
| 191 | #endif |
| 192 | |
| 193 | #if UPB_HAS_ATTRIBUTE(musttail) |
| 194 | #define UPB_MUSTTAIL __attribute__((musttail)) |
| 195 | #else |
| 196 | #define UPB_MUSTTAIL |
| 197 | #endif |
| 198 | |
| 199 | #undef UPB_HAS_ATTRIBUTE |
| 200 | |
| 201 | /* This check is not fully robust: it does not require that we have "musttail" |
| 202 | * support available. We need tail calls to avoid consuming arbitrary amounts |
| 203 | * of stack space. |
| 204 | * |
| 205 | * GCC/Clang can mostly be trusted to generate tail calls as long as |
| 206 | * optimization is enabled, but, debug builds will not generate tail calls |
| 207 | * unless "musttail" is available. |
| 208 | * |
| 209 | * We should probably either: |
| 210 | * 1. require that the compiler supports musttail. |
| 211 | * 2. add some fallback code for when musttail isn't available (ie. return |
| 212 | * instead of tail calling). This is safe and portable, but this comes at |
| 213 | * a CPU cost. |
| 214 | */ |
| 215 | #if (defined(__x86_64__) || defined(__aarch64__)) && defined(__GNUC__) |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 216 | #define UPB_FASTTABLE_SUPPORTED 1 |
| 217 | #else |
| 218 | #define UPB_FASTTABLE_SUPPORTED 0 |
| 219 | #endif |
| 220 | |
| 221 | /* define UPB_ENABLE_FASTTABLE to force fast table support. |
| 222 | * This is useful when we want to ensure we are really getting fasttable, |
| 223 | * for example for testing or benchmarking. */ |
| 224 | #if defined(UPB_ENABLE_FASTTABLE) |
| 225 | #if !UPB_FASTTABLE_SUPPORTED |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 226 | #error fasttable is x86-64/ARM64 only and requires GCC or Clang. |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 227 | #endif |
| 228 | #define UPB_FASTTABLE 1 |
| 229 | /* Define UPB_TRY_ENABLE_FASTTABLE to use fasttable if possible. |
| 230 | * This is useful for releasing code that might be used on multiple platforms, |
| 231 | * for example the PHP or Ruby C extensions. */ |
| 232 | #elif defined(UPB_TRY_ENABLE_FASTTABLE) |
| 233 | #define UPB_FASTTABLE UPB_FASTTABLE_SUPPORTED |
| 234 | #else |
| 235 | #define UPB_FASTTABLE 0 |
| 236 | #endif |
| 237 | |
| 238 | /* UPB_FASTTABLE_INIT() allows protos compiled for fasttable to gracefully |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 239 | * degrade to non-fasttable if the runtime or platform do not support it. */ |
| 240 | #if !UPB_FASTTABLE |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 241 | #define UPB_FASTTABLE_INIT(...) |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 242 | #define UPB_FASTTABLE_MASK(mask) -1 |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 243 | #else |
| 244 | #define UPB_FASTTABLE_INIT(...) __VA_ARGS__ |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 245 | #define UPB_FASTTABLE_MASK(mask) mask |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 246 | #endif |
| 247 | |
| 248 | #undef UPB_FASTTABLE_SUPPORTED |
| 249 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 250 | /* ASAN poisoning (for arena). |
| 251 | * If using UPB from an interpreted language like Ruby, a build of the |
Joshua Haberman | 488b8b9 | 2022-09-30 18:07:16 -0700 | [diff] [blame] | 252 | * interpreter compiled with ASAN enabled must be used in order to get sane and |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 253 | * expected behavior. |
| 254 | */ |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 255 | |
Sandy Zhang | e3b0943 | 2023-08-07 09:30:02 -0700 | [diff] [blame] | 256 | /* Due to preprocessor limitations, the conditional logic for setting |
| 257 | * UPN_CLANG_ASAN below cannot be consolidated into a portable one-liner. |
| 258 | * See https://gcc.gnu.org/onlinedocs/cpp/_005f_005fhas_005fattribute.html. |
| 259 | */ |
| 260 | #if defined(__has_feature) |
| 261 | #if __has_feature(address_sanitizer) |
| 262 | #define UPB_CLANG_ASAN 1 |
| 263 | #else |
| 264 | #define UPB_CLANG_ASAN 0 |
| 265 | #endif |
| 266 | #else |
| 267 | #define UPB_CLANG_ASAN 0 |
| 268 | #endif |
| 269 | |
| 270 | #if defined(__SANITIZE_ADDRESS__) || UPB_CLANG_ASAN |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 271 | #define UPB_ASAN 1 |
Sandy Zhang | e3b0943 | 2023-08-07 09:30:02 -0700 | [diff] [blame] | 272 | #define UPB_ASAN_GUARD_SIZE 32 |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 273 | #ifdef __cplusplus |
Adam Cozzette | 7d5592e | 2023-08-23 12:15:26 -0700 | [diff] [blame] | 274 | extern "C" { |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 275 | #endif |
| 276 | void __asan_poison_memory_region(void const volatile *addr, size_t size); |
| 277 | void __asan_unpoison_memory_region(void const volatile *addr, size_t size); |
| 278 | #ifdef __cplusplus |
| 279 | } /* extern "C" */ |
| 280 | #endif |
| 281 | #define UPB_POISON_MEMORY_REGION(addr, size) \ |
| 282 | __asan_poison_memory_region((addr), (size)) |
| 283 | #define UPB_UNPOISON_MEMORY_REGION(addr, size) \ |
| 284 | __asan_unpoison_memory_region((addr), (size)) |
| 285 | #else |
| 286 | #define UPB_ASAN 0 |
Sandy Zhang | e3b0943 | 2023-08-07 09:30:02 -0700 | [diff] [blame] | 287 | #define UPB_ASAN_GUARD_SIZE 0 |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 288 | #define UPB_POISON_MEMORY_REGION(addr, size) \ |
| 289 | ((void)(addr), (void)(size)) |
| 290 | #define UPB_UNPOISON_MEMORY_REGION(addr, size) \ |
| 291 | ((void)(addr), (void)(size)) |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 292 | #endif |
| 293 | |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 294 | /* Disable proto2 arena behavior (TEMPORARY) **********************************/ |
| 295 | |
| 296 | #ifdef UPB_DISABLE_PROTO2_ENUM_CHECKING |
| 297 | #define UPB_TREAT_PROTO2_ENUMS_LIKE_PROTO3 1 |
| 298 | #else |
| 299 | #define UPB_TREAT_PROTO2_ENUMS_LIKE_PROTO3 0 |
| 300 | #endif |
| 301 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 302 | #if defined(__cplusplus) |
| 303 | #if defined(__clang__) || UPB_GNUC_MIN(6, 0) |
| 304 | // https://gcc.gnu.org/gcc-6/changes.html |
| 305 | #if __cplusplus >= 201402L |
| 306 | #define UPB_DEPRECATED [[deprecated]] |
| 307 | #else |
| 308 | #define UPB_DEPRECATED __attribute__((deprecated)) |
| 309 | #endif |
| 310 | #else |
| 311 | #define UPB_DEPRECATED |
| 312 | #endif |
| 313 | #else |
| 314 | #define UPB_DEPRECATED |
| 315 | #endif |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 316 | |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 317 | // begin:google_only |
| 318 | // #define UPB_IS_GOOGLE3 |
| 319 | // end:google_only |
| 320 | |
| 321 | #if defined(UPB_IS_GOOGLE3) && !defined(UPB_BOOTSTRAP_STAGE0) |
| 322 | #define UPB_DESC(sym) proto2_##sym |
| 323 | #else |
| 324 | #define UPB_DESC(sym) google_protobuf_##sym |
| 325 | #endif |
| 326 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 327 | #ifndef UPB_BASE_STATUS_H_ |
| 328 | #define UPB_BASE_STATUS_H_ |
| 329 | |
| 330 | #include <stdarg.h> |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 331 | |
| 332 | // Must be last. |
| 333 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 334 | #define _kUpb_Status_MaxMessage 127 |
| 335 | |
| 336 | typedef struct { |
| 337 | bool ok; |
| 338 | char msg[_kUpb_Status_MaxMessage]; // Error message; NULL-terminated. |
| 339 | } upb_Status; |
| 340 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 341 | #ifdef __cplusplus |
| 342 | extern "C" { |
| 343 | #endif |
| 344 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 345 | UPB_API const char* upb_Status_ErrorMessage(const upb_Status* status); |
| 346 | UPB_API bool upb_Status_IsOk(const upb_Status* status); |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 347 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 348 | // These are no-op if |status| is NULL. |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 349 | UPB_API void upb_Status_Clear(upb_Status* status); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 350 | void upb_Status_SetErrorMessage(upb_Status* status, const char* msg); |
| 351 | void upb_Status_SetErrorFormat(upb_Status* status, const char* fmt, ...) |
| 352 | UPB_PRINTF(2, 3); |
| 353 | void upb_Status_VSetErrorFormat(upb_Status* status, const char* fmt, |
| 354 | va_list args) UPB_PRINTF(2, 0); |
| 355 | void upb_Status_VAppendErrorFormat(upb_Status* status, const char* fmt, |
| 356 | va_list args) UPB_PRINTF(2, 0); |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 357 | |
| 358 | #ifdef __cplusplus |
| 359 | } /* extern "C" */ |
| 360 | #endif |
| 361 | |
| 362 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 363 | #endif /* UPB_BASE_STATUS_H_ */ |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 364 | |
Adam Cozzette | 8059da2 | 2023-08-16 07:57:14 -0700 | [diff] [blame] | 365 | #ifndef UPB_COLLECTIONS_INTERNAL_ARRAY_H_ |
| 366 | #define UPB_COLLECTIONS_INTERNAL_ARRAY_H_ |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 367 | |
| 368 | #include <string.h> |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 369 | |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 370 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 371 | #ifndef UPB_COLLECTIONS_ARRAY_H_ |
| 372 | #define UPB_COLLECTIONS_ARRAY_H_ |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 373 | |
Protobuf Team Bot | 473d20d | 2023-09-15 22:27:16 +0000 | [diff] [blame] | 374 | #include <stddef.h> |
| 375 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 376 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 377 | #ifndef UPB_BASE_DESCRIPTOR_CONSTANTS_H_ |
| 378 | #define UPB_BASE_DESCRIPTOR_CONSTANTS_H_ |
| 379 | |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 380 | // Must be last. |
| 381 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 382 | // The types a field can have. Note that this list is not identical to the |
| 383 | // types defined in descriptor.proto, which gives INT32 and SINT32 separate |
| 384 | // types (we distinguish the two with the "integer encoding" enum below). |
| 385 | // This enum is an internal convenience only and has no meaning outside of upb. |
| 386 | typedef enum { |
| 387 | kUpb_CType_Bool = 1, |
| 388 | kUpb_CType_Float = 2, |
| 389 | kUpb_CType_Int32 = 3, |
| 390 | kUpb_CType_UInt32 = 4, |
Protobuf Team Bot | 986cbb6 | 2023-09-19 15:03:51 +0000 | [diff] [blame^] | 391 | kUpb_CType_Enum = 5, // Enum values are int32. TODO: rename |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 392 | kUpb_CType_Message = 6, |
| 393 | kUpb_CType_Double = 7, |
| 394 | kUpb_CType_Int64 = 8, |
| 395 | kUpb_CType_UInt64 = 9, |
| 396 | kUpb_CType_String = 10, |
| 397 | kUpb_CType_Bytes = 11 |
| 398 | } upb_CType; |
| 399 | |
| 400 | // The repeated-ness of each field; this matches descriptor.proto. |
| 401 | typedef enum { |
| 402 | kUpb_Label_Optional = 1, |
| 403 | kUpb_Label_Required = 2, |
| 404 | kUpb_Label_Repeated = 3 |
| 405 | } upb_Label; |
| 406 | |
| 407 | // Descriptor types, as defined in descriptor.proto. |
| 408 | typedef enum { |
| 409 | kUpb_FieldType_Double = 1, |
| 410 | kUpb_FieldType_Float = 2, |
| 411 | kUpb_FieldType_Int64 = 3, |
| 412 | kUpb_FieldType_UInt64 = 4, |
| 413 | kUpb_FieldType_Int32 = 5, |
| 414 | kUpb_FieldType_Fixed64 = 6, |
| 415 | kUpb_FieldType_Fixed32 = 7, |
| 416 | kUpb_FieldType_Bool = 8, |
| 417 | kUpb_FieldType_String = 9, |
| 418 | kUpb_FieldType_Group = 10, |
| 419 | kUpb_FieldType_Message = 11, |
| 420 | kUpb_FieldType_Bytes = 12, |
| 421 | kUpb_FieldType_UInt32 = 13, |
| 422 | kUpb_FieldType_Enum = 14, |
| 423 | kUpb_FieldType_SFixed32 = 15, |
| 424 | kUpb_FieldType_SFixed64 = 16, |
| 425 | kUpb_FieldType_SInt32 = 17, |
| 426 | kUpb_FieldType_SInt64 = 18, |
| 427 | } upb_FieldType; |
| 428 | |
| 429 | #define kUpb_FieldType_SizeOf 19 |
| 430 | |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 431 | #ifdef __cplusplus |
| 432 | extern "C" { |
| 433 | #endif |
| 434 | |
| 435 | UPB_INLINE bool upb_FieldType_IsPackable(upb_FieldType type) { |
| 436 | // clang-format off |
| 437 | const unsigned kUnpackableTypes = |
| 438 | (1 << kUpb_FieldType_String) | |
| 439 | (1 << kUpb_FieldType_Bytes) | |
| 440 | (1 << kUpb_FieldType_Message) | |
| 441 | (1 << kUpb_FieldType_Group); |
| 442 | // clang-format on |
| 443 | return (1 << type) & ~kUnpackableTypes; |
| 444 | } |
| 445 | |
| 446 | #ifdef __cplusplus |
| 447 | } /* extern "C" */ |
| 448 | #endif |
| 449 | |
| 450 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 451 | #endif /* UPB_BASE_DESCRIPTOR_CONSTANTS_H_ */ |
| 452 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 453 | /* upb_Arena is a specific allocator implementation that uses arena allocation. |
| 454 | * The user provides an allocator that will be used to allocate the underlying |
| 455 | * arena blocks. Arenas by nature do not require the individual allocations |
| 456 | * to be freed. However the Arena does allow users to register cleanup |
| 457 | * functions that will run when the arena is destroyed. |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 458 | * |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 459 | * A upb_Arena is *not* thread-safe. |
| 460 | * |
| 461 | * You could write a thread-safe arena allocator that satisfies the |
| 462 | * upb_alloc interface, but it would not be as efficient for the |
| 463 | * single-threaded case. */ |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 464 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 465 | #ifndef UPB_MEM_ARENA_H_ |
| 466 | #define UPB_MEM_ARENA_H_ |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 467 | |
Adam Cozzette | 7d5592e | 2023-08-23 12:15:26 -0700 | [diff] [blame] | 468 | #include <stddef.h> |
| 469 | #include <stdint.h> |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 470 | #include <string.h> |
| 471 | |
| 472 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 473 | #ifndef UPB_MEM_ALLOC_H_ |
| 474 | #define UPB_MEM_ALLOC_H_ |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 475 | |
| 476 | // Must be last. |
| 477 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 478 | #ifdef __cplusplus |
| 479 | extern "C" { |
| 480 | #endif |
| 481 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 482 | typedef struct upb_alloc upb_alloc; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 483 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 484 | /* A combined `malloc()`/`free()` function. |
| 485 | * If `size` is 0 then the function acts like `free()`, otherwise it acts like |
| 486 | * `realloc()`. Only `oldsize` bytes from a previous allocation are |
| 487 | * preserved. */ |
| 488 | typedef void* upb_alloc_func(upb_alloc* alloc, void* ptr, size_t oldsize, |
| 489 | size_t size); |
| 490 | |
| 491 | /* A upb_alloc is a possibly-stateful allocator object. |
| 492 | * |
| 493 | * It could either be an arena allocator (which doesn't require individual |
| 494 | * `free()` calls) or a regular `malloc()` (which does). The client must |
| 495 | * therefore free memory unless it knows that the allocator is an arena |
| 496 | * allocator. */ |
| 497 | struct upb_alloc { |
| 498 | upb_alloc_func* func; |
| 499 | }; |
| 500 | |
| 501 | UPB_INLINE void* upb_malloc(upb_alloc* alloc, size_t size) { |
| 502 | UPB_ASSERT(alloc); |
| 503 | return alloc->func(alloc, NULL, 0, size); |
| 504 | } |
| 505 | |
| 506 | UPB_INLINE void* upb_realloc(upb_alloc* alloc, void* ptr, size_t oldsize, |
| 507 | size_t size) { |
| 508 | UPB_ASSERT(alloc); |
| 509 | return alloc->func(alloc, ptr, oldsize, size); |
| 510 | } |
| 511 | |
| 512 | UPB_INLINE void upb_free(upb_alloc* alloc, void* ptr) { |
| 513 | UPB_ASSERT(alloc); |
| 514 | alloc->func(alloc, ptr, 0, 0); |
| 515 | } |
| 516 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 517 | // The global allocator used by upb. Uses the standard malloc()/free(). |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 518 | |
| 519 | extern upb_alloc upb_alloc_global; |
| 520 | |
| 521 | /* Functions that hard-code the global malloc. |
| 522 | * |
| 523 | * We still get benefit because we can put custom logic into our global |
| 524 | * allocator, like injecting out-of-memory faults in debug/testing builds. */ |
| 525 | |
| 526 | UPB_INLINE void* upb_gmalloc(size_t size) { |
| 527 | return upb_malloc(&upb_alloc_global, size); |
| 528 | } |
| 529 | |
| 530 | UPB_INLINE void* upb_grealloc(void* ptr, size_t oldsize, size_t size) { |
| 531 | return upb_realloc(&upb_alloc_global, ptr, oldsize, size); |
| 532 | } |
| 533 | |
| 534 | UPB_INLINE void upb_gfree(void* ptr) { upb_free(&upb_alloc_global, ptr); } |
| 535 | |
| 536 | #ifdef __cplusplus |
| 537 | } /* extern "C" */ |
| 538 | #endif |
| 539 | |
| 540 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 541 | #endif /* UPB_MEM_ALLOC_H_ */ |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 542 | |
| 543 | // Must be last. |
| 544 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 545 | typedef struct upb_Arena upb_Arena; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 546 | |
| 547 | typedef struct { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 548 | char *ptr, *end; |
| 549 | } _upb_ArenaHead; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 550 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 551 | #ifdef __cplusplus |
| 552 | extern "C" { |
| 553 | #endif |
| 554 | |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 555 | // Creates an arena from the given initial block (if any -- n may be 0). |
| 556 | // Additional blocks will be allocated from |alloc|. If |alloc| is NULL, this |
| 557 | // is a fixed-size arena and cannot grow. |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 558 | UPB_API upb_Arena* upb_Arena_Init(void* mem, size_t n, upb_alloc* alloc); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 559 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 560 | UPB_API void upb_Arena_Free(upb_Arena* a); |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 561 | UPB_API bool upb_Arena_Fuse(upb_Arena* a, upb_Arena* b); |
| 562 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 563 | void* _upb_Arena_SlowMalloc(upb_Arena* a, size_t size); |
| 564 | size_t upb_Arena_SpaceAllocated(upb_Arena* arena); |
| 565 | uint32_t upb_Arena_DebugRefCount(upb_Arena* arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 566 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 567 | UPB_INLINE size_t _upb_ArenaHas(upb_Arena* a) { |
| 568 | _upb_ArenaHead* h = (_upb_ArenaHead*)a; |
| 569 | return (size_t)(h->end - h->ptr); |
| 570 | } |
| 571 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 572 | UPB_API_INLINE void* upb_Arena_Malloc(upb_Arena* a, size_t size) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 573 | size = UPB_ALIGN_MALLOC(size); |
Sandy Zhang | e3b0943 | 2023-08-07 09:30:02 -0700 | [diff] [blame] | 574 | size_t span = size + UPB_ASAN_GUARD_SIZE; |
| 575 | if (UPB_UNLIKELY(_upb_ArenaHas(a) < span)) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 576 | return _upb_Arena_SlowMalloc(a, size); |
| 577 | } |
| 578 | |
| 579 | // We have enough space to do a fast malloc. |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 580 | _upb_ArenaHead* h = (_upb_ArenaHead*)a; |
| 581 | void* ret = h->ptr; |
| 582 | UPB_ASSERT(UPB_ALIGN_MALLOC((uintptr_t)ret) == (uintptr_t)ret); |
| 583 | UPB_ASSERT(UPB_ALIGN_MALLOC(size) == size); |
| 584 | UPB_UNPOISON_MEMORY_REGION(ret, size); |
| 585 | |
Sandy Zhang | e3b0943 | 2023-08-07 09:30:02 -0700 | [diff] [blame] | 586 | h->ptr += span; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 587 | |
| 588 | return ret; |
| 589 | } |
| 590 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 591 | // Shrinks the last alloc from arena. |
| 592 | // REQUIRES: (ptr, oldsize) was the last malloc/realloc from this arena. |
| 593 | // We could also add a upb_Arena_TryShrinkLast() which is simply a no-op if |
| 594 | // this was not the last alloc. |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 595 | UPB_API_INLINE void upb_Arena_ShrinkLast(upb_Arena* a, void* ptr, |
| 596 | size_t oldsize, size_t size) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 597 | _upb_ArenaHead* h = (_upb_ArenaHead*)a; |
| 598 | oldsize = UPB_ALIGN_MALLOC(oldsize); |
| 599 | size = UPB_ALIGN_MALLOC(size); |
Sandy Zhang | e3b0943 | 2023-08-07 09:30:02 -0700 | [diff] [blame] | 600 | // Must be the last alloc. |
| 601 | UPB_ASSERT((char*)ptr + oldsize == h->ptr - UPB_ASAN_GUARD_SIZE); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 602 | UPB_ASSERT(size <= oldsize); |
| 603 | h->ptr = (char*)ptr + size; |
| 604 | } |
| 605 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 606 | UPB_API_INLINE void* upb_Arena_Realloc(upb_Arena* a, void* ptr, size_t oldsize, |
| 607 | size_t size) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 608 | _upb_ArenaHead* h = (_upb_ArenaHead*)a; |
| 609 | oldsize = UPB_ALIGN_MALLOC(oldsize); |
| 610 | size = UPB_ALIGN_MALLOC(size); |
| 611 | bool is_most_recent_alloc = (uintptr_t)ptr + oldsize == (uintptr_t)h->ptr; |
| 612 | |
| 613 | if (is_most_recent_alloc) { |
| 614 | ptrdiff_t diff = size - oldsize; |
| 615 | if ((ptrdiff_t)_upb_ArenaHas(a) >= diff) { |
| 616 | h->ptr += diff; |
| 617 | return ptr; |
| 618 | } |
| 619 | } else if (size <= oldsize) { |
| 620 | return ptr; |
| 621 | } |
| 622 | |
| 623 | void* ret = upb_Arena_Malloc(a, size); |
| 624 | |
| 625 | if (ret && oldsize > 0) { |
| 626 | memcpy(ret, ptr, UPB_MIN(oldsize, size)); |
| 627 | } |
| 628 | |
| 629 | return ret; |
| 630 | } |
| 631 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 632 | UPB_API_INLINE upb_Arena* upb_Arena_New(void) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 633 | return upb_Arena_Init(NULL, 0, &upb_alloc_global); |
| 634 | } |
| 635 | |
| 636 | #ifdef __cplusplus |
| 637 | } /* extern "C" */ |
| 638 | #endif |
| 639 | |
| 640 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 641 | #endif /* UPB_MEM_ARENA_H_ */ |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 642 | |
Protobuf Team Bot | 473d20d | 2023-09-15 22:27:16 +0000 | [diff] [blame] | 643 | // Users should include array.h or map.h instead. |
| 644 | // IWYU pragma: private, include "upb/upb/collections/array.h" |
| 645 | |
| 646 | #ifndef UPB_MESSAGE_VALUE_H_ |
| 647 | #define UPB_MESSAGE_VALUE_H_ |
| 648 | |
| 649 | #include <stdint.h> |
| 650 | |
| 651 | #ifndef UPB_BASE_STRING_VIEW_H_ |
| 652 | #define UPB_BASE_STRING_VIEW_H_ |
| 653 | |
| 654 | #include <string.h> |
| 655 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 656 | // Must be last. |
| 657 | |
Protobuf Team Bot | 473d20d | 2023-09-15 22:27:16 +0000 | [diff] [blame] | 658 | #define UPB_STRINGVIEW_INIT(ptr, len) \ |
| 659 | { ptr, len } |
| 660 | |
| 661 | #define UPB_STRINGVIEW_FORMAT "%.*s" |
| 662 | #define UPB_STRINGVIEW_ARGS(view) (int)(view).size, (view).data |
| 663 | |
| 664 | // LINT.IfChange(struct_definition) |
| 665 | typedef struct { |
| 666 | const char* data; |
| 667 | size_t size; |
| 668 | } upb_StringView; |
| 669 | // LINT.ThenChange( |
| 670 | // GoogleInternalName0, |
| 671 | // //depot/google3/third_party/upb/bits/golang/accessor.go:map_go_string |
| 672 | // ) |
| 673 | |
| 674 | #ifdef __cplusplus |
| 675 | extern "C" { |
| 676 | #endif |
| 677 | |
| 678 | UPB_API_INLINE upb_StringView upb_StringView_FromDataAndSize(const char* data, |
| 679 | size_t size) { |
| 680 | upb_StringView ret; |
| 681 | ret.data = data; |
| 682 | ret.size = size; |
| 683 | return ret; |
| 684 | } |
| 685 | |
| 686 | UPB_INLINE upb_StringView upb_StringView_FromString(const char* data) { |
| 687 | return upb_StringView_FromDataAndSize(data, strlen(data)); |
| 688 | } |
| 689 | |
| 690 | UPB_INLINE bool upb_StringView_IsEqual(upb_StringView a, upb_StringView b) { |
| 691 | return a.size == b.size && memcmp(a.data, b.data, a.size) == 0; |
| 692 | } |
| 693 | |
| 694 | #ifdef __cplusplus |
| 695 | } /* extern "C" */ |
| 696 | #endif |
| 697 | |
| 698 | |
| 699 | #endif /* UPB_BASE_STRING_VIEW_H_ */ |
| 700 | |
| 701 | #ifndef UPB_MINI_TABLE_TYPES_H_ |
| 702 | #define UPB_MINI_TABLE_TYPES_H_ |
| 703 | |
| 704 | #include <stdint.h> |
| 705 | |
| 706 | |
| 707 | #ifndef UPB_MESSAGE_TYPES_H_ |
| 708 | #define UPB_MESSAGE_TYPES_H_ |
| 709 | |
| 710 | // This typedef is in a leaf header to resolve a circular dependency between |
| 711 | // messages and mini tables. |
| 712 | typedef void upb_Message; |
| 713 | |
| 714 | #endif /* UPB_MESSAGE_TYPES_H_ */ |
| 715 | |
| 716 | // Must be last. |
| 717 | |
| 718 | #ifdef __cplusplus |
| 719 | extern "C" { |
| 720 | #endif |
| 721 | |
| 722 | // When a upb_Message* is stored in a message, array, or map, it is stored in a |
| 723 | // tagged form. If the tag bit is set, the referenced upb_Message is of type |
| 724 | // _kUpb_MiniTable_Empty (a sentinel message type with no fields) instead of |
| 725 | // that field's true message type. This forms the basis of what we call |
| 726 | // "dynamic tree shaking." |
| 727 | // |
| 728 | // See the documentation for kUpb_DecodeOption_ExperimentalAllowUnlinked for |
| 729 | // more information. |
| 730 | typedef uintptr_t upb_TaggedMessagePtr; |
| 731 | |
| 732 | // Internal-only because empty messages cannot be created by the user. |
| 733 | UPB_INLINE upb_TaggedMessagePtr _upb_TaggedMessagePtr_Pack(upb_Message* ptr, |
| 734 | bool empty) { |
| 735 | UPB_ASSERT(((uintptr_t)ptr & 1) == 0); |
| 736 | return (uintptr_t)ptr | (empty ? 1 : 0); |
| 737 | } |
| 738 | |
| 739 | // Users who enable unlinked sub-messages must use this to test whether a |
| 740 | // message is empty before accessing it. If a message is empty, it must be |
| 741 | // first promoted using the interfaces in message/promote.h. |
| 742 | UPB_INLINE bool upb_TaggedMessagePtr_IsEmpty(upb_TaggedMessagePtr ptr) { |
| 743 | return ptr & 1; |
| 744 | } |
| 745 | |
| 746 | UPB_INLINE upb_Message* _upb_TaggedMessagePtr_GetMessage( |
| 747 | upb_TaggedMessagePtr ptr) { |
| 748 | return (upb_Message*)(ptr & ~(uintptr_t)1); |
| 749 | } |
| 750 | |
| 751 | UPB_INLINE upb_Message* upb_TaggedMessagePtr_GetNonEmptyMessage( |
| 752 | upb_TaggedMessagePtr ptr) { |
| 753 | UPB_ASSERT(!upb_TaggedMessagePtr_IsEmpty(ptr)); |
| 754 | return _upb_TaggedMessagePtr_GetMessage(ptr); |
| 755 | } |
| 756 | |
| 757 | UPB_INLINE upb_Message* _upb_TaggedMessagePtr_GetEmptyMessage( |
| 758 | upb_TaggedMessagePtr ptr) { |
| 759 | UPB_ASSERT(upb_TaggedMessagePtr_IsEmpty(ptr)); |
| 760 | return _upb_TaggedMessagePtr_GetMessage(ptr); |
| 761 | } |
| 762 | |
| 763 | #ifdef __cplusplus |
| 764 | } /* extern "C" */ |
| 765 | #endif |
| 766 | |
| 767 | |
| 768 | #endif /* UPB_MINI_TABLE_TYPES_H_ */ |
| 769 | |
| 770 | typedef union { |
| 771 | bool bool_val; |
| 772 | float float_val; |
| 773 | double double_val; |
| 774 | int32_t int32_val; |
| 775 | int64_t int64_val; |
| 776 | uint32_t uint32_val; |
| 777 | uint64_t uint64_val; |
| 778 | const struct upb_Array* array_val; |
| 779 | const struct upb_Map* map_val; |
| 780 | const upb_Message* msg_val; |
| 781 | upb_StringView str_val; |
| 782 | |
| 783 | // EXPERIMENTAL: A tagged upb_Message*. Users must use this instead of |
| 784 | // msg_val if unlinked sub-messages may possibly be in use. See the |
| 785 | // documentation in kUpb_DecodeOption_ExperimentalAllowUnlinked for more |
| 786 | // information. |
| 787 | upb_TaggedMessagePtr tagged_msg_val; |
| 788 | } upb_MessageValue; |
| 789 | |
| 790 | typedef union { |
| 791 | struct upb_Array* array; |
| 792 | struct upb_Map* map; |
| 793 | upb_Message* msg; |
| 794 | } upb_MutableMessageValue; |
| 795 | |
| 796 | #endif /* UPB_MESSAGE_VALUE_H_ */ |
| 797 | |
| 798 | // Must be last. |
| 799 | |
| 800 | typedef struct upb_Array upb_Array; |
| 801 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 802 | #ifdef __cplusplus |
| 803 | extern "C" { |
| 804 | #endif |
| 805 | |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 806 | // Creates a new array on the given arena that holds elements of this type. |
| 807 | UPB_API upb_Array* upb_Array_New(upb_Arena* a, upb_CType type); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 808 | |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 809 | // Returns the number of elements in the array. |
| 810 | UPB_API size_t upb_Array_Size(const upb_Array* arr); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 811 | |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 812 | // Returns the given element, which must be within the array's current size. |
| 813 | UPB_API upb_MessageValue upb_Array_Get(const upb_Array* arr, size_t i); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 814 | |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 815 | // Sets the given element, which must be within the array's current size. |
| 816 | UPB_API void upb_Array_Set(upb_Array* arr, size_t i, upb_MessageValue val); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 817 | |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 818 | // Appends an element to the array. Returns false on allocation failure. |
| 819 | UPB_API bool upb_Array_Append(upb_Array* array, upb_MessageValue val, |
| 820 | upb_Arena* arena); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 821 | |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 822 | // Moves elements within the array using memmove(). |
| 823 | // Like memmove(), the source and destination elements may be overlapping. |
| 824 | UPB_API void upb_Array_Move(upb_Array* array, size_t dst_idx, size_t src_idx, |
| 825 | size_t count); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 826 | |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 827 | // Inserts one or more empty elements into the array. |
| 828 | // Existing elements are shifted right. |
| 829 | // The new elements have undefined state and must be set with `upb_Array_Set()`. |
| 830 | // REQUIRES: `i <= upb_Array_Size(arr)` |
| 831 | UPB_API bool upb_Array_Insert(upb_Array* array, size_t i, size_t count, |
| 832 | upb_Arena* arena); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 833 | |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 834 | // Deletes one or more elements from the array. |
| 835 | // Existing elements are shifted left. |
| 836 | // REQUIRES: `i + count <= upb_Array_Size(arr)` |
| 837 | UPB_API void upb_Array_Delete(upb_Array* array, size_t i, size_t count); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 838 | |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 839 | // Changes the size of a vector. New elements are initialized to NULL/0. |
| 840 | // Returns false on allocation failure. |
| 841 | UPB_API bool upb_Array_Resize(upb_Array* array, size_t size, upb_Arena* arena); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 842 | |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 843 | // Returns pointer to array data. |
| 844 | UPB_API const void* upb_Array_DataPtr(const upb_Array* arr); |
| 845 | |
| 846 | // Returns mutable pointer to array data. |
| 847 | UPB_API void* upb_Array_MutableDataPtr(upb_Array* arr); |
| 848 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 849 | #ifdef __cplusplus |
| 850 | } /* extern "C" */ |
| 851 | #endif |
| 852 | |
| 853 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 854 | #endif /* UPB_COLLECTIONS_ARRAY_H_ */ |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 855 | |
| 856 | // Must be last. |
| 857 | |
| 858 | #ifdef __cplusplus |
| 859 | extern "C" { |
| 860 | #endif |
| 861 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 862 | // LINT.IfChange(struct_definition) |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 863 | // Our internal representation for repeated fields. |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 864 | struct upb_Array { |
| 865 | uintptr_t data; /* Tagged ptr: low 3 bits of ptr are lg2(elem size). */ |
| 866 | size_t size; /* The number of elements in the array. */ |
| 867 | size_t capacity; /* Allocated storage. Measured in elements. */ |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 868 | }; |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 869 | // LINT.ThenChange(GoogleInternalName1) |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 870 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 871 | UPB_INLINE size_t _upb_Array_ElementSizeLg2(const upb_Array* arr) { |
| 872 | size_t ret = arr->data & 7; |
| 873 | UPB_ASSERT(ret <= 4); |
| 874 | return ret; |
| 875 | } |
| 876 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 877 | UPB_INLINE const void* _upb_array_constptr(const upb_Array* arr) { |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 878 | _upb_Array_ElementSizeLg2(arr); // Check assertion. |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 879 | return (void*)(arr->data & ~(uintptr_t)7); |
| 880 | } |
| 881 | |
| 882 | UPB_INLINE uintptr_t _upb_array_tagptr(void* ptr, int elem_size_lg2) { |
| 883 | UPB_ASSERT(elem_size_lg2 <= 4); |
| 884 | return (uintptr_t)ptr | elem_size_lg2; |
| 885 | } |
| 886 | |
| 887 | UPB_INLINE void* _upb_array_ptr(upb_Array* arr) { |
| 888 | return (void*)_upb_array_constptr(arr); |
| 889 | } |
| 890 | |
| 891 | UPB_INLINE uintptr_t _upb_tag_arrptr(void* ptr, int elem_size_lg2) { |
| 892 | UPB_ASSERT(elem_size_lg2 <= 4); |
| 893 | UPB_ASSERT(((uintptr_t)ptr & 7) == 0); |
| 894 | return (uintptr_t)ptr | (unsigned)elem_size_lg2; |
| 895 | } |
| 896 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 897 | extern const char _upb_Array_CTypeSizeLg2Table[]; |
| 898 | |
| 899 | UPB_INLINE size_t _upb_Array_CTypeSizeLg2(upb_CType ctype) { |
| 900 | return _upb_Array_CTypeSizeLg2Table[ctype]; |
| 901 | } |
| 902 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 903 | UPB_INLINE upb_Array* _upb_Array_New(upb_Arena* a, size_t init_capacity, |
| 904 | int elem_size_lg2) { |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 905 | UPB_ASSERT(elem_size_lg2 <= 4); |
Joshua Haberman | 7755973 | 2022-10-03 11:13:05 -0700 | [diff] [blame] | 906 | const size_t arr_size = UPB_ALIGN_UP(sizeof(upb_Array), UPB_MALLOC_ALIGN); |
| 907 | const size_t bytes = arr_size + (init_capacity << elem_size_lg2); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 908 | upb_Array* arr = (upb_Array*)upb_Arena_Malloc(a, bytes); |
| 909 | if (!arr) return NULL; |
| 910 | arr->data = _upb_tag_arrptr(UPB_PTR_AT(arr, arr_size, void), elem_size_lg2); |
| 911 | arr->size = 0; |
| 912 | arr->capacity = init_capacity; |
| 913 | return arr; |
| 914 | } |
| 915 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 916 | // Resizes the capacity of the array to be at least min_size. |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 917 | bool _upb_array_realloc(upb_Array* arr, size_t min_size, upb_Arena* arena); |
| 918 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 919 | UPB_INLINE bool _upb_array_reserve(upb_Array* arr, size_t size, |
| 920 | upb_Arena* arena) { |
| 921 | if (arr->capacity < size) return _upb_array_realloc(arr, size, arena); |
| 922 | return true; |
| 923 | } |
| 924 | |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 925 | // Resize without initializing new elements. |
| 926 | UPB_INLINE bool _upb_Array_ResizeUninitialized(upb_Array* arr, size_t size, |
| 927 | upb_Arena* arena) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 928 | UPB_ASSERT(size <= arr->size || arena); // Allow NULL arena when shrinking. |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 929 | if (!_upb_array_reserve(arr, size, arena)) return false; |
| 930 | arr->size = size; |
| 931 | return true; |
| 932 | } |
| 933 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 934 | // This function is intended for situations where elem_size is compile-time |
| 935 | // constant or a known expression of the form (1 << lg2), so that the expression |
| 936 | // i*elem_size does not result in an actual multiplication. |
| 937 | UPB_INLINE void _upb_Array_Set(upb_Array* arr, size_t i, const void* data, |
| 938 | size_t elem_size) { |
| 939 | UPB_ASSERT(i < arr->size); |
| 940 | UPB_ASSERT(elem_size == 1U << _upb_Array_ElementSizeLg2(arr)); |
| 941 | char* arr_data = (char*)_upb_array_ptr(arr); |
| 942 | memcpy(arr_data + (i * elem_size), data, elem_size); |
| 943 | } |
| 944 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 945 | UPB_INLINE void _upb_array_detach(const void* msg, size_t ofs) { |
| 946 | *UPB_PTR_AT(msg, ofs, upb_Array*) = NULL; |
| 947 | } |
| 948 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 949 | #ifdef __cplusplus |
| 950 | } /* extern "C" */ |
| 951 | #endif |
| 952 | |
| 953 | |
Adam Cozzette | 8059da2 | 2023-08-16 07:57:14 -0700 | [diff] [blame] | 954 | #endif /* UPB_COLLECTIONS_INTERNAL_ARRAY_H_ */ |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 955 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 956 | #ifndef UPB_COLLECTIONS_MAP_H_ |
| 957 | #define UPB_COLLECTIONS_MAP_H_ |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 958 | |
Protobuf Team Bot | 473d20d | 2023-09-15 22:27:16 +0000 | [diff] [blame] | 959 | #include <stddef.h> |
| 960 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 961 | |
| 962 | // Must be last. |
| 963 | |
Protobuf Team Bot | 473d20d | 2023-09-15 22:27:16 +0000 | [diff] [blame] | 964 | typedef struct upb_Map upb_Map; |
| 965 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 966 | #ifdef __cplusplus |
| 967 | extern "C" { |
| 968 | #endif |
| 969 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 970 | // Creates a new map on the given arena with the given key/value size. |
| 971 | UPB_API upb_Map* upb_Map_New(upb_Arena* a, upb_CType key_type, |
| 972 | upb_CType value_type); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 973 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 974 | // Returns the number of entries in the map. |
| 975 | UPB_API size_t upb_Map_Size(const upb_Map* map); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 976 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 977 | // Stores a value for the given key into |*val| (or the zero value if the key is |
| 978 | // not present). Returns whether the key was present. The |val| pointer may be |
| 979 | // NULL, in which case the function tests whether the given key is present. |
| 980 | UPB_API bool upb_Map_Get(const upb_Map* map, upb_MessageValue key, |
| 981 | upb_MessageValue* val); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 982 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 983 | // Removes all entries in the map. |
| 984 | UPB_API void upb_Map_Clear(upb_Map* map); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 985 | |
| 986 | typedef enum { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 987 | kUpb_MapInsertStatus_Inserted = 0, |
| 988 | kUpb_MapInsertStatus_Replaced = 1, |
| 989 | kUpb_MapInsertStatus_OutOfMemory = 2, |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 990 | } upb_MapInsertStatus; |
| 991 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 992 | // Sets the given key to the given value, returning whether the key was inserted |
| 993 | // or replaced. If the key was inserted, then any existing iterators will be |
| 994 | // invalidated. |
| 995 | UPB_API upb_MapInsertStatus upb_Map_Insert(upb_Map* map, upb_MessageValue key, |
| 996 | upb_MessageValue val, |
| 997 | upb_Arena* arena); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 998 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 999 | // Sets the given key to the given value. Returns false if memory allocation |
| 1000 | // failed. If the key is newly inserted, then any existing iterators will be |
| 1001 | // invalidated. |
| 1002 | UPB_API_INLINE bool upb_Map_Set(upb_Map* map, upb_MessageValue key, |
| 1003 | upb_MessageValue val, upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1004 | return upb_Map_Insert(map, key, val, arena) != |
| 1005 | kUpb_MapInsertStatus_OutOfMemory; |
| 1006 | } |
| 1007 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1008 | // Deletes this key from the table. Returns true if the key was present. |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 1009 | // If present and |val| is non-NULL, stores the deleted value. |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 1010 | UPB_API bool upb_Map_Delete(upb_Map* map, upb_MessageValue key, |
| 1011 | upb_MessageValue* val); |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 1012 | |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 1013 | // (DEPRECATED and going away soon. Do not use.) |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 1014 | UPB_INLINE bool upb_Map_Delete2(upb_Map* map, upb_MessageValue key, |
| 1015 | upb_MessageValue* val) { |
| 1016 | return upb_Map_Delete(map, key, val); |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 1017 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1018 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1019 | // Map iteration: |
| 1020 | // |
| 1021 | // size_t iter = kUpb_Map_Begin; |
| 1022 | // upb_MessageValue key, val; |
| 1023 | // while (upb_Map_Next(map, &key, &val, &iter)) { |
| 1024 | // ... |
| 1025 | // } |
| 1026 | |
| 1027 | #define kUpb_Map_Begin ((size_t)-1) |
| 1028 | |
| 1029 | // Advances to the next entry. Returns false if no more entries are present. |
| 1030 | // Otherwise returns true and populates both *key and *value. |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 1031 | UPB_API bool upb_Map_Next(const upb_Map* map, upb_MessageValue* key, |
| 1032 | upb_MessageValue* val, size_t* iter); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1033 | |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 1034 | // Sets the value for the entry pointed to by iter. |
| 1035 | // WARNING: this does not currently work for string values! |
| 1036 | UPB_API void upb_Map_SetEntryValue(upb_Map* map, size_t iter, |
| 1037 | upb_MessageValue val); |
| 1038 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1039 | // DEPRECATED iterator, slated for removal. |
| 1040 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1041 | /* Map iteration: |
| 1042 | * |
| 1043 | * size_t iter = kUpb_Map_Begin; |
| 1044 | * while (upb_MapIterator_Next(map, &iter)) { |
| 1045 | * upb_MessageValue key = upb_MapIterator_Key(map, iter); |
| 1046 | * upb_MessageValue val = upb_MapIterator_Value(map, iter); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1047 | * } |
| 1048 | */ |
| 1049 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1050 | // Advances to the next entry. Returns false if no more entries are present. |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 1051 | UPB_API bool upb_MapIterator_Next(const upb_Map* map, size_t* iter); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1052 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 1053 | // Returns true if the iterator still points to a valid entry, or false if the |
| 1054 | // iterator is past the last element. It is an error to call this function with |
| 1055 | // kUpb_Map_Begin (you must call next() at least once first). |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 1056 | UPB_API bool upb_MapIterator_Done(const upb_Map* map, size_t iter); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1057 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 1058 | // Returns the key and value for this entry of the map. |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 1059 | UPB_API upb_MessageValue upb_MapIterator_Key(const upb_Map* map, size_t iter); |
| 1060 | UPB_API upb_MessageValue upb_MapIterator_Value(const upb_Map* map, size_t iter); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1061 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1062 | #ifdef __cplusplus |
| 1063 | } /* extern "C" */ |
| 1064 | #endif |
| 1065 | |
| 1066 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 1067 | #endif /* UPB_COLLECTIONS_MAP_H_ */ |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1068 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1069 | // EVERYTHING BELOW THIS LINE IS INTERNAL - DO NOT USE ///////////////////////// |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1070 | |
Adam Cozzette | 8059da2 | 2023-08-16 07:57:14 -0700 | [diff] [blame] | 1071 | #ifndef UPB_COLLECTIONS_INTERNAL_MAP_H_ |
| 1072 | #define UPB_COLLECTIONS_INTERNAL_MAP_H_ |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1073 | |
| 1074 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1075 | #ifndef UPB_HASH_STR_TABLE_H_ |
| 1076 | #define UPB_HASH_STR_TABLE_H_ |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1077 | |
| 1078 | |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 1079 | /* |
| 1080 | * upb_table |
| 1081 | * |
| 1082 | * This header is INTERNAL-ONLY! Its interfaces are not public or stable! |
| 1083 | * This file defines very fast int->upb_value (inttable) and string->upb_value |
| 1084 | * (strtable) hash tables. |
| 1085 | * |
| 1086 | * The table uses chained scatter with Brent's variation (inspired by the Lua |
| 1087 | * implementation of hash tables). The hash function for strings is Austin |
| 1088 | * Appleby's "MurmurHash." |
| 1089 | * |
| 1090 | * The inttable uses uintptr_t as its key, which guarantees it can be used to |
| 1091 | * store pointers or integers of at least 32 bits (upb isn't really useful on |
| 1092 | * systems where sizeof(void*) < 4). |
| 1093 | * |
| 1094 | * The table must be homogeneous (all values of the same type). In debug |
| 1095 | * mode, we check this on insert and lookup. |
| 1096 | */ |
| 1097 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1098 | #ifndef UPB_HASH_COMMON_H_ |
| 1099 | #define UPB_HASH_COMMON_H_ |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 1100 | |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 1101 | #include <string.h> |
| 1102 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1103 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1104 | // Must be last. |
| 1105 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1106 | #ifdef __cplusplus |
| 1107 | extern "C" { |
| 1108 | #endif |
| 1109 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1110 | /* upb_value ******************************************************************/ |
| 1111 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1112 | typedef struct { |
| 1113 | uint64_t val; |
| 1114 | } upb_value; |
| 1115 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1116 | UPB_INLINE void _upb_value_setval(upb_value* v, uint64_t val) { v->val = val; } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1117 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1118 | /* For each value ctype, define the following set of functions: |
| 1119 | * |
| 1120 | * // Get/set an int32 from a upb_value. |
| 1121 | * int32_t upb_value_getint32(upb_value val); |
| 1122 | * void upb_value_setint32(upb_value *val, int32_t cval); |
| 1123 | * |
| 1124 | * // Construct a new upb_value from an int32. |
| 1125 | * upb_value upb_value_int32(int32_t val); */ |
Protobuf Team Bot | 4d0e805 | 2023-09-13 15:50:57 +0000 | [diff] [blame] | 1126 | #define FUNCS(name, membername, type_t, converter) \ |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1127 | UPB_INLINE void upb_value_set##name(upb_value* val, type_t cval) { \ |
| 1128 | val->val = (converter)cval; \ |
| 1129 | } \ |
| 1130 | UPB_INLINE upb_value upb_value_##name(type_t val) { \ |
| 1131 | upb_value ret; \ |
| 1132 | upb_value_set##name(&ret, val); \ |
| 1133 | return ret; \ |
| 1134 | } \ |
| 1135 | UPB_INLINE type_t upb_value_get##name(upb_value val) { \ |
| 1136 | return (type_t)(converter)val.val; \ |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1137 | } |
| 1138 | |
Protobuf Team Bot | 4d0e805 | 2023-09-13 15:50:57 +0000 | [diff] [blame] | 1139 | FUNCS(int32, int32, int32_t, int32_t) |
| 1140 | FUNCS(int64, int64, int64_t, int64_t) |
| 1141 | FUNCS(uint32, uint32, uint32_t, uint32_t) |
| 1142 | FUNCS(uint64, uint64, uint64_t, uint64_t) |
| 1143 | FUNCS(bool, _bool, bool, bool) |
| 1144 | FUNCS(cstr, cstr, char*, uintptr_t) |
| 1145 | FUNCS(uintptr, uptr, uintptr_t, uintptr_t) |
| 1146 | FUNCS(ptr, ptr, void*, uintptr_t) |
| 1147 | FUNCS(constptr, constptr, const void*, uintptr_t) |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1148 | |
| 1149 | #undef FUNCS |
| 1150 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1151 | UPB_INLINE void upb_value_setfloat(upb_value* val, float cval) { |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1152 | memcpy(&val->val, &cval, sizeof(cval)); |
| 1153 | } |
| 1154 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1155 | UPB_INLINE void upb_value_setdouble(upb_value* val, double cval) { |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1156 | memcpy(&val->val, &cval, sizeof(cval)); |
| 1157 | } |
| 1158 | |
| 1159 | UPB_INLINE upb_value upb_value_float(float cval) { |
| 1160 | upb_value ret; |
| 1161 | upb_value_setfloat(&ret, cval); |
| 1162 | return ret; |
| 1163 | } |
| 1164 | |
| 1165 | UPB_INLINE upb_value upb_value_double(double cval) { |
| 1166 | upb_value ret; |
| 1167 | upb_value_setdouble(&ret, cval); |
| 1168 | return ret; |
| 1169 | } |
| 1170 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1171 | /* upb_tabkey *****************************************************************/ |
| 1172 | |
| 1173 | /* Either: |
| 1174 | * 1. an actual integer key, or |
| 1175 | * 2. a pointer to a string prefixed by its uint32_t length, owned by us. |
| 1176 | * |
| 1177 | * ...depending on whether this is a string table or an int table. We would |
| 1178 | * make this a union of those two types, but C89 doesn't support statically |
| 1179 | * initializing a non-first union member. */ |
| 1180 | typedef uintptr_t upb_tabkey; |
| 1181 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1182 | UPB_INLINE char* upb_tabstr(upb_tabkey key, uint32_t* len) { |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1183 | char* mem = (char*)key; |
| 1184 | if (len) memcpy(len, mem, sizeof(*len)); |
| 1185 | return mem + sizeof(*len); |
| 1186 | } |
| 1187 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1188 | UPB_INLINE upb_StringView upb_tabstrview(upb_tabkey key) { |
| 1189 | upb_StringView ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1190 | uint32_t len; |
| 1191 | ret.data = upb_tabstr(key, &len); |
| 1192 | ret.size = len; |
| 1193 | return ret; |
| 1194 | } |
| 1195 | |
| 1196 | /* upb_tabval *****************************************************************/ |
| 1197 | |
| 1198 | typedef struct upb_tabval { |
| 1199 | uint64_t val; |
| 1200 | } upb_tabval; |
| 1201 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1202 | #define UPB_TABVALUE_EMPTY_INIT \ |
| 1203 | { -1 } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1204 | |
| 1205 | /* upb_table ******************************************************************/ |
| 1206 | |
| 1207 | typedef struct _upb_tabent { |
| 1208 | upb_tabkey key; |
| 1209 | upb_tabval val; |
| 1210 | |
| 1211 | /* Internal chaining. This is const so we can create static initializers for |
| 1212 | * tables. We cast away const sometimes, but *only* when the containing |
| 1213 | * upb_table is known to be non-const. This requires a bit of care, but |
| 1214 | * the subtlety is confined to table.c. */ |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1215 | const struct _upb_tabent* next; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1216 | } upb_tabent; |
| 1217 | |
| 1218 | typedef struct { |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1219 | size_t count; /* Number of entries in the hash part. */ |
| 1220 | uint32_t mask; /* Mask to turn hash value -> bucket. */ |
| 1221 | uint32_t max_count; /* Max count before we hit our load limit. */ |
| 1222 | uint8_t size_lg2; /* Size of the hashtable part is 2^size_lg2 entries. */ |
| 1223 | upb_tabent* entries; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1224 | } upb_table; |
| 1225 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1226 | UPB_INLINE size_t upb_table_size(const upb_table* t) { |
| 1227 | return t->size_lg2 ? 1 << t->size_lg2 : 0; |
| 1228 | } |
| 1229 | |
| 1230 | // Internal-only functions, in .h file only out of necessity. |
Mike Kruskal | 04e8135 | 2022-11-23 11:07:53 -0800 | [diff] [blame] | 1231 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1232 | UPB_INLINE bool upb_tabent_isempty(const upb_tabent* e) { return e->key == 0; } |
| 1233 | |
Mike Kruskal | 04e8135 | 2022-11-23 11:07:53 -0800 | [diff] [blame] | 1234 | uint32_t _upb_Hash(const void* p, size_t n, uint64_t seed); |
| 1235 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1236 | #ifdef __cplusplus |
| 1237 | } /* extern "C" */ |
| 1238 | #endif |
| 1239 | |
| 1240 | |
| 1241 | #endif /* UPB_HASH_COMMON_H_ */ |
| 1242 | |
| 1243 | // Must be last. |
| 1244 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1245 | typedef struct { |
| 1246 | upb_table t; |
| 1247 | } upb_strtable; |
| 1248 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1249 | #ifdef __cplusplus |
| 1250 | extern "C" { |
| 1251 | #endif |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1252 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1253 | // Initialize a table. If memory allocation failed, false is returned and |
| 1254 | // the table is uninitialized. |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1255 | bool upb_strtable_init(upb_strtable* table, size_t expected_size, upb_Arena* a); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1256 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1257 | // Returns the number of values in the table. |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1258 | UPB_INLINE size_t upb_strtable_count(const upb_strtable* t) { |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1259 | return t->t.count; |
| 1260 | } |
| 1261 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1262 | void upb_strtable_clear(upb_strtable* t); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1263 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1264 | // Inserts the given key into the hashtable with the given value. |
| 1265 | // The key must not already exist in the hash table. The key is not required |
| 1266 | // to be NULL-terminated, and the table will make an internal copy of the key. |
| 1267 | // |
| 1268 | // If a table resize was required but memory allocation failed, false is |
| 1269 | // returned and the table is unchanged. */ |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1270 | bool upb_strtable_insert(upb_strtable* t, const char* key, size_t len, |
| 1271 | upb_value val, upb_Arena* a); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1272 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1273 | // Looks up key in this table, returning "true" if the key was found. |
| 1274 | // If v is non-NULL, copies the value for this key into *v. |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1275 | bool upb_strtable_lookup2(const upb_strtable* t, const char* key, size_t len, |
| 1276 | upb_value* v); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1277 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1278 | // For NULL-terminated strings. |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1279 | UPB_INLINE bool upb_strtable_lookup(const upb_strtable* t, const char* key, |
| 1280 | upb_value* v) { |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1281 | return upb_strtable_lookup2(t, key, strlen(key), v); |
| 1282 | } |
| 1283 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1284 | // Removes an item from the table. Returns true if the remove was successful, |
| 1285 | // and stores the removed item in *val if non-NULL. |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1286 | bool upb_strtable_remove2(upb_strtable* t, const char* key, size_t len, |
| 1287 | upb_value* val); |
| 1288 | |
| 1289 | UPB_INLINE bool upb_strtable_remove(upb_strtable* t, const char* key, |
| 1290 | upb_value* v) { |
| 1291 | return upb_strtable_remove2(t, key, strlen(key), v); |
| 1292 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1293 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1294 | // Exposed for testing only. |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1295 | bool upb_strtable_resize(upb_strtable* t, size_t size_lg2, upb_Arena* a); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1296 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1297 | /* Iteration over strtable: |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1298 | * |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1299 | * intptr_t iter = UPB_STRTABLE_BEGIN; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1300 | * upb_StringView key; |
| 1301 | * upb_value val; |
| 1302 | * while (upb_strtable_next2(t, &key, &val, &iter)) { |
| 1303 | * // ... |
| 1304 | * } |
| 1305 | */ |
| 1306 | |
| 1307 | #define UPB_STRTABLE_BEGIN -1 |
| 1308 | |
| 1309 | bool upb_strtable_next2(const upb_strtable* t, upb_StringView* key, |
| 1310 | upb_value* val, intptr_t* iter); |
| 1311 | void upb_strtable_removeiter(upb_strtable* t, intptr_t* iter); |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 1312 | void upb_strtable_setentryvalue(upb_strtable* t, intptr_t iter, upb_value v); |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1313 | |
| 1314 | /* DEPRECATED iterators, slated for removal. |
| 1315 | * |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1316 | * Iterators for string tables. We are subject to some kind of unusual |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1317 | * design constraints: |
| 1318 | * |
| 1319 | * For high-level languages: |
| 1320 | * - we must be able to guarantee that we don't crash or corrupt memory even if |
| 1321 | * the program accesses an invalidated iterator. |
| 1322 | * |
| 1323 | * For C++11 range-based for: |
| 1324 | * - iterators must be copyable |
| 1325 | * - iterators must be comparable |
| 1326 | * - it must be possible to construct an "end" value. |
| 1327 | * |
| 1328 | * Iteration order is undefined. |
| 1329 | * |
| 1330 | * Modifying the table invalidates iterators. upb_{str,int}table_done() is |
| 1331 | * guaranteed to work even on an invalidated iterator, as long as the table it |
| 1332 | * is iterating over has not been freed. Calling next() or accessing data from |
| 1333 | * an invalidated iterator yields unspecified elements from the table, but it is |
| 1334 | * guaranteed not to crash and to return real table elements (except when done() |
| 1335 | * is true). */ |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1336 | /* upb_strtable_iter **********************************************************/ |
| 1337 | |
| 1338 | /* upb_strtable_iter i; |
| 1339 | * upb_strtable_begin(&i, t); |
| 1340 | * for(; !upb_strtable_done(&i); upb_strtable_next(&i)) { |
| 1341 | * const char *key = upb_strtable_iter_key(&i); |
| 1342 | * const upb_value val = upb_strtable_iter_value(&i); |
| 1343 | * // ... |
| 1344 | * } |
| 1345 | */ |
| 1346 | |
| 1347 | typedef struct { |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1348 | const upb_strtable* t; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1349 | size_t index; |
| 1350 | } upb_strtable_iter; |
| 1351 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1352 | UPB_INLINE const upb_tabent* str_tabent(const upb_strtable_iter* i) { |
| 1353 | return &i->t->t.entries[i->index]; |
| 1354 | } |
| 1355 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1356 | void upb_strtable_begin(upb_strtable_iter* i, const upb_strtable* t); |
| 1357 | void upb_strtable_next(upb_strtable_iter* i); |
| 1358 | bool upb_strtable_done(const upb_strtable_iter* i); |
| 1359 | upb_StringView upb_strtable_iter_key(const upb_strtable_iter* i); |
| 1360 | upb_value upb_strtable_iter_value(const upb_strtable_iter* i); |
| 1361 | void upb_strtable_iter_setdone(upb_strtable_iter* i); |
| 1362 | bool upb_strtable_iter_isequal(const upb_strtable_iter* i1, |
| 1363 | const upb_strtable_iter* i2); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1364 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1365 | #ifdef __cplusplus |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1366 | } /* extern "C" */ |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1367 | #endif |
| 1368 | |
| 1369 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1370 | #endif /* UPB_HASH_STR_TABLE_H_ */ |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1371 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1372 | // Must be last. |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1373 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1374 | struct upb_Map { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1375 | // Size of key and val, based on the map type. |
| 1376 | // Strings are represented as '0' because they must be handled specially. |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1377 | char key_size; |
| 1378 | char val_size; |
| 1379 | |
| 1380 | upb_strtable table; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1381 | }; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1382 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1383 | #ifdef __cplusplus |
| 1384 | extern "C" { |
| 1385 | #endif |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1386 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1387 | // Converting between internal table representation and user values. |
| 1388 | // |
| 1389 | // _upb_map_tokey() and _upb_map_fromkey() are inverses. |
| 1390 | // _upb_map_tovalue() and _upb_map_fromvalue() are inverses. |
| 1391 | // |
| 1392 | // These functions account for the fact that strings are treated differently |
| 1393 | // from other types when stored in a map. |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1394 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1395 | UPB_INLINE upb_StringView _upb_map_tokey(const void* key, size_t size) { |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1396 | if (size == UPB_MAPTYPE_STRING) { |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1397 | return *(upb_StringView*)key; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1398 | } else { |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1399 | return upb_StringView_FromDataAndSize((const char*)key, size); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1400 | } |
| 1401 | } |
| 1402 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1403 | UPB_INLINE void _upb_map_fromkey(upb_StringView key, void* out, size_t size) { |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1404 | if (size == UPB_MAPTYPE_STRING) { |
| 1405 | memcpy(out, &key, sizeof(key)); |
| 1406 | } else { |
| 1407 | memcpy(out, key.data, size); |
| 1408 | } |
| 1409 | } |
| 1410 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1411 | UPB_INLINE bool _upb_map_tovalue(const void* val, size_t size, |
| 1412 | upb_value* msgval, upb_Arena* a) { |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1413 | if (size == UPB_MAPTYPE_STRING) { |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1414 | upb_StringView* strp = (upb_StringView*)upb_Arena_Malloc(a, sizeof(*strp)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1415 | if (!strp) return false; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1416 | *strp = *(upb_StringView*)val; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1417 | *msgval = upb_value_ptr(strp); |
| 1418 | } else { |
| 1419 | memcpy(msgval, val, size); |
| 1420 | } |
| 1421 | return true; |
| 1422 | } |
| 1423 | |
| 1424 | UPB_INLINE void _upb_map_fromvalue(upb_value val, void* out, size_t size) { |
| 1425 | if (size == UPB_MAPTYPE_STRING) { |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1426 | const upb_StringView* strp = (const upb_StringView*)upb_value_getptr(val); |
| 1427 | memcpy(out, strp, sizeof(upb_StringView)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1428 | } else { |
| 1429 | memcpy(out, &val, size); |
| 1430 | } |
| 1431 | } |
| 1432 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1433 | UPB_INLINE void* _upb_map_next(const upb_Map* map, size_t* iter) { |
| 1434 | upb_strtable_iter it; |
| 1435 | it.t = &map->table; |
| 1436 | it.index = *iter; |
| 1437 | upb_strtable_next(&it); |
| 1438 | *iter = it.index; |
| 1439 | if (upb_strtable_done(&it)) return NULL; |
| 1440 | return (void*)str_tabent(&it); |
| 1441 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1442 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1443 | UPB_INLINE void _upb_Map_Clear(upb_Map* map) { |
| 1444 | upb_strtable_clear(&map->table); |
| 1445 | } |
| 1446 | |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 1447 | UPB_INLINE bool _upb_Map_Delete(upb_Map* map, const void* key, size_t key_size, |
| 1448 | upb_value* val) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1449 | upb_StringView k = _upb_map_tokey(key, key_size); |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 1450 | return upb_strtable_remove2(&map->table, k.data, k.size, val); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1451 | } |
| 1452 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1453 | UPB_INLINE bool _upb_Map_Get(const upb_Map* map, const void* key, |
| 1454 | size_t key_size, void* val, size_t val_size) { |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1455 | upb_value tabval; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1456 | upb_StringView k = _upb_map_tokey(key, key_size); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1457 | bool ret = upb_strtable_lookup2(&map->table, k.data, k.size, &tabval); |
| 1458 | if (ret && val) { |
| 1459 | _upb_map_fromvalue(tabval, val, val_size); |
| 1460 | } |
| 1461 | return ret; |
| 1462 | } |
| 1463 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1464 | UPB_INLINE upb_MapInsertStatus _upb_Map_Insert(upb_Map* map, const void* key, |
| 1465 | size_t key_size, void* val, |
| 1466 | size_t val_size, upb_Arena* a) { |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1467 | upb_StringView strkey = _upb_map_tokey(key, key_size); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1468 | upb_value tabval = {0}; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1469 | if (!_upb_map_tovalue(val, val_size, &tabval, a)) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1470 | return kUpb_MapInsertStatus_OutOfMemory; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1471 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1472 | |
Protobuf Team Bot | 986cbb6 | 2023-09-19 15:03:51 +0000 | [diff] [blame^] | 1473 | // TODO: add overwrite operation to minimize number of lookups. |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1474 | bool removed = |
| 1475 | upb_strtable_remove2(&map->table, strkey.data, strkey.size, NULL); |
| 1476 | if (!upb_strtable_insert(&map->table, strkey.data, strkey.size, tabval, a)) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1477 | return kUpb_MapInsertStatus_OutOfMemory; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1478 | } |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1479 | return removed ? kUpb_MapInsertStatus_Replaced |
| 1480 | : kUpb_MapInsertStatus_Inserted; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1481 | } |
| 1482 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1483 | UPB_INLINE size_t _upb_Map_Size(const upb_Map* map) { |
| 1484 | return map->table.t.count; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1485 | } |
| 1486 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 1487 | // Strings/bytes are special-cased in maps. |
| 1488 | extern char _upb_Map_CTypeSizeTable[12]; |
| 1489 | |
| 1490 | UPB_INLINE size_t _upb_Map_CTypeSize(upb_CType ctype) { |
| 1491 | return _upb_Map_CTypeSizeTable[ctype]; |
| 1492 | } |
| 1493 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1494 | // Creates a new map on the given arena with this key/value type. |
| 1495 | upb_Map* _upb_Map_New(upb_Arena* a, size_t key_size, size_t value_size); |
| 1496 | |
| 1497 | #ifdef __cplusplus |
| 1498 | } /* extern "C" */ |
| 1499 | #endif |
| 1500 | |
| 1501 | |
Adam Cozzette | 8059da2 | 2023-08-16 07:57:14 -0700 | [diff] [blame] | 1502 | #endif /* UPB_COLLECTIONS_INTERNAL_MAP_H_ */ |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 1503 | |
| 1504 | // EVERYTHING BELOW THIS LINE IS INTERNAL - DO NOT USE ///////////////////////// |
| 1505 | |
Adam Cozzette | 8059da2 | 2023-08-16 07:57:14 -0700 | [diff] [blame] | 1506 | #ifndef UPB_COLLECTIONS_INTERNAL_MAP_SORTER_H_ |
| 1507 | #define UPB_COLLECTIONS_INTERNAL_MAP_SORTER_H_ |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 1508 | |
| 1509 | #include <stdlib.h> |
| 1510 | |
| 1511 | |
Protobuf Team Bot | dcc1f61 | 2023-09-05 21:56:25 +0000 | [diff] [blame] | 1512 | #ifndef UPB_COLLECTIONS_INTERNAL_MAP_ENTRY_H_ |
| 1513 | #define UPB_COLLECTIONS_INTERNAL_MAP_ENTRY_H_ |
| 1514 | |
| 1515 | |
| 1516 | #ifndef UPB_MINI_TABLE_INTERNAL_TYPES_H_ |
| 1517 | #define UPB_MINI_TABLE_INTERNAL_TYPES_H_ |
| 1518 | |
| 1519 | typedef struct upb_Message_InternalData upb_Message_InternalData; |
| 1520 | |
| 1521 | typedef struct { |
| 1522 | union { |
| 1523 | upb_Message_InternalData* internal; |
| 1524 | |
| 1525 | // Force 8-byte alignment, since the data members may contain members that |
| 1526 | // require 8-byte alignment. |
| 1527 | double d; |
| 1528 | }; |
| 1529 | } upb_Message_Internal; |
| 1530 | |
| 1531 | #endif // UPB_MINI_TABLE_INTERNAL_TYPES_H_ |
| 1532 | |
| 1533 | // Map entries aren't actually stored for map fields, they are only used during |
| 1534 | // parsing. For parsing, it helps a lot if all map entry messages have the same |
| 1535 | // layout. The layout code in mini_table/decode.c will ensure that all map |
| 1536 | // entries have this layout. |
| 1537 | // |
| 1538 | // Note that users can and do create map entries directly, which will also use |
| 1539 | // this layout. |
| 1540 | // |
| 1541 | // NOTE: sync with wire/decode.c. |
| 1542 | typedef struct { |
| 1543 | // We only need 2 hasbits max, but due to alignment we'll use 8 bytes here, |
| 1544 | // and the uint64_t helps make this clear. |
| 1545 | uint64_t hasbits; |
| 1546 | union { |
| 1547 | upb_StringView str; // For str/bytes. |
| 1548 | upb_value val; // For all other types. |
| 1549 | } k; |
| 1550 | union { |
| 1551 | upb_StringView str; // For str/bytes. |
| 1552 | upb_value val; // For all other types. |
| 1553 | } v; |
| 1554 | } upb_MapEntryData; |
| 1555 | |
| 1556 | typedef struct { |
| 1557 | upb_Message_Internal internal; |
| 1558 | upb_MapEntryData data; |
| 1559 | } upb_MapEntry; |
| 1560 | |
| 1561 | #endif // UPB_COLLECTIONS_INTERNAL_MAP_ENTRY_H_ |
| 1562 | |
Adam Cozzette | 8059da2 | 2023-08-16 07:57:14 -0700 | [diff] [blame] | 1563 | #ifndef UPB_MESSAGE_INTERNAL_EXTENSION_H_ |
| 1564 | #define UPB_MESSAGE_INTERNAL_EXTENSION_H_ |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 1565 | |
| 1566 | |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 1567 | // Public APIs for message operations that do not depend on the schema. |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1568 | // |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 1569 | // MiniTable-based accessors live in accessors.h. |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1570 | |
| 1571 | #ifndef UPB_MESSAGE_MESSAGE_H_ |
| 1572 | #define UPB_MESSAGE_MESSAGE_H_ |
| 1573 | |
Protobuf Team Bot | 75af7f9 | 2023-09-06 18:07:53 +0000 | [diff] [blame] | 1574 | #include <stddef.h> |
| 1575 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1576 | |
Protobuf Team Bot | 473d20d | 2023-09-15 22:27:16 +0000 | [diff] [blame] | 1577 | #ifndef UPB_MINI_TABLE_MESSAGE_H_ |
| 1578 | #define UPB_MINI_TABLE_MESSAGE_H_ |
| 1579 | |
| 1580 | |
| 1581 | #ifndef UPB_MINI_TABLE_ENUM_H_ |
| 1582 | #define UPB_MINI_TABLE_ENUM_H_ |
| 1583 | |
| 1584 | |
| 1585 | #ifndef UPB_MINI_TABLE_INTERNAL_ENUM_H_ |
| 1586 | #define UPB_MINI_TABLE_INTERNAL_ENUM_H_ |
| 1587 | |
| 1588 | #include <stdint.h> |
| 1589 | |
| 1590 | // Must be last. |
| 1591 | |
| 1592 | struct upb_MiniTableEnum { |
| 1593 | uint32_t mask_limit; // Limit enum value that can be tested with mask. |
| 1594 | uint32_t value_count; // Number of values after the bitfield. |
| 1595 | uint32_t data[]; // Bitmask + enumerated values follow. |
| 1596 | }; |
| 1597 | |
| 1598 | typedef enum { |
| 1599 | _kUpb_FastEnumCheck_ValueIsInEnum = 0, |
| 1600 | _kUpb_FastEnumCheck_ValueIsNotInEnum = 1, |
| 1601 | _kUpb_FastEnumCheck_CannotCheckFast = 2, |
| 1602 | } _kUpb_FastEnumCheck_Status; |
| 1603 | |
| 1604 | #ifdef __cplusplus |
| 1605 | extern "C" { |
| 1606 | #endif |
| 1607 | |
| 1608 | UPB_INLINE _kUpb_FastEnumCheck_Status _upb_MiniTable_CheckEnumValueFast( |
| 1609 | const struct upb_MiniTableEnum* e, uint32_t val) { |
| 1610 | if (UPB_UNLIKELY(val >= 64)) return _kUpb_FastEnumCheck_CannotCheckFast; |
| 1611 | uint64_t mask = e->data[0] | ((uint64_t)e->data[1] << 32); |
| 1612 | return (mask & (1ULL << val)) ? _kUpb_FastEnumCheck_ValueIsInEnum |
| 1613 | : _kUpb_FastEnumCheck_ValueIsNotInEnum; |
| 1614 | } |
| 1615 | |
| 1616 | UPB_INLINE bool _upb_MiniTable_CheckEnumValueSlow( |
| 1617 | const struct upb_MiniTableEnum* e, uint32_t val) { |
| 1618 | if (val < e->mask_limit) return e->data[val / 32] & (1ULL << (val % 32)); |
| 1619 | // OPT: binary search long lists? |
| 1620 | const uint32_t* start = &e->data[e->mask_limit / 32]; |
| 1621 | const uint32_t* limit = &e->data[(e->mask_limit / 32) + e->value_count]; |
| 1622 | for (const uint32_t* p = start; p < limit; p++) { |
| 1623 | if (*p == val) return true; |
| 1624 | } |
| 1625 | return false; |
| 1626 | } |
| 1627 | |
| 1628 | #ifdef __cplusplus |
| 1629 | } /* extern "C" */ |
| 1630 | #endif |
| 1631 | |
| 1632 | |
| 1633 | #endif /* UPB_MINI_TABLE_INTERNAL_ENUM_H_ */ |
| 1634 | |
| 1635 | // Must be last |
| 1636 | |
| 1637 | typedef struct upb_MiniTableEnum upb_MiniTableEnum; |
| 1638 | |
| 1639 | // Validates enum value against range defined by enum mini table. |
| 1640 | UPB_INLINE bool upb_MiniTableEnum_CheckValue(const struct upb_MiniTableEnum* e, |
| 1641 | uint32_t val) { |
| 1642 | _kUpb_FastEnumCheck_Status status = _upb_MiniTable_CheckEnumValueFast(e, val); |
| 1643 | if (UPB_UNLIKELY(status == _kUpb_FastEnumCheck_CannotCheckFast)) { |
| 1644 | return _upb_MiniTable_CheckEnumValueSlow(e, val); |
| 1645 | } |
| 1646 | return status == _kUpb_FastEnumCheck_ValueIsInEnum ? true : false; |
| 1647 | } |
| 1648 | |
| 1649 | |
| 1650 | #endif /* UPB_MINI_TABLE_ENUM_H_ */ |
| 1651 | |
| 1652 | #ifndef UPB_MINI_TABLE_FIELD_H_ |
| 1653 | #define UPB_MINI_TABLE_FIELD_H_ |
| 1654 | |
| 1655 | |
| 1656 | #ifndef UPB_MINI_TABLE_INTERNAL_FIELD_H_ |
| 1657 | #define UPB_MINI_TABLE_INTERNAL_FIELD_H_ |
| 1658 | |
| 1659 | #include <stdint.h> |
| 1660 | |
| 1661 | |
| 1662 | // Must be last. |
| 1663 | |
| 1664 | struct upb_MiniTableField { |
| 1665 | uint32_t number; |
| 1666 | uint16_t offset; |
| 1667 | int16_t presence; // If >0, hasbit_index. If <0, ~oneof_index |
| 1668 | |
| 1669 | // Indexes into `upb_MiniTable.subs` |
| 1670 | // Will be set to `kUpb_NoSub` if `descriptortype` != MESSAGE/GROUP/ENUM |
| 1671 | uint16_t UPB_PRIVATE(submsg_index); |
| 1672 | |
| 1673 | uint8_t UPB_PRIVATE(descriptortype); |
| 1674 | |
| 1675 | // upb_FieldMode | upb_LabelFlags | (upb_FieldRep << kUpb_FieldRep_Shift) |
| 1676 | uint8_t mode; |
| 1677 | }; |
| 1678 | |
| 1679 | #define kUpb_NoSub ((uint16_t)-1) |
| 1680 | |
| 1681 | typedef enum { |
| 1682 | kUpb_FieldMode_Map = 0, |
| 1683 | kUpb_FieldMode_Array = 1, |
| 1684 | kUpb_FieldMode_Scalar = 2, |
| 1685 | } upb_FieldMode; |
| 1686 | |
| 1687 | // Mask to isolate the upb_FieldMode from field.mode. |
| 1688 | #define kUpb_FieldMode_Mask 3 |
| 1689 | |
| 1690 | // Extra flags on the mode field. |
| 1691 | typedef enum { |
| 1692 | kUpb_LabelFlags_IsPacked = 4, |
| 1693 | kUpb_LabelFlags_IsExtension = 8, |
| 1694 | // Indicates that this descriptor type is an "alternate type": |
| 1695 | // - for Int32, this indicates that the actual type is Enum (but was |
| 1696 | // rewritten to Int32 because it is an open enum that requires no check). |
| 1697 | // - for Bytes, this indicates that the actual type is String (but does |
| 1698 | // not require any UTF-8 check). |
| 1699 | kUpb_LabelFlags_IsAlternate = 16, |
| 1700 | } upb_LabelFlags; |
| 1701 | |
| 1702 | // Note: we sort by this number when calculating layout order. |
| 1703 | typedef enum { |
| 1704 | kUpb_FieldRep_1Byte = 0, |
| 1705 | kUpb_FieldRep_4Byte = 1, |
| 1706 | kUpb_FieldRep_StringView = 2, |
| 1707 | kUpb_FieldRep_8Byte = 3, |
| 1708 | |
| 1709 | kUpb_FieldRep_NativePointer = |
| 1710 | UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte), |
| 1711 | kUpb_FieldRep_Max = kUpb_FieldRep_8Byte, |
| 1712 | } upb_FieldRep; |
| 1713 | |
| 1714 | #define kUpb_FieldRep_Shift 6 |
| 1715 | |
| 1716 | UPB_INLINE upb_FieldRep |
| 1717 | _upb_MiniTableField_GetRep(const struct upb_MiniTableField* field) { |
| 1718 | return (upb_FieldRep)(field->mode >> kUpb_FieldRep_Shift); |
| 1719 | } |
| 1720 | |
| 1721 | #ifdef __cplusplus |
| 1722 | extern "C" { |
| 1723 | #endif |
| 1724 | |
| 1725 | UPB_INLINE upb_FieldMode |
| 1726 | upb_FieldMode_Get(const struct upb_MiniTableField* field) { |
| 1727 | return (upb_FieldMode)(field->mode & 3); |
| 1728 | } |
| 1729 | |
| 1730 | UPB_INLINE void _upb_MiniTableField_CheckIsArray( |
| 1731 | const struct upb_MiniTableField* field) { |
| 1732 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_NativePointer); |
| 1733 | UPB_ASSUME(upb_FieldMode_Get(field) == kUpb_FieldMode_Array); |
| 1734 | UPB_ASSUME(field->presence == 0); |
| 1735 | } |
| 1736 | |
| 1737 | UPB_INLINE void _upb_MiniTableField_CheckIsMap( |
| 1738 | const struct upb_MiniTableField* field) { |
| 1739 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_NativePointer); |
| 1740 | UPB_ASSUME(upb_FieldMode_Get(field) == kUpb_FieldMode_Map); |
| 1741 | UPB_ASSUME(field->presence == 0); |
| 1742 | } |
| 1743 | |
| 1744 | UPB_INLINE bool upb_IsRepeatedOrMap(const struct upb_MiniTableField* field) { |
| 1745 | // This works because upb_FieldMode has no value 3. |
| 1746 | return !(field->mode & kUpb_FieldMode_Scalar); |
| 1747 | } |
| 1748 | |
| 1749 | UPB_INLINE bool upb_IsSubMessage(const struct upb_MiniTableField* field) { |
| 1750 | return field->UPB_PRIVATE(descriptortype) == kUpb_FieldType_Message || |
| 1751 | field->UPB_PRIVATE(descriptortype) == kUpb_FieldType_Group; |
| 1752 | } |
| 1753 | |
| 1754 | #ifdef __cplusplus |
| 1755 | } /* extern "C" */ |
| 1756 | #endif |
| 1757 | |
| 1758 | |
| 1759 | #endif /* UPB_MINI_TABLE_INTERNAL_FIELD_H_ */ |
| 1760 | |
| 1761 | #ifndef UPB_MINI_TABLE_INTERNAL_MESSAGE_H_ |
| 1762 | #define UPB_MINI_TABLE_INTERNAL_MESSAGE_H_ |
| 1763 | |
| 1764 | |
| 1765 | // Must be last. |
| 1766 | |
| 1767 | struct upb_Decoder; |
| 1768 | typedef const char* _upb_FieldParser(struct upb_Decoder* d, const char* ptr, |
| 1769 | upb_Message* msg, intptr_t table, |
| 1770 | uint64_t hasbits, uint64_t data); |
| 1771 | typedef struct { |
| 1772 | uint64_t field_data; |
| 1773 | _upb_FieldParser* field_parser; |
| 1774 | } _upb_FastTable_Entry; |
| 1775 | |
| 1776 | typedef enum { |
| 1777 | kUpb_ExtMode_NonExtendable = 0, // Non-extendable message. |
| 1778 | kUpb_ExtMode_Extendable = 1, // Normal extendable message. |
| 1779 | kUpb_ExtMode_IsMessageSet = 2, // MessageSet message. |
| 1780 | kUpb_ExtMode_IsMessageSet_ITEM = |
| 1781 | 3, // MessageSet item (temporary only, see decode.c) |
| 1782 | |
| 1783 | // During table building we steal a bit to indicate that the message is a map |
| 1784 | // entry. *Only* used during table building! |
| 1785 | kUpb_ExtMode_IsMapEntry = 4, |
| 1786 | } upb_ExtMode; |
| 1787 | |
| 1788 | union upb_MiniTableSub; |
| 1789 | |
| 1790 | // upb_MiniTable represents the memory layout of a given upb_MessageDef. |
| 1791 | // The members are public so generated code can initialize them, |
| 1792 | // but users MUST NOT directly read or write any of its members. |
| 1793 | struct upb_MiniTable { |
| 1794 | const union upb_MiniTableSub* subs; |
| 1795 | const struct upb_MiniTableField* fields; |
| 1796 | |
| 1797 | // Must be aligned to sizeof(void*). Doesn't include internal members like |
| 1798 | // unknown fields, extension dict, pointer to msglayout, etc. |
| 1799 | uint16_t size; |
| 1800 | |
| 1801 | uint16_t field_count; |
| 1802 | uint8_t ext; // upb_ExtMode, declared as uint8_t so sizeof(ext) == 1 |
| 1803 | uint8_t dense_below; |
| 1804 | uint8_t table_mask; |
| 1805 | uint8_t required_count; // Required fields have the lowest hasbits. |
| 1806 | |
| 1807 | // To statically initialize the tables of variable length, we need a flexible |
| 1808 | // array member, and we need to compile in gnu99 mode (constant initialization |
| 1809 | // of flexible array members is a GNU extension, not in C99 unfortunately. |
| 1810 | _upb_FastTable_Entry fasttable[]; |
| 1811 | }; |
| 1812 | |
| 1813 | #ifdef __cplusplus |
| 1814 | extern "C" { |
| 1815 | #endif |
| 1816 | |
| 1817 | // A MiniTable for an empty message, used for unlinked sub-messages. |
| 1818 | extern const struct upb_MiniTable _kUpb_MiniTable_Empty; |
| 1819 | |
| 1820 | // Computes a bitmask in which the |l->required_count| lowest bits are set, |
| 1821 | // except that we skip the lowest bit (because upb never uses hasbit 0). |
| 1822 | // |
| 1823 | // Sample output: |
| 1824 | // requiredmask(1) => 0b10 (0x2) |
| 1825 | // requiredmask(5) => 0b111110 (0x3e) |
| 1826 | UPB_INLINE uint64_t upb_MiniTable_requiredmask(const struct upb_MiniTable* l) { |
| 1827 | int n = l->required_count; |
| 1828 | assert(0 < n && n <= 63); |
| 1829 | return ((1ULL << n) - 1) << 1; |
| 1830 | } |
| 1831 | |
| 1832 | #ifdef __cplusplus |
| 1833 | } /* extern "C" */ |
| 1834 | #endif |
| 1835 | |
| 1836 | |
| 1837 | #endif /* UPB_MINI_TABLE_INTERNAL_MESSAGE_H_ */ |
| 1838 | |
| 1839 | #ifndef UPB_MINI_TABLE_INTERNAL_SUB_H_ |
| 1840 | #define UPB_MINI_TABLE_INTERNAL_SUB_H_ |
| 1841 | |
| 1842 | |
| 1843 | union upb_MiniTableSub { |
| 1844 | const struct upb_MiniTable* submsg; |
| 1845 | const struct upb_MiniTableEnum* subenum; |
| 1846 | }; |
| 1847 | |
| 1848 | #endif /* UPB_MINI_TABLE_INTERNAL_SUB_H_ */ |
| 1849 | |
| 1850 | // Must be last. |
| 1851 | |
| 1852 | #ifdef __cplusplus |
| 1853 | extern "C" { |
| 1854 | #endif |
| 1855 | |
| 1856 | typedef struct upb_MiniTableField upb_MiniTableField; |
| 1857 | |
| 1858 | UPB_API_INLINE upb_FieldType |
| 1859 | upb_MiniTableField_Type(const upb_MiniTableField* field) { |
| 1860 | if (field->mode & kUpb_LabelFlags_IsAlternate) { |
| 1861 | if (field->UPB_PRIVATE(descriptortype) == kUpb_FieldType_Int32) { |
| 1862 | return kUpb_FieldType_Enum; |
| 1863 | } else if (field->UPB_PRIVATE(descriptortype) == kUpb_FieldType_Bytes) { |
| 1864 | return kUpb_FieldType_String; |
| 1865 | } else { |
| 1866 | UPB_ASSERT(false); |
| 1867 | } |
| 1868 | } |
| 1869 | return (upb_FieldType)field->UPB_PRIVATE(descriptortype); |
| 1870 | } |
| 1871 | |
| 1872 | UPB_API_INLINE upb_CType upb_MiniTableField_CType(const upb_MiniTableField* f) { |
| 1873 | switch (upb_MiniTableField_Type(f)) { |
| 1874 | case kUpb_FieldType_Double: |
| 1875 | return kUpb_CType_Double; |
| 1876 | case kUpb_FieldType_Float: |
| 1877 | return kUpb_CType_Float; |
| 1878 | case kUpb_FieldType_Int64: |
| 1879 | case kUpb_FieldType_SInt64: |
| 1880 | case kUpb_FieldType_SFixed64: |
| 1881 | return kUpb_CType_Int64; |
| 1882 | case kUpb_FieldType_Int32: |
| 1883 | case kUpb_FieldType_SFixed32: |
| 1884 | case kUpb_FieldType_SInt32: |
| 1885 | return kUpb_CType_Int32; |
| 1886 | case kUpb_FieldType_UInt64: |
| 1887 | case kUpb_FieldType_Fixed64: |
| 1888 | return kUpb_CType_UInt64; |
| 1889 | case kUpb_FieldType_UInt32: |
| 1890 | case kUpb_FieldType_Fixed32: |
| 1891 | return kUpb_CType_UInt32; |
| 1892 | case kUpb_FieldType_Enum: |
| 1893 | return kUpb_CType_Enum; |
| 1894 | case kUpb_FieldType_Bool: |
| 1895 | return kUpb_CType_Bool; |
| 1896 | case kUpb_FieldType_String: |
| 1897 | return kUpb_CType_String; |
| 1898 | case kUpb_FieldType_Bytes: |
| 1899 | return kUpb_CType_Bytes; |
| 1900 | case kUpb_FieldType_Group: |
| 1901 | case kUpb_FieldType_Message: |
| 1902 | return kUpb_CType_Message; |
| 1903 | } |
| 1904 | UPB_UNREACHABLE(); |
| 1905 | } |
| 1906 | |
| 1907 | UPB_API_INLINE bool upb_MiniTableField_IsExtension( |
| 1908 | const upb_MiniTableField* field) { |
| 1909 | return field->mode & kUpb_LabelFlags_IsExtension; |
| 1910 | } |
| 1911 | |
| 1912 | UPB_API_INLINE bool upb_MiniTableField_IsClosedEnum( |
| 1913 | const upb_MiniTableField* field) { |
| 1914 | return field->UPB_PRIVATE(descriptortype) == kUpb_FieldType_Enum; |
| 1915 | } |
| 1916 | |
| 1917 | UPB_API_INLINE bool upb_MiniTableField_HasPresence( |
| 1918 | const upb_MiniTableField* field) { |
| 1919 | if (upb_MiniTableField_IsExtension(field)) { |
| 1920 | return !upb_IsRepeatedOrMap(field); |
| 1921 | } else { |
| 1922 | return field->presence != 0; |
| 1923 | } |
| 1924 | } |
| 1925 | |
| 1926 | #ifdef __cplusplus |
| 1927 | } /* extern "C" */ |
| 1928 | #endif |
| 1929 | |
| 1930 | |
| 1931 | #endif /* UPB_MINI_TABLE_FIELD_H_ */ |
| 1932 | |
| 1933 | // Must be last. |
| 1934 | |
| 1935 | #ifdef __cplusplus |
| 1936 | extern "C" { |
| 1937 | #endif |
| 1938 | |
| 1939 | typedef struct upb_MiniTable upb_MiniTable; |
| 1940 | |
| 1941 | UPB_API const upb_MiniTableField* upb_MiniTable_FindFieldByNumber( |
| 1942 | const upb_MiniTable* table, uint32_t number); |
| 1943 | |
| 1944 | UPB_API_INLINE const upb_MiniTableField* upb_MiniTable_GetFieldByIndex( |
| 1945 | const upb_MiniTable* t, uint32_t index) { |
| 1946 | return &t->fields[index]; |
| 1947 | } |
| 1948 | |
| 1949 | // Returns the MiniTable for this message field. If the field is unlinked, |
| 1950 | // returns NULL. |
| 1951 | UPB_API_INLINE const upb_MiniTable* upb_MiniTable_GetSubMessageTable( |
| 1952 | const upb_MiniTable* mini_table, const upb_MiniTableField* field) { |
| 1953 | UPB_ASSERT(upb_MiniTableField_CType(field) == kUpb_CType_Message); |
| 1954 | const upb_MiniTable* ret = |
| 1955 | mini_table->subs[field->UPB_PRIVATE(submsg_index)].submsg; |
| 1956 | UPB_ASSUME(ret); |
| 1957 | return ret == &_kUpb_MiniTable_Empty ? NULL : ret; |
| 1958 | } |
| 1959 | |
| 1960 | // Returns the MiniTableEnum for this enum field. If the field is unlinked, |
| 1961 | // returns NULL. |
| 1962 | UPB_API_INLINE const upb_MiniTableEnum* upb_MiniTable_GetSubEnumTable( |
| 1963 | const upb_MiniTable* mini_table, const upb_MiniTableField* field) { |
| 1964 | UPB_ASSERT(upb_MiniTableField_CType(field) == kUpb_CType_Enum); |
| 1965 | return mini_table->subs[field->UPB_PRIVATE(submsg_index)].subenum; |
| 1966 | } |
| 1967 | |
| 1968 | // Returns true if this MiniTable field is linked to a MiniTable for the |
| 1969 | // sub-message. |
| 1970 | UPB_API_INLINE bool upb_MiniTable_MessageFieldIsLinked( |
| 1971 | const upb_MiniTable* mini_table, const upb_MiniTableField* field) { |
| 1972 | return upb_MiniTable_GetSubMessageTable(mini_table, field) != NULL; |
| 1973 | } |
| 1974 | |
| 1975 | // If this field is in a oneof, returns the first field in the oneof. |
| 1976 | // |
| 1977 | // Otherwise returns NULL. |
| 1978 | // |
| 1979 | // Usage: |
| 1980 | // const upb_MiniTableField* field = upb_MiniTable_GetOneof(m, f); |
| 1981 | // do { |
| 1982 | // .. |
| 1983 | // } while (upb_MiniTable_NextOneofField(m, &field); |
| 1984 | // |
| 1985 | const upb_MiniTableField* upb_MiniTable_GetOneof(const upb_MiniTable* m, |
| 1986 | const upb_MiniTableField* f); |
| 1987 | |
| 1988 | // Iterates to the next field in the oneof. If this is the last field in the |
| 1989 | // oneof, returns false. The ordering of fields in the oneof is not |
| 1990 | // guaranteed. |
| 1991 | // REQUIRES: |f| is the field initialized by upb_MiniTable_GetOneof and updated |
| 1992 | // by prior upb_MiniTable_NextOneofField calls. |
| 1993 | bool upb_MiniTable_NextOneofField(const upb_MiniTable* m, |
| 1994 | const upb_MiniTableField** f); |
| 1995 | |
| 1996 | #ifdef __cplusplus |
| 1997 | } /* extern "C" */ |
| 1998 | #endif |
| 1999 | |
| 2000 | |
| 2001 | #endif /* UPB_MINI_TABLE_MESSAGE_H_ */ |
| 2002 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2003 | // Must be last. |
| 2004 | |
| 2005 | #ifdef __cplusplus |
| 2006 | extern "C" { |
| 2007 | #endif |
| 2008 | |
| 2009 | // Creates a new message with the given mini_table on the given arena. |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2010 | UPB_API upb_Message* upb_Message_New(const upb_MiniTable* mini_table, |
| 2011 | upb_Arena* arena); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2012 | |
| 2013 | // Adds unknown data (serialized protobuf data) to the given message. |
| 2014 | // The data is copied into the message instance. |
| 2015 | void upb_Message_AddUnknown(upb_Message* msg, const char* data, size_t len, |
| 2016 | upb_Arena* arena); |
| 2017 | |
| 2018 | // Returns a reference to the message's unknown data. |
| 2019 | const char* upb_Message_GetUnknown(const upb_Message* msg, size_t* len); |
| 2020 | |
| 2021 | // Removes partial unknown data from message. |
| 2022 | void upb_Message_DeleteUnknown(upb_Message* msg, const char* data, size_t len); |
| 2023 | |
| 2024 | // Returns the number of extensions present in this message. |
| 2025 | size_t upb_Message_ExtensionCount(const upb_Message* msg); |
| 2026 | |
| 2027 | #ifdef __cplusplus |
| 2028 | } /* extern "C" */ |
| 2029 | #endif |
| 2030 | |
| 2031 | |
| 2032 | #endif /* UPB_MESSAGE_MESSAGE_H_ */ |
| 2033 | |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 2034 | #ifndef UPB_MINI_TABLE_EXTENSION_H_ |
| 2035 | #define UPB_MINI_TABLE_EXTENSION_H_ |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2036 | |
| 2037 | |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 2038 | #ifndef UPB_MINI_TABLE_INTERNAL_EXTENSION_H_ |
| 2039 | #define UPB_MINI_TABLE_INTERNAL_EXTENSION_H_ |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2040 | |
| 2041 | |
| 2042 | // Must be last. |
| 2043 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2044 | struct upb_MiniTableExtension { |
Deanna Garcia | 59cfc2f | 2023-01-31 13:19:28 -0800 | [diff] [blame] | 2045 | // Do not move this field. We need to be able to alias pointers. |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 2046 | struct upb_MiniTableField field; |
Deanna Garcia | 59cfc2f | 2023-01-31 13:19:28 -0800 | [diff] [blame] | 2047 | |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 2048 | const struct upb_MiniTable* extendee; |
| 2049 | union upb_MiniTableSub sub; // NULL unless submessage or proto2 enum |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2050 | }; |
| 2051 | |
| 2052 | |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 2053 | #endif /* UPB_MINI_TABLE_INTERNAL_EXTENSION_H_ */ |
| 2054 | |
| 2055 | // Must be last. |
| 2056 | |
| 2057 | typedef struct upb_MiniTableExtension upb_MiniTableExtension; |
| 2058 | |
| 2059 | |
| 2060 | #endif /* UPB_MINI_TABLE_EXTENSION_H_ */ |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2061 | |
| 2062 | // Must be last. |
| 2063 | |
| 2064 | // The internal representation of an extension is self-describing: it contains |
| 2065 | // enough information that we can serialize it to binary format without needing |
| 2066 | // to look it up in a upb_ExtensionRegistry. |
| 2067 | // |
| 2068 | // This representation allocates 16 bytes to data on 64-bit platforms. |
| 2069 | // This is rather wasteful for scalars (in the extreme case of bool, |
| 2070 | // it wastes 15 bytes). We accept this because we expect messages to be |
| 2071 | // the most common extension type. |
| 2072 | typedef struct { |
| 2073 | const upb_MiniTableExtension* ext; |
| 2074 | union { |
| 2075 | upb_StringView str; |
| 2076 | void* ptr; |
| 2077 | char scalar_data[8]; |
| 2078 | } data; |
| 2079 | } upb_Message_Extension; |
| 2080 | |
| 2081 | #ifdef __cplusplus |
| 2082 | extern "C" { |
| 2083 | #endif |
| 2084 | |
| 2085 | // Adds the given extension data to the given message. |
| 2086 | // |ext| is copied into the message instance. |
| 2087 | // This logically replaces any previously-added extension with this number. |
| 2088 | upb_Message_Extension* _upb_Message_GetOrCreateExtension( |
| 2089 | upb_Message* msg, const upb_MiniTableExtension* ext, upb_Arena* arena); |
| 2090 | |
| 2091 | // Returns an array of extensions for this message. |
| 2092 | // Note: the array is ordered in reverse relative to the order of creation. |
| 2093 | const upb_Message_Extension* _upb_Message_Getexts(const upb_Message* msg, |
| 2094 | size_t* count); |
| 2095 | |
| 2096 | // Returns an extension for the given field number, or NULL if no extension |
| 2097 | // exists for this field number. |
| 2098 | const upb_Message_Extension* _upb_Message_Getext( |
| 2099 | const upb_Message* msg, const upb_MiniTableExtension* ext); |
| 2100 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2101 | #ifdef __cplusplus |
| 2102 | } /* extern "C" */ |
| 2103 | #endif |
| 2104 | |
| 2105 | |
Adam Cozzette | 8059da2 | 2023-08-16 07:57:14 -0700 | [diff] [blame] | 2106 | #endif /* UPB_MESSAGE_INTERNAL_EXTENSION_H_ */ |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2107 | |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 2108 | // Must be last. |
| 2109 | |
| 2110 | #ifdef __cplusplus |
| 2111 | extern "C" { |
| 2112 | #endif |
| 2113 | |
| 2114 | // _upb_mapsorter sorts maps and provides ordered iteration over the entries. |
| 2115 | // Since maps can be recursive (map values can be messages which contain other |
| 2116 | // maps), _upb_mapsorter can contain a stack of maps. |
| 2117 | |
| 2118 | typedef struct { |
| 2119 | void const** entries; |
| 2120 | int size; |
| 2121 | int cap; |
| 2122 | } _upb_mapsorter; |
| 2123 | |
| 2124 | typedef struct { |
| 2125 | int start; |
| 2126 | int pos; |
| 2127 | int end; |
| 2128 | } _upb_sortedmap; |
| 2129 | |
| 2130 | UPB_INLINE void _upb_mapsorter_init(_upb_mapsorter* s) { |
| 2131 | s->entries = NULL; |
| 2132 | s->size = 0; |
| 2133 | s->cap = 0; |
| 2134 | } |
| 2135 | |
| 2136 | UPB_INLINE void _upb_mapsorter_destroy(_upb_mapsorter* s) { |
| 2137 | if (s->entries) free(s->entries); |
| 2138 | } |
| 2139 | |
| 2140 | UPB_INLINE bool _upb_sortedmap_next(_upb_mapsorter* s, const upb_Map* map, |
| 2141 | _upb_sortedmap* sorted, upb_MapEntry* ent) { |
| 2142 | if (sorted->pos == sorted->end) return false; |
| 2143 | const upb_tabent* tabent = (const upb_tabent*)s->entries[sorted->pos++]; |
| 2144 | upb_StringView key = upb_tabstrview(tabent->key); |
| 2145 | _upb_map_fromkey(key, &ent->data.k, map->key_size); |
| 2146 | upb_value val = {tabent->val.val}; |
| 2147 | _upb_map_fromvalue(val, &ent->data.v, map->val_size); |
| 2148 | return true; |
| 2149 | } |
| 2150 | |
| 2151 | UPB_INLINE bool _upb_sortedmap_nextext(_upb_mapsorter* s, |
| 2152 | _upb_sortedmap* sorted, |
| 2153 | const upb_Message_Extension** ext) { |
| 2154 | if (sorted->pos == sorted->end) return false; |
| 2155 | *ext = (const upb_Message_Extension*)s->entries[sorted->pos++]; |
| 2156 | return true; |
| 2157 | } |
| 2158 | |
| 2159 | UPB_INLINE void _upb_mapsorter_popmap(_upb_mapsorter* s, |
| 2160 | _upb_sortedmap* sorted) { |
| 2161 | s->size = sorted->start; |
| 2162 | } |
| 2163 | |
| 2164 | bool _upb_mapsorter_pushmap(_upb_mapsorter* s, upb_FieldType key_type, |
| 2165 | const upb_Map* map, _upb_sortedmap* sorted); |
| 2166 | |
| 2167 | bool _upb_mapsorter_pushexts(_upb_mapsorter* s, |
| 2168 | const upb_Message_Extension* exts, size_t count, |
| 2169 | _upb_sortedmap* sorted); |
| 2170 | |
| 2171 | #ifdef __cplusplus |
| 2172 | } /* extern "C" */ |
| 2173 | #endif |
| 2174 | |
| 2175 | |
Adam Cozzette | 8059da2 | 2023-08-16 07:57:14 -0700 | [diff] [blame] | 2176 | #endif /* UPB_COLLECTIONS_INTERNAL_MAP_SORTER_H_ */ |
| 2177 | |
Protobuf Team Bot | 47b9a67 | 2023-09-13 05:06:49 +0000 | [diff] [blame] | 2178 | #ifndef UPB_BASE_INTERNAL_LOG2_H_ |
| 2179 | #define UPB_BASE_INTERNAL_LOG2_H_ |
Adam Cozzette | 8059da2 | 2023-08-16 07:57:14 -0700 | [diff] [blame] | 2180 | |
| 2181 | // Must be last. |
| 2182 | |
| 2183 | #ifdef __cplusplus |
| 2184 | extern "C" { |
| 2185 | #endif |
| 2186 | |
| 2187 | UPB_INLINE int upb_Log2Ceiling(int x) { |
| 2188 | if (x <= 1) return 0; |
| 2189 | #ifdef __GNUC__ |
| 2190 | return 32 - __builtin_clz(x - 1); |
| 2191 | #else |
| 2192 | int lg2 = 0; |
| 2193 | while ((1 << lg2) < x) lg2++; |
| 2194 | return lg2; |
| 2195 | #endif |
| 2196 | } |
| 2197 | |
| 2198 | UPB_INLINE int upb_Log2CeilingSize(int x) { return 1 << upb_Log2Ceiling(x); } |
| 2199 | |
| 2200 | #ifdef __cplusplus |
| 2201 | } /* extern "C" */ |
| 2202 | #endif |
| 2203 | |
| 2204 | |
Protobuf Team Bot | 47b9a67 | 2023-09-13 05:06:49 +0000 | [diff] [blame] | 2205 | #endif /* UPB_BASE_INTERNAL_LOG2_H_ */ |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 2206 | |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 2207 | #ifndef UPB_GENERATED_CODE_SUPPORT_H_ |
| 2208 | #define UPB_GENERATED_CODE_SUPPORT_H_ |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 2209 | |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 2210 | // IWYU pragma: begin_exports |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 2211 | |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 2212 | // These functions are only used by generated code. |
| 2213 | |
| 2214 | #ifndef UPB_COLLECTIONS_MAP_GENCODE_UTIL_H_ |
| 2215 | #define UPB_COLLECTIONS_MAP_GENCODE_UTIL_H_ |
| 2216 | |
| 2217 | |
| 2218 | // Must be last. |
| 2219 | |
| 2220 | #ifdef __cplusplus |
| 2221 | extern "C" { |
| 2222 | #endif |
| 2223 | |
| 2224 | // Message map operations, these get the map from the message first. |
| 2225 | |
| 2226 | UPB_INLINE void _upb_msg_map_key(const void* msg, void* key, size_t size) { |
| 2227 | const upb_tabent* ent = (const upb_tabent*)msg; |
| 2228 | uint32_t u32len; |
| 2229 | upb_StringView k; |
| 2230 | k.data = upb_tabstr(ent->key, &u32len); |
| 2231 | k.size = u32len; |
| 2232 | _upb_map_fromkey(k, key, size); |
| 2233 | } |
| 2234 | |
| 2235 | UPB_INLINE void _upb_msg_map_value(const void* msg, void* val, size_t size) { |
| 2236 | const upb_tabent* ent = (const upb_tabent*)msg; |
| 2237 | upb_value v = {ent->val.val}; |
| 2238 | _upb_map_fromvalue(v, val, size); |
| 2239 | } |
| 2240 | |
| 2241 | UPB_INLINE void _upb_msg_map_set_value(void* msg, const void* val, |
| 2242 | size_t size) { |
| 2243 | upb_tabent* ent = (upb_tabent*)msg; |
| 2244 | // This is like _upb_map_tovalue() except the entry already exists |
| 2245 | // so we can reuse the allocated upb_StringView for string fields. |
| 2246 | if (size == UPB_MAPTYPE_STRING) { |
| 2247 | upb_StringView* strp = (upb_StringView*)(uintptr_t)ent->val.val; |
| 2248 | memcpy(strp, val, sizeof(*strp)); |
| 2249 | } else { |
| 2250 | memcpy(&ent->val.val, val, size); |
| 2251 | } |
| 2252 | } |
| 2253 | |
| 2254 | #ifdef __cplusplus |
| 2255 | } /* extern "C" */ |
| 2256 | #endif |
| 2257 | |
| 2258 | |
| 2259 | #endif /* UPB_COLLECTIONS_MAP_GENCODE_UTIL_H_ */ |
| 2260 | |
Sandy Zhang | e3b0943 | 2023-08-07 09:30:02 -0700 | [diff] [blame] | 2261 | #ifndef UPB_MESSAGE_ACCESSORS_H_ |
| 2262 | #define UPB_MESSAGE_ACCESSORS_H_ |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 2263 | |
Sandy Zhang | e3b0943 | 2023-08-07 09:30:02 -0700 | [diff] [blame] | 2264 | |
Adam Cozzette | 8059da2 | 2023-08-16 07:57:14 -0700 | [diff] [blame] | 2265 | #ifndef UPB_MESSAGE_INTERNAL_ACCESSORS_H_ |
| 2266 | #define UPB_MESSAGE_INTERNAL_ACCESSORS_H_ |
| 2267 | |
| 2268 | |
Sandy Zhang | e3b0943 | 2023-08-07 09:30:02 -0700 | [diff] [blame] | 2269 | /* |
| 2270 | ** Our memory representation for parsing tables and messages themselves. |
| 2271 | ** Functions in this file are used by generated code and possibly reflection. |
| 2272 | ** |
| 2273 | ** The definitions in this file are internal to upb. |
| 2274 | **/ |
| 2275 | |
| 2276 | #ifndef UPB_MESSAGE_INTERNAL_H_ |
| 2277 | #define UPB_MESSAGE_INTERNAL_H_ |
| 2278 | |
| 2279 | #include <stdlib.h> |
| 2280 | #include <string.h> |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 2281 | |
| 2282 | |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 2283 | #ifndef UPB_MINI_TABLE_EXTENSION_REGISTRY_H_ |
| 2284 | #define UPB_MINI_TABLE_EXTENSION_REGISTRY_H_ |
| 2285 | |
| 2286 | |
| 2287 | // Must be last. |
| 2288 | |
| 2289 | #ifdef __cplusplus |
| 2290 | extern "C" { |
| 2291 | #endif |
| 2292 | |
| 2293 | /* Extension registry: a dynamic data structure that stores a map of: |
| 2294 | * (upb_MiniTable, number) -> extension info |
| 2295 | * |
| 2296 | * upb_decode() uses upb_ExtensionRegistry to look up extensions while parsing |
| 2297 | * binary format. |
| 2298 | * |
| 2299 | * upb_ExtensionRegistry is part of the mini-table (msglayout) family of |
| 2300 | * objects. Like all mini-table objects, it is suitable for reflection-less |
| 2301 | * builds that do not want to expose names into the binary. |
| 2302 | * |
| 2303 | * Unlike most mini-table types, upb_ExtensionRegistry requires dynamic memory |
| 2304 | * allocation and dynamic initialization: |
| 2305 | * * If reflection is being used, then upb_DefPool will construct an appropriate |
| 2306 | * upb_ExtensionRegistry automatically. |
| 2307 | * * For a mini-table only build, the user must manually construct the |
| 2308 | * upb_ExtensionRegistry and populate it with all of the extensions the user |
| 2309 | * cares about. |
| 2310 | * * A third alternative is to manually unpack relevant extensions after the |
| 2311 | * main parse is complete, similar to how Any works. This is perhaps the |
| 2312 | * nicest solution from the perspective of reducing dependencies, avoiding |
| 2313 | * dynamic memory allocation, and avoiding the need to parse uninteresting |
| 2314 | * extensions. The downsides are: |
| 2315 | * (1) parse errors are not caught during the main parse |
| 2316 | * (2) the CPU hit of parsing comes during access, which could cause an |
| 2317 | * undesirable stutter in application performance. |
| 2318 | * |
| 2319 | * Users cannot directly get or put into this map. Users can only add the |
| 2320 | * extensions from a generated module and pass the extension registry to the |
| 2321 | * binary decoder. |
| 2322 | * |
| 2323 | * A upb_DefPool provides a upb_ExtensionRegistry, so any users who use |
| 2324 | * reflection do not need to populate a upb_ExtensionRegistry directly. |
| 2325 | */ |
| 2326 | |
| 2327 | typedef struct upb_ExtensionRegistry upb_ExtensionRegistry; |
| 2328 | |
| 2329 | // Creates a upb_ExtensionRegistry in the given arena. |
| 2330 | // The arena must outlive any use of the extreg. |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2331 | UPB_API upb_ExtensionRegistry* upb_ExtensionRegistry_New(upb_Arena* arena); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 2332 | |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 2333 | UPB_API bool upb_ExtensionRegistry_Add(upb_ExtensionRegistry* r, |
| 2334 | const upb_MiniTableExtension* e); |
| 2335 | |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 2336 | // Adds the given extension info for the array |e| of size |count| into the |
| 2337 | // registry. If there are any errors, the entire array is backed out. |
| 2338 | // The extensions must outlive the registry. |
| 2339 | // Possible errors include OOM or an extension number that already exists. |
Protobuf Team Bot | 986cbb6 | 2023-09-19 15:03:51 +0000 | [diff] [blame^] | 2340 | // TODO: There is currently no way to know the exact reason for failure. |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 2341 | bool upb_ExtensionRegistry_AddArray(upb_ExtensionRegistry* r, |
| 2342 | const upb_MiniTableExtension** e, |
| 2343 | size_t count); |
| 2344 | |
| 2345 | // Looks up the extension (if any) defined for message type |t| and field |
| 2346 | // number |num|. Returns the extension if found, otherwise NULL. |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 2347 | UPB_API const upb_MiniTableExtension* upb_ExtensionRegistry_Lookup( |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 2348 | const upb_ExtensionRegistry* r, const upb_MiniTable* t, uint32_t num); |
| 2349 | |
| 2350 | #ifdef __cplusplus |
| 2351 | } /* extern "C" */ |
| 2352 | #endif |
| 2353 | |
| 2354 | |
| 2355 | #endif /* UPB_MINI_TABLE_EXTENSION_REGISTRY_H_ */ |
| 2356 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2357 | // Must be last. |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 2358 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2359 | #ifdef __cplusplus |
| 2360 | extern "C" { |
| 2361 | #endif |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 2362 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2363 | extern const float kUpb_FltInfinity; |
| 2364 | extern const double kUpb_Infinity; |
| 2365 | extern const double kUpb_NaN; |
| 2366 | |
| 2367 | /* Internal members of a upb_Message that track unknown fields and/or |
| 2368 | * extensions. We can change this without breaking binary compatibility. We put |
| 2369 | * these before the user's data. The user's upb_Message* points after the |
| 2370 | * upb_Message_Internal. */ |
| 2371 | |
Protobuf Team Bot | dcc1f61 | 2023-09-05 21:56:25 +0000 | [diff] [blame] | 2372 | struct upb_Message_InternalData { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2373 | /* Total size of this structure, including the data that follows. |
| 2374 | * Must be aligned to 8, which is alignof(upb_Message_Extension) */ |
| 2375 | uint32_t size; |
| 2376 | |
| 2377 | /* Offsets relative to the beginning of this structure. |
| 2378 | * |
| 2379 | * Unknown data grows forward from the beginning to unknown_end. |
| 2380 | * Extension data grows backward from size to ext_begin. |
| 2381 | * When the two meet, we're out of data and have to realloc. |
| 2382 | * |
| 2383 | * If we imagine that the final member of this struct is: |
| 2384 | * char data[size - overhead]; // overhead = |
| 2385 | * sizeof(upb_Message_InternalData) |
| 2386 | * |
| 2387 | * Then we have: |
| 2388 | * unknown data: data[0 .. (unknown_end - overhead)] |
| 2389 | * extensions data: data[(ext_begin - overhead) .. (size - overhead)] */ |
| 2390 | uint32_t unknown_end; |
| 2391 | uint32_t ext_begin; |
| 2392 | /* Data follows, as if there were an array: |
| 2393 | * char data[size - sizeof(upb_Message_InternalData)]; */ |
Protobuf Team Bot | dcc1f61 | 2023-09-05 21:56:25 +0000 | [diff] [blame] | 2394 | }; |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2395 | |
| 2396 | /* Maps upb_CType -> memory size. */ |
| 2397 | extern char _upb_CTypeo_size[12]; |
| 2398 | |
| 2399 | UPB_INLINE size_t upb_msg_sizeof(const upb_MiniTable* t) { |
| 2400 | return t->size + sizeof(upb_Message_Internal); |
| 2401 | } |
| 2402 | |
| 2403 | // Inline version upb_Message_New(), for internal use. |
| 2404 | UPB_INLINE upb_Message* _upb_Message_New(const upb_MiniTable* mini_table, |
| 2405 | upb_Arena* arena) { |
| 2406 | size_t size = upb_msg_sizeof(mini_table); |
| 2407 | void* mem = upb_Arena_Malloc(arena, size + sizeof(upb_Message_Internal)); |
| 2408 | if (UPB_UNLIKELY(!mem)) return NULL; |
| 2409 | upb_Message* msg = UPB_PTR_AT(mem, sizeof(upb_Message_Internal), upb_Message); |
| 2410 | memset(mem, 0, size); |
| 2411 | return msg; |
| 2412 | } |
| 2413 | |
| 2414 | UPB_INLINE upb_Message_Internal* upb_Message_Getinternal( |
| 2415 | const upb_Message* msg) { |
| 2416 | ptrdiff_t size = sizeof(upb_Message_Internal); |
| 2417 | return (upb_Message_Internal*)((char*)msg - size); |
| 2418 | } |
| 2419 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2420 | // Discards the unknown fields for this message only. |
| 2421 | void _upb_Message_DiscardUnknown_shallow(upb_Message* msg); |
| 2422 | |
| 2423 | // Adds unknown data (serialized protobuf data) to the given message. |
| 2424 | // The data is copied into the message instance. |
| 2425 | bool _upb_Message_AddUnknown(upb_Message* msg, const char* data, size_t len, |
| 2426 | upb_Arena* arena); |
| 2427 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2428 | #ifdef __cplusplus |
| 2429 | } /* extern "C" */ |
| 2430 | #endif |
| 2431 | |
| 2432 | |
| 2433 | #endif /* UPB_MESSAGE_INTERNAL_H_ */ |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 2434 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2435 | // Must be last. |
| 2436 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 2437 | #if defined(__GNUC__) && !defined(__clang__) |
| 2438 | // GCC raises incorrect warnings in these functions. It thinks that we are |
| 2439 | // overrunning buffers, but we carefully write the functions in this file to |
| 2440 | // guarantee that this is impossible. GCC gets this wrong due it its failure |
| 2441 | // to perform constant propagation as we expect: |
| 2442 | // - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108217 |
| 2443 | // - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108226 |
| 2444 | // |
| 2445 | // Unfortunately this also indicates that GCC is not optimizing away the |
| 2446 | // switch() in cases where it should be, compromising the performance. |
| 2447 | #pragma GCC diagnostic push |
| 2448 | #pragma GCC diagnostic ignored "-Warray-bounds" |
| 2449 | #pragma GCC diagnostic ignored "-Wstringop-overflow" |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 2450 | #if __GNUC__ >= 11 |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 2451 | #pragma GCC diagnostic ignored "-Wstringop-overread" |
| 2452 | #endif |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 2453 | #endif |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 2454 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2455 | #ifdef __cplusplus |
| 2456 | extern "C" { |
| 2457 | #endif |
| 2458 | |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 2459 | // LINT.IfChange(presence_logic) |
| 2460 | |
| 2461 | // Hasbit access /////////////////////////////////////////////////////////////// |
| 2462 | |
| 2463 | UPB_INLINE size_t _upb_hasbit_ofs(size_t idx) { return idx / 8; } |
| 2464 | |
| 2465 | UPB_INLINE char _upb_hasbit_mask(size_t idx) { return 1 << (idx % 8); } |
| 2466 | |
| 2467 | UPB_INLINE bool _upb_hasbit(const upb_Message* msg, size_t idx) { |
| 2468 | return (*UPB_PTR_AT(msg, _upb_hasbit_ofs(idx), const char) & |
| 2469 | _upb_hasbit_mask(idx)) != 0; |
| 2470 | } |
| 2471 | |
| 2472 | UPB_INLINE void _upb_sethas(const upb_Message* msg, size_t idx) { |
| 2473 | (*UPB_PTR_AT(msg, _upb_hasbit_ofs(idx), char)) |= _upb_hasbit_mask(idx); |
| 2474 | } |
| 2475 | |
| 2476 | UPB_INLINE void _upb_clearhas(const upb_Message* msg, size_t idx) { |
| 2477 | (*UPB_PTR_AT(msg, _upb_hasbit_ofs(idx), char)) &= ~_upb_hasbit_mask(idx); |
| 2478 | } |
| 2479 | |
| 2480 | UPB_INLINE size_t _upb_Message_Hasidx(const upb_MiniTableField* f) { |
| 2481 | UPB_ASSERT(f->presence > 0); |
| 2482 | return f->presence; |
| 2483 | } |
| 2484 | |
| 2485 | UPB_INLINE bool _upb_hasbit_field(const upb_Message* msg, |
| 2486 | const upb_MiniTableField* f) { |
| 2487 | return _upb_hasbit(msg, _upb_Message_Hasidx(f)); |
| 2488 | } |
| 2489 | |
| 2490 | UPB_INLINE void _upb_sethas_field(const upb_Message* msg, |
| 2491 | const upb_MiniTableField* f) { |
| 2492 | _upb_sethas(msg, _upb_Message_Hasidx(f)); |
| 2493 | } |
| 2494 | |
| 2495 | // Oneof case access /////////////////////////////////////////////////////////// |
| 2496 | |
| 2497 | UPB_INLINE size_t _upb_oneofcase_ofs(const upb_MiniTableField* f) { |
| 2498 | UPB_ASSERT(f->presence < 0); |
| 2499 | return ~(ptrdiff_t)f->presence; |
| 2500 | } |
| 2501 | |
| 2502 | UPB_INLINE uint32_t* _upb_oneofcase_field(upb_Message* msg, |
| 2503 | const upb_MiniTableField* f) { |
| 2504 | return UPB_PTR_AT(msg, _upb_oneofcase_ofs(f), uint32_t); |
| 2505 | } |
| 2506 | |
| 2507 | UPB_INLINE uint32_t _upb_getoneofcase_field(const upb_Message* msg, |
| 2508 | const upb_MiniTableField* f) { |
| 2509 | return *_upb_oneofcase_field((upb_Message*)msg, f); |
| 2510 | } |
| 2511 | |
| 2512 | // LINT.ThenChange(GoogleInternalName2) |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 2513 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2514 | UPB_INLINE bool _upb_MiniTableField_InOneOf(const upb_MiniTableField* field) { |
| 2515 | return field->presence < 0; |
| 2516 | } |
| 2517 | |
| 2518 | UPB_INLINE void* _upb_MiniTableField_GetPtr(upb_Message* msg, |
| 2519 | const upb_MiniTableField* field) { |
| 2520 | return (char*)msg + field->offset; |
| 2521 | } |
| 2522 | |
| 2523 | UPB_INLINE const void* _upb_MiniTableField_GetConstPtr( |
| 2524 | const upb_Message* msg, const upb_MiniTableField* field) { |
| 2525 | return (char*)msg + field->offset; |
| 2526 | } |
| 2527 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2528 | UPB_INLINE void _upb_Message_SetPresence(upb_Message* msg, |
| 2529 | const upb_MiniTableField* field) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2530 | if (field->presence > 0) { |
| 2531 | _upb_sethas_field(msg, field); |
| 2532 | } else if (_upb_MiniTableField_InOneOf(field)) { |
| 2533 | *_upb_oneofcase_field(msg, field) = field->number; |
| 2534 | } |
| 2535 | } |
| 2536 | |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 2537 | UPB_INLINE bool _upb_MiniTable_ValueIsNonZero(const void* default_val, |
| 2538 | const upb_MiniTableField* field) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2539 | char zero[16] = {0}; |
| 2540 | switch (_upb_MiniTableField_GetRep(field)) { |
| 2541 | case kUpb_FieldRep_1Byte: |
| 2542 | return memcmp(&zero, default_val, 1) != 0; |
| 2543 | case kUpb_FieldRep_4Byte: |
| 2544 | return memcmp(&zero, default_val, 4) != 0; |
| 2545 | case kUpb_FieldRep_8Byte: |
| 2546 | return memcmp(&zero, default_val, 8) != 0; |
| 2547 | case kUpb_FieldRep_StringView: { |
| 2548 | const upb_StringView* sv = (const upb_StringView*)default_val; |
| 2549 | return sv->size != 0; |
| 2550 | } |
| 2551 | } |
| 2552 | UPB_UNREACHABLE(); |
| 2553 | } |
| 2554 | |
| 2555 | UPB_INLINE void _upb_MiniTable_CopyFieldData(void* to, const void* from, |
| 2556 | const upb_MiniTableField* field) { |
| 2557 | switch (_upb_MiniTableField_GetRep(field)) { |
| 2558 | case kUpb_FieldRep_1Byte: |
| 2559 | memcpy(to, from, 1); |
| 2560 | return; |
| 2561 | case kUpb_FieldRep_4Byte: |
| 2562 | memcpy(to, from, 4); |
| 2563 | return; |
| 2564 | case kUpb_FieldRep_8Byte: |
| 2565 | memcpy(to, from, 8); |
| 2566 | return; |
| 2567 | case kUpb_FieldRep_StringView: { |
| 2568 | memcpy(to, from, sizeof(upb_StringView)); |
| 2569 | return; |
| 2570 | } |
| 2571 | } |
| 2572 | UPB_UNREACHABLE(); |
| 2573 | } |
| 2574 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 2575 | UPB_INLINE size_t |
| 2576 | _upb_MiniTable_ElementSizeLg2(const upb_MiniTableField* field) { |
| 2577 | const unsigned char table[] = { |
| 2578 | 0, |
| 2579 | 3, // kUpb_FieldType_Double = 1, |
| 2580 | 2, // kUpb_FieldType_Float = 2, |
| 2581 | 3, // kUpb_FieldType_Int64 = 3, |
| 2582 | 3, // kUpb_FieldType_UInt64 = 4, |
| 2583 | 2, // kUpb_FieldType_Int32 = 5, |
| 2584 | 3, // kUpb_FieldType_Fixed64 = 6, |
| 2585 | 2, // kUpb_FieldType_Fixed32 = 7, |
| 2586 | 0, // kUpb_FieldType_Bool = 8, |
| 2587 | UPB_SIZE(3, 4), // kUpb_FieldType_String = 9, |
| 2588 | UPB_SIZE(2, 3), // kUpb_FieldType_Group = 10, |
| 2589 | UPB_SIZE(2, 3), // kUpb_FieldType_Message = 11, |
| 2590 | UPB_SIZE(3, 4), // kUpb_FieldType_Bytes = 12, |
| 2591 | 2, // kUpb_FieldType_UInt32 = 13, |
| 2592 | 2, // kUpb_FieldType_Enum = 14, |
| 2593 | 2, // kUpb_FieldType_SFixed32 = 15, |
| 2594 | 3, // kUpb_FieldType_SFixed64 = 16, |
| 2595 | 2, // kUpb_FieldType_SInt32 = 17, |
| 2596 | 3, // kUpb_FieldType_SInt64 = 18, |
| 2597 | }; |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2598 | return table[field->UPB_PRIVATE(descriptortype)]; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 2599 | } |
| 2600 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2601 | // Here we define universal getter/setter functions for message fields. |
| 2602 | // These look very branchy and inefficient, but as long as the MiniTableField |
| 2603 | // values are known at compile time, all the branches are optimized away and |
| 2604 | // we are left with ideal code. This can happen either through through |
| 2605 | // literals or UPB_ASSUME(): |
| 2606 | // |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 2607 | // // Via struct literals. |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2608 | // bool FooMessage_set_bool_field(const upb_Message* msg, bool val) { |
| 2609 | // const upb_MiniTableField field = {1, 0, 0, /* etc... */}; |
| 2610 | // // All value in "field" are compile-time known. |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2611 | // _upb_Message_SetNonExtensionField(msg, &field, &value); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2612 | // } |
| 2613 | // |
| 2614 | // // Via UPB_ASSUME(). |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2615 | // UPB_INLINE bool upb_Message_SetBool(upb_Message* msg, |
| 2616 | // const upb_MiniTableField* field, |
| 2617 | // bool value, upb_Arena* a) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2618 | // UPB_ASSUME(field->UPB_PRIVATE(descriptortype) == kUpb_FieldType_Bool); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2619 | // UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
| 2620 | // UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_1Byte); |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2621 | // _upb_Message_SetField(msg, field, &value, a); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2622 | // } |
| 2623 | // |
| 2624 | // As a result, we can use these universal getters/setters for *all* message |
| 2625 | // accessors: generated code, MiniTable accessors, and reflection. The only |
| 2626 | // exception is the binary encoder/decoder, which need to be a bit more clever |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 2627 | // about how they read/write the message data, for efficiency. |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2628 | // |
| 2629 | // These functions work on both extensions and non-extensions. If the field |
| 2630 | // of a setter is known to be a non-extension, the arena may be NULL and the |
| 2631 | // returned bool value may be ignored since it will always succeed. |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2632 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2633 | UPB_INLINE bool _upb_Message_HasExtensionField( |
| 2634 | const upb_Message* msg, const upb_MiniTableExtension* ext) { |
| 2635 | UPB_ASSERT(upb_MiniTableField_HasPresence(&ext->field)); |
| 2636 | return _upb_Message_Getext(msg, ext) != NULL; |
| 2637 | } |
| 2638 | |
| 2639 | UPB_INLINE bool _upb_Message_HasNonExtensionField( |
| 2640 | const upb_Message* msg, const upb_MiniTableField* field) { |
| 2641 | UPB_ASSERT(upb_MiniTableField_HasPresence(field)); |
| 2642 | UPB_ASSUME(!upb_MiniTableField_IsExtension(field)); |
| 2643 | if (_upb_MiniTableField_InOneOf(field)) { |
| 2644 | return _upb_getoneofcase_field(msg, field) == field->number; |
| 2645 | } else { |
| 2646 | return _upb_hasbit_field(msg, field); |
| 2647 | } |
| 2648 | } |
| 2649 | |
| 2650 | static UPB_FORCEINLINE void _upb_Message_GetNonExtensionField( |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2651 | const upb_Message* msg, const upb_MiniTableField* field, |
| 2652 | const void* default_val, void* val) { |
| 2653 | UPB_ASSUME(!upb_MiniTableField_IsExtension(field)); |
| 2654 | if ((_upb_MiniTableField_InOneOf(field) || |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 2655 | _upb_MiniTable_ValueIsNonZero(default_val, field)) && |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2656 | !_upb_Message_HasNonExtensionField(msg, field)) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2657 | _upb_MiniTable_CopyFieldData(val, default_val, field); |
| 2658 | return; |
| 2659 | } |
| 2660 | _upb_MiniTable_CopyFieldData(val, _upb_MiniTableField_GetConstPtr(msg, field), |
| 2661 | field); |
| 2662 | } |
| 2663 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2664 | UPB_INLINE void _upb_Message_GetExtensionField( |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2665 | const upb_Message* msg, const upb_MiniTableExtension* mt_ext, |
| 2666 | const void* default_val, void* val) { |
| 2667 | UPB_ASSUME(upb_MiniTableField_IsExtension(&mt_ext->field)); |
| 2668 | const upb_Message_Extension* ext = _upb_Message_Getext(msg, mt_ext); |
| 2669 | if (ext) { |
| 2670 | _upb_MiniTable_CopyFieldData(val, &ext->data, &mt_ext->field); |
| 2671 | } else { |
| 2672 | _upb_MiniTable_CopyFieldData(val, default_val, &mt_ext->field); |
| 2673 | } |
| 2674 | } |
| 2675 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2676 | UPB_INLINE void _upb_Message_GetField(const upb_Message* msg, |
| 2677 | const upb_MiniTableField* field, |
| 2678 | const void* default_val, void* val) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2679 | if (upb_MiniTableField_IsExtension(field)) { |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2680 | _upb_Message_GetExtensionField(msg, (upb_MiniTableExtension*)field, |
| 2681 | default_val, val); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2682 | } else { |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2683 | _upb_Message_GetNonExtensionField(msg, field, default_val, val); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2684 | } |
| 2685 | } |
| 2686 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2687 | UPB_INLINE void _upb_Message_SetNonExtensionField( |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2688 | upb_Message* msg, const upb_MiniTableField* field, const void* val) { |
| 2689 | UPB_ASSUME(!upb_MiniTableField_IsExtension(field)); |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2690 | _upb_Message_SetPresence(msg, field); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2691 | _upb_MiniTable_CopyFieldData(_upb_MiniTableField_GetPtr(msg, field), val, |
| 2692 | field); |
| 2693 | } |
| 2694 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2695 | UPB_INLINE bool _upb_Message_SetExtensionField( |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2696 | upb_Message* msg, const upb_MiniTableExtension* mt_ext, const void* val, |
| 2697 | upb_Arena* a) { |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2698 | UPB_ASSERT(a); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2699 | upb_Message_Extension* ext = |
| 2700 | _upb_Message_GetOrCreateExtension(msg, mt_ext, a); |
| 2701 | if (!ext) return false; |
| 2702 | _upb_MiniTable_CopyFieldData(&ext->data, val, &mt_ext->field); |
| 2703 | return true; |
| 2704 | } |
| 2705 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2706 | UPB_INLINE bool _upb_Message_SetField(upb_Message* msg, |
| 2707 | const upb_MiniTableField* field, |
| 2708 | const void* val, upb_Arena* a) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2709 | if (upb_MiniTableField_IsExtension(field)) { |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2710 | const upb_MiniTableExtension* ext = (const upb_MiniTableExtension*)field; |
| 2711 | return _upb_Message_SetExtensionField(msg, ext, val, a); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2712 | } else { |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2713 | _upb_Message_SetNonExtensionField(msg, field, val); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2714 | return true; |
| 2715 | } |
| 2716 | } |
| 2717 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2718 | UPB_INLINE void _upb_Message_ClearExtensionField( |
| 2719 | upb_Message* msg, const upb_MiniTableExtension* ext_l) { |
| 2720 | upb_Message_Internal* in = upb_Message_Getinternal(msg); |
| 2721 | if (!in->internal) return; |
| 2722 | const upb_Message_Extension* base = |
| 2723 | UPB_PTR_AT(in->internal, in->internal->ext_begin, upb_Message_Extension); |
| 2724 | upb_Message_Extension* ext = |
| 2725 | (upb_Message_Extension*)_upb_Message_Getext(msg, ext_l); |
| 2726 | if (ext) { |
| 2727 | *ext = *base; |
| 2728 | in->internal->ext_begin += sizeof(upb_Message_Extension); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 2729 | } |
| 2730 | } |
| 2731 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2732 | UPB_INLINE void _upb_Message_ClearNonExtensionField( |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 2733 | upb_Message* msg, const upb_MiniTableField* field) { |
| 2734 | if (field->presence > 0) { |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 2735 | _upb_clearhas(msg, _upb_Message_Hasidx(field)); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 2736 | } else if (_upb_MiniTableField_InOneOf(field)) { |
| 2737 | uint32_t* oneof_case = _upb_oneofcase_field(msg, field); |
| 2738 | if (*oneof_case != field->number) return; |
| 2739 | *oneof_case = 0; |
| 2740 | } |
| 2741 | const char zeros[16] = {0}; |
| 2742 | _upb_MiniTable_CopyFieldData(_upb_MiniTableField_GetPtr(msg, field), zeros, |
| 2743 | field); |
| 2744 | } |
| 2745 | |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 2746 | UPB_INLINE void _upb_Message_AssertMapIsUntagged( |
| 2747 | const upb_Message* msg, const upb_MiniTableField* field) { |
Adam Cozzette | 7d5592e | 2023-08-23 12:15:26 -0700 | [diff] [blame] | 2748 | UPB_UNUSED(msg); |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 2749 | _upb_MiniTableField_CheckIsMap(field); |
| 2750 | #ifndef NDEBUG |
| 2751 | upb_TaggedMessagePtr default_val = 0; |
| 2752 | upb_TaggedMessagePtr tagged; |
| 2753 | _upb_Message_GetNonExtensionField(msg, field, &default_val, &tagged); |
| 2754 | UPB_ASSERT(!upb_TaggedMessagePtr_IsEmpty(tagged)); |
| 2755 | #endif |
| 2756 | } |
| 2757 | |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 2758 | UPB_INLINE upb_Map* _upb_Message_GetOrCreateMutableMap( |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 2759 | upb_Message* msg, const upb_MiniTableField* field, size_t key_size, |
| 2760 | size_t val_size, upb_Arena* arena) { |
| 2761 | _upb_MiniTableField_CheckIsMap(field); |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 2762 | _upb_Message_AssertMapIsUntagged(msg, field); |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 2763 | upb_Map* map = NULL; |
| 2764 | upb_Map* default_map_value = NULL; |
| 2765 | _upb_Message_GetNonExtensionField(msg, field, &default_map_value, &map); |
| 2766 | if (!map) { |
| 2767 | map = _upb_Map_New(arena, key_size, val_size); |
| 2768 | // Check again due to: https://godbolt.org/z/7WfaoKG1r |
| 2769 | _upb_MiniTableField_CheckIsMap(field); |
| 2770 | _upb_Message_SetNonExtensionField(msg, field, &map); |
| 2771 | } |
| 2772 | return map; |
| 2773 | } |
| 2774 | |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2775 | #ifdef __cplusplus |
| 2776 | } /* extern "C" */ |
| 2777 | #endif |
| 2778 | |
| 2779 | #if defined(__GNUC__) && !defined(__clang__) |
| 2780 | #pragma GCC diagnostic pop |
| 2781 | #endif |
| 2782 | |
| 2783 | |
Sandy Zhang | e3b0943 | 2023-08-07 09:30:02 -0700 | [diff] [blame] | 2784 | #endif // UPB_MESSAGE_INTERNAL_ACCESSORS_H_ |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2785 | |
| 2786 | // Must be last. |
| 2787 | |
| 2788 | #ifdef __cplusplus |
| 2789 | extern "C" { |
| 2790 | #endif |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2791 | |
| 2792 | UPB_API_INLINE void upb_Message_ClearField(upb_Message* msg, |
| 2793 | const upb_MiniTableField* field) { |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 2794 | if (upb_MiniTableField_IsExtension(field)) { |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2795 | const upb_MiniTableExtension* ext = (const upb_MiniTableExtension*)field; |
| 2796 | _upb_Message_ClearExtensionField(msg, ext); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 2797 | } else { |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2798 | _upb_Message_ClearNonExtensionField(msg, field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 2799 | } |
| 2800 | } |
| 2801 | |
Jie Luo | f36a5c6 | 2023-05-23 17:56:18 -0700 | [diff] [blame] | 2802 | UPB_API_INLINE void upb_Message_Clear(upb_Message* msg, |
| 2803 | const upb_MiniTable* l) { |
| 2804 | // Note: Can't use UPB_PTR_AT() here because we are doing pointer subtraction. |
| 2805 | char* mem = (char*)msg - sizeof(upb_Message_Internal); |
| 2806 | memset(mem, 0, upb_msg_sizeof(l)); |
| 2807 | } |
| 2808 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2809 | UPB_API_INLINE bool upb_Message_HasField(const upb_Message* msg, |
| 2810 | const upb_MiniTableField* field) { |
| 2811 | if (upb_MiniTableField_IsExtension(field)) { |
| 2812 | const upb_MiniTableExtension* ext = (const upb_MiniTableExtension*)field; |
| 2813 | return _upb_Message_HasExtensionField(msg, ext); |
| 2814 | } else { |
| 2815 | return _upb_Message_HasNonExtensionField(msg, field); |
| 2816 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 2817 | } |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2818 | |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 2819 | UPB_API_INLINE uint32_t upb_Message_WhichOneofFieldNumber( |
| 2820 | const upb_Message* message, const upb_MiniTableField* oneof_field) { |
| 2821 | UPB_ASSUME(_upb_MiniTableField_InOneOf(oneof_field)); |
| 2822 | return _upb_getoneofcase_field(message, oneof_field); |
| 2823 | } |
| 2824 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2825 | UPB_API_INLINE bool upb_Message_GetBool(const upb_Message* msg, |
| 2826 | const upb_MiniTableField* field, |
| 2827 | bool default_val) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2828 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Bool); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2829 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_1Byte); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2830 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2831 | bool ret; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2832 | _upb_Message_GetField(msg, field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2833 | return ret; |
| 2834 | } |
| 2835 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2836 | UPB_API_INLINE bool upb_Message_SetBool(upb_Message* msg, |
| 2837 | const upb_MiniTableField* field, |
| 2838 | bool value, upb_Arena* a) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2839 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Bool); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2840 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_1Byte); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2841 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2842 | return _upb_Message_SetField(msg, field, &value, a); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2843 | } |
| 2844 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2845 | UPB_API_INLINE int32_t upb_Message_GetInt32(const upb_Message* msg, |
| 2846 | const upb_MiniTableField* field, |
| 2847 | int32_t default_val) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2848 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Int32 || |
| 2849 | upb_MiniTableField_CType(field) == kUpb_CType_Enum); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2850 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2851 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2852 | int32_t ret; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2853 | _upb_Message_GetField(msg, field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2854 | return ret; |
| 2855 | } |
| 2856 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2857 | UPB_API_INLINE bool upb_Message_SetInt32(upb_Message* msg, |
| 2858 | const upb_MiniTableField* field, |
| 2859 | int32_t value, upb_Arena* a) { |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 2860 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Int32 || |
| 2861 | upb_MiniTableField_CType(field) == kUpb_CType_Enum); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2862 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2863 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2864 | return _upb_Message_SetField(msg, field, &value, a); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2865 | } |
| 2866 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2867 | UPB_API_INLINE uint32_t upb_Message_GetUInt32(const upb_Message* msg, |
| 2868 | const upb_MiniTableField* field, |
| 2869 | uint32_t default_val) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2870 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_UInt32); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2871 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2872 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2873 | uint32_t ret; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2874 | _upb_Message_GetField(msg, field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2875 | return ret; |
| 2876 | } |
| 2877 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2878 | UPB_API_INLINE bool upb_Message_SetUInt32(upb_Message* msg, |
| 2879 | const upb_MiniTableField* field, |
| 2880 | uint32_t value, upb_Arena* a) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2881 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_UInt32); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2882 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2883 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2884 | return _upb_Message_SetField(msg, field, &value, a); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2885 | } |
| 2886 | |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 2887 | UPB_API_INLINE void upb_Message_SetClosedEnum( |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 2888 | upb_Message* msg, const upb_MiniTable* msg_mini_table, |
| 2889 | const upb_MiniTableField* field, int32_t value) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2890 | UPB_ASSERT(upb_MiniTableField_IsClosedEnum(field)); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2891 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2892 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2893 | UPB_ASSERT(upb_MiniTableEnum_CheckValue( |
| 2894 | upb_MiniTable_GetSubEnumTable(msg_mini_table, field), value)); |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2895 | _upb_Message_SetNonExtensionField(msg, field, &value); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2896 | } |
| 2897 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2898 | UPB_API_INLINE int64_t upb_Message_GetInt64(const upb_Message* msg, |
| 2899 | const upb_MiniTableField* field, |
| 2900 | uint64_t default_val) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2901 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Int64); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2902 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_8Byte); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2903 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2904 | int64_t ret; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2905 | _upb_Message_GetField(msg, field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2906 | return ret; |
| 2907 | } |
| 2908 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2909 | UPB_API_INLINE bool upb_Message_SetInt64(upb_Message* msg, |
| 2910 | const upb_MiniTableField* field, |
| 2911 | int64_t value, upb_Arena* a) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2912 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Int64); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2913 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_8Byte); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2914 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2915 | return _upb_Message_SetField(msg, field, &value, a); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2916 | } |
| 2917 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2918 | UPB_API_INLINE uint64_t upb_Message_GetUInt64(const upb_Message* msg, |
| 2919 | const upb_MiniTableField* field, |
| 2920 | uint64_t default_val) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2921 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_UInt64); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2922 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_8Byte); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2923 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2924 | uint64_t ret; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2925 | _upb_Message_GetField(msg, field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2926 | return ret; |
| 2927 | } |
| 2928 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2929 | UPB_API_INLINE bool upb_Message_SetUInt64(upb_Message* msg, |
| 2930 | const upb_MiniTableField* field, |
| 2931 | uint64_t value, upb_Arena* a) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2932 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_UInt64); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2933 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_8Byte); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2934 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2935 | return _upb_Message_SetField(msg, field, &value, a); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2936 | } |
| 2937 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2938 | UPB_API_INLINE float upb_Message_GetFloat(const upb_Message* msg, |
| 2939 | const upb_MiniTableField* field, |
| 2940 | float default_val) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2941 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Float); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2942 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2943 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2944 | float ret; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2945 | _upb_Message_GetField(msg, field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2946 | return ret; |
| 2947 | } |
| 2948 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2949 | UPB_API_INLINE bool upb_Message_SetFloat(upb_Message* msg, |
| 2950 | const upb_MiniTableField* field, |
| 2951 | float value, upb_Arena* a) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2952 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Float); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2953 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2954 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2955 | return _upb_Message_SetField(msg, field, &value, a); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2956 | } |
| 2957 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2958 | UPB_API_INLINE double upb_Message_GetDouble(const upb_Message* msg, |
| 2959 | const upb_MiniTableField* field, |
| 2960 | double default_val) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2961 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Double); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2962 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_8Byte); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2963 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2964 | double ret; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2965 | _upb_Message_GetField(msg, field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2966 | return ret; |
| 2967 | } |
| 2968 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2969 | UPB_API_INLINE bool upb_Message_SetDouble(upb_Message* msg, |
| 2970 | const upb_MiniTableField* field, |
| 2971 | double value, upb_Arena* a) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2972 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Double); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2973 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_8Byte); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2974 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2975 | return _upb_Message_SetField(msg, field, &value, a); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2976 | } |
| 2977 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 2978 | UPB_API_INLINE upb_StringView |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2979 | upb_Message_GetString(const upb_Message* msg, const upb_MiniTableField* field, |
| 2980 | upb_StringView def_val) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2981 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_String || |
| 2982 | upb_MiniTableField_CType(field) == kUpb_CType_Bytes); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2983 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_StringView); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2984 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2985 | upb_StringView ret; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2986 | _upb_Message_GetField(msg, field, &def_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2987 | return ret; |
| 2988 | } |
| 2989 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2990 | UPB_API_INLINE bool upb_Message_SetString(upb_Message* msg, |
| 2991 | const upb_MiniTableField* field, |
| 2992 | upb_StringView value, upb_Arena* a) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2993 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_String || |
| 2994 | upb_MiniTableField_CType(field) == kUpb_CType_Bytes); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2995 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_StringView); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2996 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2997 | return _upb_Message_SetField(msg, field, &value, a); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2998 | } |
| 2999 | |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 3000 | UPB_API_INLINE upb_TaggedMessagePtr upb_Message_GetTaggedMessagePtr( |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 3001 | const upb_Message* msg, const upb_MiniTableField* field, |
| 3002 | upb_Message* default_val) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 3003 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Message); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 3004 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == |
| 3005 | UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte)); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 3006 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 3007 | upb_TaggedMessagePtr tagged; |
| 3008 | _upb_Message_GetNonExtensionField(msg, field, &default_val, &tagged); |
| 3009 | return tagged; |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 3010 | } |
| 3011 | |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 3012 | UPB_API_INLINE const upb_Message* upb_Message_GetMessage( |
| 3013 | const upb_Message* msg, const upb_MiniTableField* field, |
| 3014 | upb_Message* default_val) { |
| 3015 | upb_TaggedMessagePtr tagged = |
| 3016 | upb_Message_GetTaggedMessagePtr(msg, field, default_val); |
| 3017 | return upb_TaggedMessagePtr_GetNonEmptyMessage(tagged); |
| 3018 | } |
| 3019 | |
| 3020 | // For internal use only; users cannot set tagged messages because only the |
| 3021 | // parser and the message copier are allowed to directly create an empty |
| 3022 | // message. |
| 3023 | UPB_API_INLINE void _upb_Message_SetTaggedMessagePtr( |
| 3024 | upb_Message* msg, const upb_MiniTable* mini_table, |
| 3025 | const upb_MiniTableField* field, upb_TaggedMessagePtr sub_message) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 3026 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Message); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 3027 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == |
| 3028 | UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte)); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 3029 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 3030 | UPB_ASSERT(mini_table->subs[field->UPB_PRIVATE(submsg_index)].submsg); |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 3031 | _upb_Message_SetNonExtensionField(msg, field, &sub_message); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 3032 | } |
| 3033 | |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 3034 | UPB_API_INLINE void upb_Message_SetMessage(upb_Message* msg, |
| 3035 | const upb_MiniTable* mini_table, |
| 3036 | const upb_MiniTableField* field, |
| 3037 | upb_Message* sub_message) { |
| 3038 | _upb_Message_SetTaggedMessagePtr( |
| 3039 | msg, mini_table, field, _upb_TaggedMessagePtr_Pack(sub_message, false)); |
| 3040 | } |
| 3041 | |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 3042 | UPB_API_INLINE upb_Message* upb_Message_GetOrCreateMutableMessage( |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 3043 | upb_Message* msg, const upb_MiniTable* mini_table, |
| 3044 | const upb_MiniTableField* field, upb_Arena* arena) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 3045 | UPB_ASSERT(arena); |
| 3046 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Message); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 3047 | upb_Message* sub_message = *UPB_PTR_AT(msg, field->offset, upb_Message*); |
| 3048 | if (!sub_message) { |
| 3049 | const upb_MiniTable* sub_mini_table = |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 3050 | mini_table->subs[field->UPB_PRIVATE(submsg_index)].submsg; |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 3051 | UPB_ASSERT(sub_mini_table); |
| 3052 | sub_message = _upb_Message_New(sub_mini_table, arena); |
| 3053 | *UPB_PTR_AT(msg, field->offset, upb_Message*) = sub_message; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 3054 | _upb_Message_SetPresence(msg, field); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 3055 | } |
| 3056 | return sub_message; |
| 3057 | } |
| 3058 | |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 3059 | UPB_API_INLINE const upb_Array* upb_Message_GetArray( |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 3060 | const upb_Message* msg, const upb_MiniTableField* field) { |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 3061 | _upb_MiniTableField_CheckIsArray(field); |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 3062 | upb_Array* ret; |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 3063 | const upb_Array* default_val = NULL; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 3064 | _upb_Message_GetNonExtensionField(msg, field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 3065 | return ret; |
| 3066 | } |
| 3067 | |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 3068 | UPB_API_INLINE upb_Array* upb_Message_GetMutableArray( |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 3069 | upb_Message* msg, const upb_MiniTableField* field) { |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 3070 | _upb_MiniTableField_CheckIsArray(field); |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 3071 | return (upb_Array*)upb_Message_GetArray(msg, field); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 3072 | } |
| 3073 | |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 3074 | UPB_API_INLINE upb_Array* upb_Message_GetOrCreateMutableArray( |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 3075 | upb_Message* msg, const upb_MiniTableField* field, upb_Arena* arena) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 3076 | UPB_ASSERT(arena); |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 3077 | _upb_MiniTableField_CheckIsArray(field); |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 3078 | upb_Array* array = upb_Message_GetMutableArray(msg, field); |
| 3079 | if (!array) { |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 3080 | array = _upb_Array_New(arena, 4, _upb_MiniTable_ElementSizeLg2(field)); |
| 3081 | // Check again due to: https://godbolt.org/z/7WfaoKG1r |
| 3082 | _upb_MiniTableField_CheckIsArray(field); |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 3083 | _upb_Message_SetField(msg, field, &array, arena); |
| 3084 | } |
| 3085 | return array; |
| 3086 | } |
| 3087 | |
Jie Luo | f36a5c6 | 2023-05-23 17:56:18 -0700 | [diff] [blame] | 3088 | UPB_API_INLINE void* upb_Message_ResizeArrayUninitialized( |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 3089 | upb_Message* msg, const upb_MiniTableField* field, size_t size, |
| 3090 | upb_Arena* arena) { |
| 3091 | _upb_MiniTableField_CheckIsArray(field); |
| 3092 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, field, arena); |
| 3093 | if (!arr || !_upb_Array_ResizeUninitialized(arr, size, arena)) return NULL; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 3094 | return _upb_array_ptr(arr); |
| 3095 | } |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 3096 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 3097 | UPB_API_INLINE const upb_Map* upb_Message_GetMap( |
| 3098 | const upb_Message* msg, const upb_MiniTableField* field) { |
| 3099 | _upb_MiniTableField_CheckIsMap(field); |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 3100 | _upb_Message_AssertMapIsUntagged(msg, field); |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 3101 | upb_Map* ret; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 3102 | const upb_Map* default_val = NULL; |
| 3103 | _upb_Message_GetNonExtensionField(msg, field, &default_val, &ret); |
| 3104 | return ret; |
| 3105 | } |
| 3106 | |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 3107 | UPB_API_INLINE upb_Map* upb_Message_GetMutableMap( |
| 3108 | upb_Message* msg, const upb_MiniTableField* field) { |
| 3109 | return (upb_Map*)upb_Message_GetMap(msg, field); |
| 3110 | } |
| 3111 | |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 3112 | UPB_API_INLINE upb_Map* upb_Message_GetOrCreateMutableMap( |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 3113 | upb_Message* msg, const upb_MiniTable* map_entry_mini_table, |
| 3114 | const upb_MiniTableField* field, upb_Arena* arena) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 3115 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Message); |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 3116 | const upb_MiniTableField* map_entry_key_field = |
| 3117 | &map_entry_mini_table->fields[0]; |
| 3118 | const upb_MiniTableField* map_entry_value_field = |
| 3119 | &map_entry_mini_table->fields[1]; |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 3120 | return _upb_Message_GetOrCreateMutableMap( |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 3121 | msg, field, |
| 3122 | _upb_Map_CTypeSize(upb_MiniTableField_CType(map_entry_key_field)), |
| 3123 | _upb_Map_CTypeSize(upb_MiniTableField_CType(map_entry_value_field)), |
| 3124 | arena); |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 3125 | } |
| 3126 | |
| 3127 | // Updates a map entry given an entry message. |
| 3128 | upb_MapInsertStatus upb_Message_InsertMapEntry(upb_Map* map, |
| 3129 | const upb_MiniTable* mini_table, |
| 3130 | const upb_MiniTableField* field, |
| 3131 | upb_Message* map_entry_message, |
| 3132 | upb_Arena* arena); |
| 3133 | |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 3134 | // Compares two messages by serializing them and calling memcmp(). |
| 3135 | bool upb_Message_IsExactlyEqual(const upb_Message* m1, const upb_Message* m2, |
| 3136 | const upb_MiniTable* layout); |
| 3137 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 3138 | #ifdef __cplusplus |
| 3139 | } /* extern "C" */ |
| 3140 | #endif |
| 3141 | |
| 3142 | |
| 3143 | #endif // UPB_MESSAGE_ACCESSORS_H_ |
| 3144 | |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 3145 | #ifndef UPB_MINI_TABLE_DECODE_H_ |
| 3146 | #define UPB_MINI_TABLE_DECODE_H_ |
| 3147 | |
| 3148 | |
| 3149 | #ifndef UPB_MINI_TABLE_SUB_H_ |
| 3150 | #define UPB_MINI_TABLE_SUB_H_ |
| 3151 | |
| 3152 | |
| 3153 | typedef union upb_MiniTableSub upb_MiniTableSub; |
| 3154 | |
| 3155 | #endif /* UPB_MINI_TABLE_INTERNAL_SUB_H_ */ |
| 3156 | |
| 3157 | // Export the newer headers, for legacy users. New users should include the |
| 3158 | // more specific headers directly. |
| 3159 | // IWYU pragma: begin_exports |
| 3160 | |
| 3161 | #ifndef UPB_MINI_DESCRIPTOR_BUILD_ENUM_H_ |
| 3162 | #define UPB_MINI_DESCRIPTOR_BUILD_ENUM_H_ |
| 3163 | |
| 3164 | |
| 3165 | // Must be last. |
| 3166 | |
| 3167 | #ifdef __cplusplus |
| 3168 | extern "C" { |
| 3169 | #endif |
| 3170 | |
| 3171 | // Builds a upb_MiniTableEnum from an enum MiniDescriptor. The MiniDescriptor |
| 3172 | // must be for an enum, not a message. |
| 3173 | UPB_API upb_MiniTableEnum* upb_MiniDescriptor_BuildEnum(const char* data, |
| 3174 | size_t len, |
| 3175 | upb_Arena* arena, |
| 3176 | upb_Status* status); |
| 3177 | |
Protobuf Team Bot | 986cbb6 | 2023-09-19 15:03:51 +0000 | [diff] [blame^] | 3178 | // TODO: Deprecated name; update callers. |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 3179 | UPB_API_INLINE upb_MiniTableEnum* upb_MiniTableEnum_Build(const char* data, |
| 3180 | size_t len, |
| 3181 | upb_Arena* arena, |
| 3182 | upb_Status* status) { |
| 3183 | return upb_MiniDescriptor_BuildEnum(data, len, arena, status); |
| 3184 | } |
| 3185 | |
| 3186 | #ifdef __cplusplus |
| 3187 | } /* extern "C" */ |
| 3188 | #endif |
| 3189 | |
| 3190 | |
| 3191 | #endif // UPB_MINI_DESCRIPTOR_BUILD_ENUM_H_ |
| 3192 | |
| 3193 | // Functions for linking MiniTables together once they are built from a |
| 3194 | // MiniDescriptor. |
| 3195 | // |
| 3196 | // These functions have names like upb_MiniTable_Link() because they operate on |
| 3197 | // MiniTables. We put them here, rather than in the mini_table/ directory, |
| 3198 | // because they are only needed when building MiniTables from MiniDescriptors. |
| 3199 | // The interfaces in mini_table/ assume that MiniTables are immutable. |
| 3200 | |
| 3201 | #ifndef UPB_MINI_DESCRIPTOR_LINK_H_ |
| 3202 | #define UPB_MINI_DESCRIPTOR_LINK_H_ |
| 3203 | |
| 3204 | |
| 3205 | // Must be last. |
| 3206 | |
| 3207 | #ifdef __cplusplus |
| 3208 | extern "C" { |
| 3209 | #endif |
| 3210 | |
| 3211 | // Links a sub-message field to a MiniTable for that sub-message. If a |
| 3212 | // sub-message field is not linked, it will be treated as an unknown field |
| 3213 | // during parsing, and setting the field will not be allowed. It is possible |
| 3214 | // to link the message field later, at which point it will no longer be treated |
| 3215 | // as unknown. However there is no synchronization for this operation, which |
| 3216 | // means parallel mutation requires external synchronization. |
| 3217 | // Returns success/failure. |
| 3218 | UPB_API bool upb_MiniTable_SetSubMessage(upb_MiniTable* table, |
| 3219 | upb_MiniTableField* field, |
| 3220 | const upb_MiniTable* sub); |
| 3221 | |
| 3222 | // Links an enum field to a MiniTable for that enum. |
| 3223 | // All enum fields must be linked prior to parsing. |
| 3224 | // Returns success/failure. |
| 3225 | UPB_API bool upb_MiniTable_SetSubEnum(upb_MiniTable* table, |
| 3226 | upb_MiniTableField* field, |
| 3227 | const upb_MiniTableEnum* sub); |
| 3228 | |
| 3229 | // Returns a list of fields that require linking at runtime, to connect the |
| 3230 | // MiniTable to its sub-messages and sub-enums. The list of fields will be |
| 3231 | // written to the `subs` array, which must have been allocated by the caller |
| 3232 | // and must be large enough to hold a list of all fields in the message. |
| 3233 | // |
| 3234 | // The order of the fields returned by this function is significant: it matches |
| 3235 | // the order expected by upb_MiniTable_Link() below. |
| 3236 | // |
| 3237 | // The return value packs the sub-message count and sub-enum count into a single |
| 3238 | // integer like so: |
| 3239 | // return (msg_count << 16) | enum_count; |
| 3240 | UPB_API uint32_t upb_MiniTable_GetSubList(const upb_MiniTable* mt, |
| 3241 | const upb_MiniTableField** subs); |
| 3242 | |
| 3243 | // Links a message to its sub-messages and sub-enums. The caller must pass |
| 3244 | // arrays of sub-tables and sub-enums, in the same length and order as is |
| 3245 | // returned by upb_MiniTable_GetSubList() above. However, individual elements |
| 3246 | // of the sub_tables may be NULL if those sub-messages were tree shaken. |
| 3247 | // |
| 3248 | // Returns false if either array is too short, or if any of the tables fails |
| 3249 | // to link. |
| 3250 | UPB_API bool upb_MiniTable_Link(upb_MiniTable* mt, |
| 3251 | const upb_MiniTable** sub_tables, |
| 3252 | size_t sub_table_count, |
| 3253 | const upb_MiniTableEnum** sub_enums, |
| 3254 | size_t sub_enum_count); |
| 3255 | |
| 3256 | #ifdef __cplusplus |
| 3257 | } /* extern "C" */ |
| 3258 | #endif |
| 3259 | |
| 3260 | |
| 3261 | #endif // UPB_MINI_DESCRIPTOR_LINK_H_ |
| 3262 | // IWYU pragma: end_exports |
| 3263 | |
| 3264 | // Must be last. |
| 3265 | |
| 3266 | typedef enum { |
| 3267 | kUpb_MiniTablePlatform_32Bit, |
| 3268 | kUpb_MiniTablePlatform_64Bit, |
| 3269 | kUpb_MiniTablePlatform_Native = |
| 3270 | UPB_SIZE(kUpb_MiniTablePlatform_32Bit, kUpb_MiniTablePlatform_64Bit), |
| 3271 | } upb_MiniTablePlatform; |
| 3272 | |
| 3273 | #ifdef __cplusplus |
| 3274 | extern "C" { |
| 3275 | #endif |
| 3276 | |
| 3277 | // Builds a mini table from the data encoded in the buffer [data, len]. If any |
| 3278 | // errors occur, returns NULL and sets a status message. In the success case, |
| 3279 | // the caller must call upb_MiniTable_SetSub*() for all message or proto2 enum |
| 3280 | // fields to link the table to the appropriate sub-tables. |
| 3281 | upb_MiniTable* _upb_MiniTable_Build(const char* data, size_t len, |
| 3282 | upb_MiniTablePlatform platform, |
| 3283 | upb_Arena* arena, upb_Status* status); |
| 3284 | |
| 3285 | UPB_API_INLINE upb_MiniTable* upb_MiniTable_Build(const char* data, size_t len, |
| 3286 | upb_Arena* arena, |
| 3287 | upb_Status* status) { |
| 3288 | return _upb_MiniTable_Build(data, len, kUpb_MiniTablePlatform_Native, arena, |
| 3289 | status); |
| 3290 | } |
| 3291 | |
| 3292 | // Initializes a MiniTableExtension buffer that has already been allocated. |
| 3293 | // This is needed by upb_FileDef and upb_MessageDef, which allocate all of the |
| 3294 | // extensions together in a single contiguous array. |
| 3295 | const char* _upb_MiniTableExtension_Init(const char* data, size_t len, |
| 3296 | upb_MiniTableExtension* ext, |
| 3297 | const upb_MiniTable* extendee, |
| 3298 | upb_MiniTableSub sub, |
| 3299 | upb_MiniTablePlatform platform, |
| 3300 | upb_Status* status); |
| 3301 | |
| 3302 | UPB_API_INLINE const char* upb_MiniTableExtension_Init( |
| 3303 | const char* data, size_t len, upb_MiniTableExtension* ext, |
| 3304 | const upb_MiniTable* extendee, upb_MiniTableSub sub, upb_Status* status) { |
| 3305 | return _upb_MiniTableExtension_Init(data, len, ext, extendee, sub, |
| 3306 | kUpb_MiniTablePlatform_Native, status); |
| 3307 | } |
| 3308 | |
| 3309 | UPB_API upb_MiniTableExtension* _upb_MiniTableExtension_Build( |
| 3310 | const char* data, size_t len, const upb_MiniTable* extendee, |
| 3311 | upb_MiniTableSub sub, upb_MiniTablePlatform platform, upb_Arena* arena, |
| 3312 | upb_Status* status); |
| 3313 | |
| 3314 | UPB_API_INLINE upb_MiniTableExtension* upb_MiniTableExtension_Build( |
| 3315 | const char* data, size_t len, const upb_MiniTable* extendee, |
| 3316 | upb_Arena* arena, upb_Status* status) { |
| 3317 | upb_MiniTableSub sub; |
| 3318 | sub.submsg = NULL; |
| 3319 | return _upb_MiniTableExtension_Build( |
| 3320 | data, len, extendee, sub, kUpb_MiniTablePlatform_Native, arena, status); |
| 3321 | } |
| 3322 | |
| 3323 | UPB_API_INLINE upb_MiniTableExtension* upb_MiniTableExtension_BuildMessage( |
| 3324 | const char* data, size_t len, const upb_MiniTable* extendee, |
| 3325 | upb_MiniTable* submsg, upb_Arena* arena, upb_Status* status) { |
| 3326 | upb_MiniTableSub sub; |
| 3327 | sub.submsg = submsg; |
| 3328 | return _upb_MiniTableExtension_Build( |
| 3329 | data, len, extendee, sub, kUpb_MiniTablePlatform_Native, arena, status); |
| 3330 | } |
| 3331 | |
| 3332 | UPB_API_INLINE upb_MiniTableExtension* upb_MiniTableExtension_BuildEnum( |
| 3333 | const char* data, size_t len, const upb_MiniTable* extendee, |
| 3334 | upb_MiniTableEnum* subenum, upb_Arena* arena, upb_Status* status) { |
| 3335 | upb_MiniTableSub sub; |
| 3336 | sub.subenum = subenum; |
| 3337 | return _upb_MiniTableExtension_Build( |
| 3338 | data, len, extendee, sub, kUpb_MiniTablePlatform_Native, arena, status); |
| 3339 | } |
| 3340 | |
| 3341 | // Like upb_MiniTable_Build(), but the user provides a buffer of layout data so |
| 3342 | // it can be reused from call to call, avoiding repeated realloc()/free(). |
| 3343 | // |
| 3344 | // The caller owns `*buf` both before and after the call, and must free() it |
| 3345 | // when it is no longer in use. The function will realloc() `*buf` as |
| 3346 | // necessary, updating `*size` accordingly. |
| 3347 | upb_MiniTable* upb_MiniTable_BuildWithBuf(const char* data, size_t len, |
| 3348 | upb_MiniTablePlatform platform, |
| 3349 | upb_Arena* arena, void** buf, |
| 3350 | size_t* buf_size, upb_Status* status); |
| 3351 | |
| 3352 | #ifdef __cplusplus |
| 3353 | } /* extern "C" */ |
| 3354 | #endif |
| 3355 | |
| 3356 | |
| 3357 | #endif /* UPB_MINI_TABLE_DECODE_H_ */ |
| 3358 | |
| 3359 | #ifndef UPB_MINI_TABLE_FILE_H_ |
| 3360 | #define UPB_MINI_TABLE_FILE_H_ |
| 3361 | |
| 3362 | |
| 3363 | #ifndef UPB_MINI_TABLE_INTERNAL_FILE_H_ |
| 3364 | #define UPB_MINI_TABLE_INTERNAL_FILE_H_ |
| 3365 | |
| 3366 | |
| 3367 | // Must be last. |
| 3368 | |
| 3369 | struct upb_MiniTableFile { |
Sandy Zhang | e3b0943 | 2023-08-07 09:30:02 -0700 | [diff] [blame] | 3370 | const struct upb_MiniTable** msgs; |
| 3371 | const struct upb_MiniTableEnum** enums; |
| 3372 | const struct upb_MiniTableExtension** exts; |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 3373 | int msg_count; |
| 3374 | int enum_count; |
| 3375 | int ext_count; |
| 3376 | }; |
| 3377 | |
| 3378 | |
| 3379 | #endif /* UPB_MINI_TABLE_INTERNAL_FILE_H_ */ |
| 3380 | |
| 3381 | typedef struct upb_MiniTableFile upb_MiniTableFile; |
| 3382 | |
| 3383 | #endif /* UPB_MINI_TABLE_FILE_H_ */ |
| 3384 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 3385 | // upb_decode: parsing into a upb_Message using a upb_MiniTable. |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3386 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 3387 | #ifndef UPB_WIRE_DECODE_H_ |
| 3388 | #define UPB_WIRE_DECODE_H_ |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3389 | |
Protobuf Team Bot | 743bf92 | 2023-09-14 01:12:11 +0000 | [diff] [blame] | 3390 | #include <stddef.h> |
| 3391 | #include <stdint.h> |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3392 | |
Adam Cozzette | 7d5592e | 2023-08-23 12:15:26 -0700 | [diff] [blame] | 3393 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3394 | // Must be last. |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3395 | |
| 3396 | #ifdef __cplusplus |
| 3397 | extern "C" { |
| 3398 | #endif |
| 3399 | |
| 3400 | enum { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3401 | /* If set, strings will alias the input buffer instead of copying into the |
| 3402 | * arena. */ |
| 3403 | kUpb_DecodeOption_AliasString = 1, |
| 3404 | |
| 3405 | /* If set, the parse will return failure if any message is missing any |
| 3406 | * required fields when the message data ends. The parse will still continue, |
| 3407 | * and the failure will only be reported at the end. |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3408 | * |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3409 | * IMPORTANT CAVEATS: |
| 3410 | * |
| 3411 | * 1. This can throw a false positive failure if an incomplete message is seen |
| 3412 | * on the wire but is later completed when the sub-message occurs again. |
| 3413 | * For this reason, a second pass is required to verify a failure, to be |
| 3414 | * truly robust. |
| 3415 | * |
| 3416 | * 2. This can return a false success if you are decoding into a message that |
| 3417 | * already has some sub-message fields present. If the sub-message does |
| 3418 | * not occur in the binary payload, we will never visit it and discover the |
| 3419 | * incomplete sub-message. For this reason, this check is only useful for |
| 3420 | * implemting ParseFromString() semantics. For MergeFromString(), a |
| 3421 | * post-parse validation step will always be necessary. */ |
| 3422 | kUpb_DecodeOption_CheckRequired = 2, |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 3423 | |
| 3424 | /* EXPERIMENTAL: |
| 3425 | * |
| 3426 | * If set, the parser will allow parsing of sub-message fields that were not |
| 3427 | * previously linked using upb_MiniTable_SetSubMessage(). The data will be |
| 3428 | * parsed into an internal "empty" message type that cannot be accessed |
| 3429 | * directly, but can be later promoted into the true message type if the |
| 3430 | * sub-message fields are linked at a later time. |
| 3431 | * |
| 3432 | * Users should set this option if they intend to perform dynamic tree shaking |
| 3433 | * and promoting using the interfaces in message/promote.h. If this option is |
| 3434 | * enabled, it is important that the resulting messages are only accessed by |
| 3435 | * code that is aware of promotion rules: |
| 3436 | * |
| 3437 | * 1. Message pointers in upb_Message, upb_Array, and upb_Map are represented |
| 3438 | * by a tagged pointer upb_TaggedMessagePointer. The tag indicates whether |
| 3439 | * the message uses the internal "empty" type. |
| 3440 | * |
| 3441 | * 2. Any code *reading* these message pointers must test whether the "empty" |
| 3442 | * tag bit is set, using the interfaces in mini_table/types.h. However |
| 3443 | * writing of message pointers should always use plain upb_Message*, since |
| 3444 | * users are not allowed to create "empty" messages. |
| 3445 | * |
| 3446 | * 3. It is always safe to test whether a field is present or test the array |
| 3447 | * length; these interfaces will reflect that empty messages are present, |
| 3448 | * even though their data cannot be accessed without promoting first. |
| 3449 | * |
| 3450 | * 4. If a message pointer is indeed tagged as empty, the message may not be |
| 3451 | * accessed directly, only promoted through the interfaces in |
| 3452 | * message/promote.h. |
| 3453 | * |
| 3454 | * 5. Tagged/empty messages may never be created by the user. They may only |
| 3455 | * be created by the parser or the message-copying logic in message/copy.h. |
| 3456 | */ |
| 3457 | kUpb_DecodeOption_ExperimentalAllowUnlinked = 4, |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3458 | }; |
| 3459 | |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 3460 | UPB_INLINE uint32_t upb_DecodeOptions_MaxDepth(uint16_t depth) { |
| 3461 | return (uint32_t)depth << 16; |
| 3462 | } |
| 3463 | |
| 3464 | UPB_INLINE uint16_t upb_DecodeOptions_GetMaxDepth(uint32_t options) { |
| 3465 | return options >> 16; |
| 3466 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3467 | |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 3468 | // Enforce an upper bound on recursion depth. |
| 3469 | UPB_INLINE int upb_Decode_LimitDepth(uint32_t decode_options, uint32_t limit) { |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 3470 | uint32_t max_depth = upb_DecodeOptions_GetMaxDepth(decode_options); |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 3471 | if (max_depth > limit) max_depth = limit; |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 3472 | return upb_DecodeOptions_MaxDepth(max_depth) | (decode_options & 0xffff); |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 3473 | } |
| 3474 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3475 | typedef enum { |
| 3476 | kUpb_DecodeStatus_Ok = 0, |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 3477 | kUpb_DecodeStatus_Malformed = 1, // Wire format was corrupt |
| 3478 | kUpb_DecodeStatus_OutOfMemory = 2, // Arena alloc failed |
| 3479 | kUpb_DecodeStatus_BadUtf8 = 3, // String field had bad UTF-8 |
| 3480 | kUpb_DecodeStatus_MaxDepthExceeded = |
| 3481 | 4, // Exceeded upb_DecodeOptions_MaxDepth |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3482 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3483 | // kUpb_DecodeOption_CheckRequired failed (see above), but the parse otherwise |
| 3484 | // succeeded. |
| 3485 | kUpb_DecodeStatus_MissingRequired = 5, |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 3486 | |
| 3487 | // Unlinked sub-message field was present, but |
| 3488 | // kUpb_DecodeOptions_ExperimentalAllowUnlinked was not specified in the list |
| 3489 | // of options. |
| 3490 | kUpb_DecodeStatus_UnlinkedSubMessage = 6, |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3491 | } upb_DecodeStatus; |
| 3492 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 3493 | UPB_API upb_DecodeStatus upb_Decode(const char* buf, size_t size, |
| 3494 | upb_Message* msg, const upb_MiniTable* l, |
| 3495 | const upb_ExtensionRegistry* extreg, |
| 3496 | int options, upb_Arena* arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3497 | |
| 3498 | #ifdef __cplusplus |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 3499 | } /* extern "C" */ |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3500 | #endif |
| 3501 | |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 3502 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 3503 | #endif /* UPB_WIRE_DECODE_H_ */ |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3504 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3505 | // These are the specialized field parser functions for the fast parser. |
| 3506 | // Generated tables will refer to these by name. |
| 3507 | // |
| 3508 | // The function names are encoded with names like: |
| 3509 | // |
| 3510 | // // 123 4 |
| 3511 | // upb_pss_1bt(); // Parse singular string, 1 byte tag. |
| 3512 | // |
| 3513 | // In position 1: |
| 3514 | // - 'p' for parse, most function use this |
| 3515 | // - 'c' for copy, for when we are copying strings instead of aliasing |
| 3516 | // |
| 3517 | // In position 2 (cardinality): |
| 3518 | // - 's' for singular, with or without hasbit |
| 3519 | // - 'o' for oneof |
| 3520 | // - 'r' for non-packed repeated |
| 3521 | // - 'p' for packed repeated |
| 3522 | // |
| 3523 | // In position 3 (type): |
| 3524 | // - 'b1' for bool |
| 3525 | // - 'v4' for 4-byte varint |
| 3526 | // - 'v8' for 8-byte varint |
| 3527 | // - 'z4' for zig-zag-encoded 4-byte varint |
| 3528 | // - 'z8' for zig-zag-encoded 8-byte varint |
| 3529 | // - 'f4' for 4-byte fixed |
| 3530 | // - 'f8' for 8-byte fixed |
| 3531 | // - 'm' for sub-message |
| 3532 | // - 's' for string (validate UTF-8) |
| 3533 | // - 'b' for bytes |
| 3534 | // |
| 3535 | // In position 4 (tag length): |
| 3536 | // - '1' for one-byte tags (field numbers 1-15) |
| 3537 | // - '2' for two-byte tags (field numbers 16-2048) |
| 3538 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 3539 | #ifndef UPB_WIRE_DECODE_FAST_H_ |
| 3540 | #define UPB_WIRE_DECODE_FAST_H_ |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3541 | |
| 3542 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3543 | // Must be last. |
| 3544 | |
| 3545 | #ifdef __cplusplus |
| 3546 | extern "C" { |
| 3547 | #endif |
| 3548 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 3549 | struct upb_Decoder; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3550 | |
| 3551 | // The fallback, generic parsing function that can handle any field type. |
| 3552 | // This just uses the regular (non-fast) parser to parse a single field. |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3553 | const char* _upb_FastDecoder_DecodeGeneric(struct upb_Decoder* d, |
| 3554 | const char* ptr, upb_Message* msg, |
| 3555 | intptr_t table, uint64_t hasbits, |
| 3556 | uint64_t data); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3557 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 3558 | #define UPB_PARSE_PARAMS \ |
| 3559 | struct upb_Decoder *d, const char *ptr, upb_Message *msg, intptr_t table, \ |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3560 | uint64_t hasbits, uint64_t data |
| 3561 | |
| 3562 | /* primitive fields ***********************************************************/ |
| 3563 | |
| 3564 | #define F(card, type, valbytes, tagbytes) \ |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 3565 | const char* upb_p##card##type##valbytes##_##tagbytes##bt(UPB_PARSE_PARAMS); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3566 | |
| 3567 | #define TYPES(card, tagbytes) \ |
| 3568 | F(card, b, 1, tagbytes) \ |
| 3569 | F(card, v, 4, tagbytes) \ |
| 3570 | F(card, v, 8, tagbytes) \ |
| 3571 | F(card, z, 4, tagbytes) \ |
| 3572 | F(card, z, 8, tagbytes) \ |
| 3573 | F(card, f, 4, tagbytes) \ |
| 3574 | F(card, f, 8, tagbytes) |
| 3575 | |
| 3576 | #define TAGBYTES(card) \ |
| 3577 | TYPES(card, 1) \ |
| 3578 | TYPES(card, 2) |
| 3579 | |
| 3580 | TAGBYTES(s) |
| 3581 | TAGBYTES(o) |
| 3582 | TAGBYTES(r) |
| 3583 | TAGBYTES(p) |
| 3584 | |
| 3585 | #undef F |
| 3586 | #undef TYPES |
| 3587 | #undef TAGBYTES |
| 3588 | |
| 3589 | /* string fields **************************************************************/ |
| 3590 | |
| 3591 | #define F(card, tagbytes, type) \ |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 3592 | const char* upb_p##card##type##_##tagbytes##bt(UPB_PARSE_PARAMS); \ |
| 3593 | const char* upb_c##card##type##_##tagbytes##bt(UPB_PARSE_PARAMS); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3594 | |
| 3595 | #define UTF8(card, tagbytes) \ |
| 3596 | F(card, tagbytes, s) \ |
| 3597 | F(card, tagbytes, b) |
| 3598 | |
| 3599 | #define TAGBYTES(card) \ |
| 3600 | UTF8(card, 1) \ |
| 3601 | UTF8(card, 2) |
| 3602 | |
| 3603 | TAGBYTES(s) |
| 3604 | TAGBYTES(o) |
| 3605 | TAGBYTES(r) |
| 3606 | |
| 3607 | #undef F |
| 3608 | #undef TAGBYTES |
| 3609 | |
| 3610 | /* sub-message fields *********************************************************/ |
| 3611 | |
| 3612 | #define F(card, tagbytes, size_ceil, ceil_arg) \ |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 3613 | const char* upb_p##card##m_##tagbytes##bt_max##size_ceil##b(UPB_PARSE_PARAMS); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3614 | |
| 3615 | #define SIZES(card, tagbytes) \ |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 3616 | F(card, tagbytes, 64, 64) \ |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3617 | F(card, tagbytes, 128, 128) \ |
| 3618 | F(card, tagbytes, 192, 192) \ |
| 3619 | F(card, tagbytes, 256, 256) \ |
| 3620 | F(card, tagbytes, max, -1) |
| 3621 | |
| 3622 | #define TAGBYTES(card) \ |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 3623 | SIZES(card, 1) \ |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3624 | SIZES(card, 2) |
| 3625 | |
| 3626 | TAGBYTES(s) |
| 3627 | TAGBYTES(o) |
| 3628 | TAGBYTES(r) |
| 3629 | |
| 3630 | #undef TAGBYTES |
| 3631 | #undef SIZES |
| 3632 | #undef F |
| 3633 | |
| 3634 | #undef UPB_PARSE_PARAMS |
| 3635 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3636 | #ifdef __cplusplus |
| 3637 | } /* extern "C" */ |
| 3638 | #endif |
| 3639 | |
| 3640 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 3641 | #endif /* UPB_WIRE_DECODE_FAST_H_ */ |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 3642 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 3643 | // upb_Encode: parsing from a upb_Message using a upb_MiniTable. |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3644 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 3645 | #ifndef UPB_WIRE_ENCODE_H_ |
| 3646 | #define UPB_WIRE_ENCODE_H_ |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3647 | |
Protobuf Team Bot | 743bf92 | 2023-09-14 01:12:11 +0000 | [diff] [blame] | 3648 | #include <stddef.h> |
| 3649 | #include <stdint.h> |
| 3650 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3651 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3652 | // Must be last. |
| 3653 | |
| 3654 | #ifdef __cplusplus |
| 3655 | extern "C" { |
| 3656 | #endif |
| 3657 | |
| 3658 | enum { |
| 3659 | /* If set, the results of serializing will be deterministic across all |
| 3660 | * instances of this binary. There are no guarantees across different |
| 3661 | * binary builds. |
| 3662 | * |
| 3663 | * If your proto contains maps, the encoder will need to malloc()/free() |
| 3664 | * memory during encode. */ |
| 3665 | kUpb_EncodeOption_Deterministic = 1, |
| 3666 | |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 3667 | // When set, unknown fields are not printed. |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3668 | kUpb_EncodeOption_SkipUnknown = 2, |
| 3669 | |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 3670 | // When set, the encode will fail if any required fields are missing. |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3671 | kUpb_EncodeOption_CheckRequired = 4, |
| 3672 | }; |
| 3673 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3674 | typedef enum { |
| 3675 | kUpb_EncodeStatus_Ok = 0, |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 3676 | kUpb_EncodeStatus_OutOfMemory = 1, // Arena alloc failed |
| 3677 | kUpb_EncodeStatus_MaxDepthExceeded = 2, |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3678 | |
| 3679 | // kUpb_EncodeOption_CheckRequired failed but the parse otherwise succeeded. |
| 3680 | kUpb_EncodeStatus_MissingRequired = 3, |
| 3681 | } upb_EncodeStatus; |
| 3682 | |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 3683 | UPB_INLINE uint32_t upb_EncodeOptions_MaxDepth(uint16_t depth) { |
| 3684 | return (uint32_t)depth << 16; |
| 3685 | } |
| 3686 | |
| 3687 | UPB_INLINE uint16_t upb_EncodeOptions_GetMaxDepth(uint32_t options) { |
| 3688 | return options >> 16; |
| 3689 | } |
| 3690 | |
| 3691 | // Enforce an upper bound on recursion depth. |
| 3692 | UPB_INLINE int upb_Encode_LimitDepth(uint32_t encode_options, uint32_t limit) { |
| 3693 | uint32_t max_depth = upb_EncodeOptions_GetMaxDepth(encode_options); |
| 3694 | if (max_depth > limit) max_depth = limit; |
| 3695 | return upb_EncodeOptions_MaxDepth(max_depth) | (encode_options & 0xffff); |
| 3696 | } |
| 3697 | |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 3698 | UPB_API upb_EncodeStatus upb_Encode(const void* msg, const upb_MiniTable* l, |
| 3699 | int options, upb_Arena* arena, char** buf, |
| 3700 | size_t* size); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3701 | |
| 3702 | #ifdef __cplusplus |
| 3703 | } /* extern "C" */ |
| 3704 | #endif |
| 3705 | |
| 3706 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 3707 | #endif /* UPB_WIRE_ENCODE_H_ */ |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 3708 | // IWYU pragma: end_exports |
| 3709 | |
| 3710 | #endif // UPB_GENERATED_CODE_SUPPORT_H_ |
| 3711 | /* This file was generated by upbc (the upb compiler) from the input |
| 3712 | * file: |
| 3713 | * |
| 3714 | * google/protobuf/descriptor.proto |
| 3715 | * |
| 3716 | * Do not edit -- your changes will be discarded when the file is |
| 3717 | * regenerated. */ |
| 3718 | |
Protobuf Team Bot | d11eb71 | 2023-09-15 00:25:33 +0000 | [diff] [blame] | 3719 | #ifndef GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_MINITABLE_H_ |
| 3720 | #define GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_MINITABLE_H_ |
| 3721 | |
| 3722 | |
| 3723 | // Must be last. |
| 3724 | |
| 3725 | #ifdef __cplusplus |
| 3726 | extern "C" { |
| 3727 | #endif |
| 3728 | |
| 3729 | extern const upb_MiniTable google_protobuf_FileDescriptorSet_msg_init; |
| 3730 | extern const upb_MiniTable google_protobuf_FileDescriptorProto_msg_init; |
| 3731 | extern const upb_MiniTable google_protobuf_DescriptorProto_msg_init; |
| 3732 | extern const upb_MiniTable google_protobuf_DescriptorProto_ExtensionRange_msg_init; |
| 3733 | extern const upb_MiniTable google_protobuf_DescriptorProto_ReservedRange_msg_init; |
| 3734 | extern const upb_MiniTable google_protobuf_ExtensionRangeOptions_msg_init; |
| 3735 | extern const upb_MiniTable google_protobuf_ExtensionRangeOptions_Declaration_msg_init; |
| 3736 | extern const upb_MiniTable google_protobuf_FieldDescriptorProto_msg_init; |
| 3737 | extern const upb_MiniTable google_protobuf_OneofDescriptorProto_msg_init; |
| 3738 | extern const upb_MiniTable google_protobuf_EnumDescriptorProto_msg_init; |
| 3739 | extern const upb_MiniTable google_protobuf_EnumDescriptorProto_EnumReservedRange_msg_init; |
| 3740 | extern const upb_MiniTable google_protobuf_EnumValueDescriptorProto_msg_init; |
| 3741 | extern const upb_MiniTable google_protobuf_ServiceDescriptorProto_msg_init; |
| 3742 | extern const upb_MiniTable google_protobuf_MethodDescriptorProto_msg_init; |
| 3743 | extern const upb_MiniTable google_protobuf_FileOptions_msg_init; |
| 3744 | extern const upb_MiniTable google_protobuf_MessageOptions_msg_init; |
| 3745 | extern const upb_MiniTable google_protobuf_FieldOptions_msg_init; |
| 3746 | extern const upb_MiniTable google_protobuf_FieldOptions_EditionDefault_msg_init; |
| 3747 | extern const upb_MiniTable google_protobuf_OneofOptions_msg_init; |
| 3748 | extern const upb_MiniTable google_protobuf_EnumOptions_msg_init; |
| 3749 | extern const upb_MiniTable google_protobuf_EnumValueOptions_msg_init; |
| 3750 | extern const upb_MiniTable google_protobuf_ServiceOptions_msg_init; |
| 3751 | extern const upb_MiniTable google_protobuf_MethodOptions_msg_init; |
| 3752 | extern const upb_MiniTable google_protobuf_UninterpretedOption_msg_init; |
| 3753 | extern const upb_MiniTable google_protobuf_UninterpretedOption_NamePart_msg_init; |
| 3754 | extern const upb_MiniTable google_protobuf_FeatureSet_msg_init; |
| 3755 | extern const upb_MiniTable google_protobuf_FeatureSetDefaults_msg_init; |
| 3756 | extern const upb_MiniTable google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_msg_init; |
| 3757 | extern const upb_MiniTable google_protobuf_SourceCodeInfo_msg_init; |
| 3758 | extern const upb_MiniTable google_protobuf_SourceCodeInfo_Location_msg_init; |
| 3759 | extern const upb_MiniTable google_protobuf_GeneratedCodeInfo_msg_init; |
| 3760 | extern const upb_MiniTable google_protobuf_GeneratedCodeInfo_Annotation_msg_init; |
| 3761 | |
| 3762 | extern const upb_MiniTableEnum google_protobuf_Edition_enum_init; |
| 3763 | extern const upb_MiniTableEnum google_protobuf_ExtensionRangeOptions_VerificationState_enum_init; |
| 3764 | extern const upb_MiniTableEnum google_protobuf_FeatureSet_EnumType_enum_init; |
| 3765 | extern const upb_MiniTableEnum google_protobuf_FeatureSet_FieldPresence_enum_init; |
| 3766 | extern const upb_MiniTableEnum google_protobuf_FeatureSet_JsonFormat_enum_init; |
| 3767 | extern const upb_MiniTableEnum google_protobuf_FeatureSet_MessageEncoding_enum_init; |
| 3768 | extern const upb_MiniTableEnum google_protobuf_FeatureSet_RepeatedFieldEncoding_enum_init; |
| 3769 | extern const upb_MiniTableEnum google_protobuf_FieldDescriptorProto_Label_enum_init; |
| 3770 | extern const upb_MiniTableEnum google_protobuf_FieldDescriptorProto_Type_enum_init; |
| 3771 | extern const upb_MiniTableEnum google_protobuf_FieldOptions_CType_enum_init; |
| 3772 | extern const upb_MiniTableEnum google_protobuf_FieldOptions_JSType_enum_init; |
| 3773 | extern const upb_MiniTableEnum google_protobuf_FieldOptions_OptionRetention_enum_init; |
| 3774 | extern const upb_MiniTableEnum google_protobuf_FieldOptions_OptionTargetType_enum_init; |
| 3775 | extern const upb_MiniTableEnum google_protobuf_FileOptions_OptimizeMode_enum_init; |
| 3776 | extern const upb_MiniTableEnum google_protobuf_GeneratedCodeInfo_Annotation_Semantic_enum_init; |
| 3777 | extern const upb_MiniTableEnum google_protobuf_MethodOptions_IdempotencyLevel_enum_init; |
| 3778 | extern const upb_MiniTableFile google_protobuf_descriptor_proto_upb_file_layout; |
| 3779 | |
| 3780 | #ifdef __cplusplus |
| 3781 | } /* extern "C" */ |
| 3782 | #endif |
| 3783 | |
| 3784 | |
| 3785 | #endif /* GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_MINITABLE_H_ */ |
| 3786 | |
| 3787 | #ifndef UPB_WIRE_EPS_COPY_INPUT_STREAM_H_ |
| 3788 | #define UPB_WIRE_EPS_COPY_INPUT_STREAM_H_ |
| 3789 | |
| 3790 | #include <string.h> |
| 3791 | |
| 3792 | |
| 3793 | // Must be last. |
| 3794 | |
| 3795 | #ifdef __cplusplus |
| 3796 | extern "C" { |
| 3797 | #endif |
| 3798 | |
| 3799 | // The maximum number of bytes a single protobuf field can take up in the |
| 3800 | // wire format. We only want to do one bounds check per field, so the input |
| 3801 | // stream guarantees that after upb_EpsCopyInputStream_IsDone() is called, |
| 3802 | // the decoder can read this many bytes without performing another bounds |
| 3803 | // check. The stream will copy into a patch buffer as necessary to guarantee |
| 3804 | // this invariant. |
| 3805 | #define kUpb_EpsCopyInputStream_SlopBytes 16 |
| 3806 | |
| 3807 | enum { |
| 3808 | kUpb_EpsCopyInputStream_NoAliasing = 0, |
| 3809 | kUpb_EpsCopyInputStream_OnPatch = 1, |
| 3810 | kUpb_EpsCopyInputStream_NoDelta = 2 |
| 3811 | }; |
| 3812 | |
| 3813 | typedef struct { |
| 3814 | const char* end; // Can read up to SlopBytes bytes beyond this. |
| 3815 | const char* limit_ptr; // For bounds checks, = end + UPB_MIN(limit, 0) |
| 3816 | uintptr_t aliasing; |
| 3817 | int limit; // Submessage limit relative to end |
| 3818 | bool error; // To distinguish between EOF and error. |
| 3819 | char patch[kUpb_EpsCopyInputStream_SlopBytes * 2]; |
| 3820 | } upb_EpsCopyInputStream; |
| 3821 | |
| 3822 | // Returns true if the stream is in the error state. A stream enters the error |
| 3823 | // state when the user reads past a limit (caught in IsDone()) or the |
| 3824 | // ZeroCopyInputStream returns an error. |
| 3825 | UPB_INLINE bool upb_EpsCopyInputStream_IsError(upb_EpsCopyInputStream* e) { |
| 3826 | return e->error; |
| 3827 | } |
| 3828 | |
| 3829 | typedef const char* upb_EpsCopyInputStream_BufferFlipCallback( |
| 3830 | upb_EpsCopyInputStream* e, const char* old_end, const char* new_start); |
| 3831 | |
| 3832 | typedef const char* upb_EpsCopyInputStream_IsDoneFallbackFunc( |
| 3833 | upb_EpsCopyInputStream* e, const char* ptr, int overrun); |
| 3834 | |
| 3835 | // Initializes a upb_EpsCopyInputStream using the contents of the buffer |
| 3836 | // [*ptr, size]. Updates `*ptr` as necessary to guarantee that at least |
| 3837 | // kUpb_EpsCopyInputStream_SlopBytes are available to read. |
| 3838 | UPB_INLINE void upb_EpsCopyInputStream_Init(upb_EpsCopyInputStream* e, |
| 3839 | const char** ptr, size_t size, |
| 3840 | bool enable_aliasing) { |
| 3841 | if (size <= kUpb_EpsCopyInputStream_SlopBytes) { |
| 3842 | memset(&e->patch, 0, 32); |
| 3843 | if (size) memcpy(&e->patch, *ptr, size); |
| 3844 | e->aliasing = enable_aliasing ? (uintptr_t)*ptr - (uintptr_t)e->patch |
| 3845 | : kUpb_EpsCopyInputStream_NoAliasing; |
| 3846 | *ptr = e->patch; |
| 3847 | e->end = *ptr + size; |
| 3848 | e->limit = 0; |
| 3849 | } else { |
| 3850 | e->end = *ptr + size - kUpb_EpsCopyInputStream_SlopBytes; |
| 3851 | e->limit = kUpb_EpsCopyInputStream_SlopBytes; |
| 3852 | e->aliasing = enable_aliasing ? kUpb_EpsCopyInputStream_NoDelta |
| 3853 | : kUpb_EpsCopyInputStream_NoAliasing; |
| 3854 | } |
| 3855 | e->limit_ptr = e->end; |
| 3856 | e->error = false; |
| 3857 | } |
| 3858 | |
| 3859 | typedef enum { |
| 3860 | // The current stream position is at a limit. |
| 3861 | kUpb_IsDoneStatus_Done, |
| 3862 | |
| 3863 | // The current stream position is not at a limit. |
| 3864 | kUpb_IsDoneStatus_NotDone, |
| 3865 | |
| 3866 | // The current stream position is not at a limit, and the stream needs to |
| 3867 | // be flipped to a new buffer before more data can be read. |
| 3868 | kUpb_IsDoneStatus_NeedFallback, |
| 3869 | } upb_IsDoneStatus; |
| 3870 | |
| 3871 | // Returns the status of the current stream position. This is a low-level |
| 3872 | // function, it is simpler to call upb_EpsCopyInputStream_IsDone() if possible. |
| 3873 | UPB_INLINE upb_IsDoneStatus upb_EpsCopyInputStream_IsDoneStatus( |
| 3874 | upb_EpsCopyInputStream* e, const char* ptr, int* overrun) { |
| 3875 | *overrun = ptr - e->end; |
| 3876 | if (UPB_LIKELY(ptr < e->limit_ptr)) { |
| 3877 | return kUpb_IsDoneStatus_NotDone; |
| 3878 | } else if (UPB_LIKELY(*overrun == e->limit)) { |
| 3879 | return kUpb_IsDoneStatus_Done; |
| 3880 | } else { |
| 3881 | return kUpb_IsDoneStatus_NeedFallback; |
| 3882 | } |
| 3883 | } |
| 3884 | |
| 3885 | // Returns true if the stream has hit a limit, either the current delimited |
| 3886 | // limit or the overall end-of-stream. As a side effect, this function may flip |
| 3887 | // the pointer to a new buffer if there are less than |
| 3888 | // kUpb_EpsCopyInputStream_SlopBytes of data to be read in the current buffer. |
| 3889 | // |
| 3890 | // Postcondition: if the function returns false, there are at least |
| 3891 | // kUpb_EpsCopyInputStream_SlopBytes of data available to read at *ptr. |
| 3892 | UPB_INLINE bool upb_EpsCopyInputStream_IsDoneWithCallback( |
| 3893 | upb_EpsCopyInputStream* e, const char** ptr, |
| 3894 | upb_EpsCopyInputStream_IsDoneFallbackFunc* func) { |
| 3895 | int overrun; |
| 3896 | switch (upb_EpsCopyInputStream_IsDoneStatus(e, *ptr, &overrun)) { |
| 3897 | case kUpb_IsDoneStatus_Done: |
| 3898 | return true; |
| 3899 | case kUpb_IsDoneStatus_NotDone: |
| 3900 | return false; |
| 3901 | case kUpb_IsDoneStatus_NeedFallback: |
| 3902 | *ptr = func(e, *ptr, overrun); |
| 3903 | return *ptr == NULL; |
| 3904 | } |
| 3905 | UPB_UNREACHABLE(); |
| 3906 | } |
| 3907 | |
| 3908 | const char* _upb_EpsCopyInputStream_IsDoneFallbackNoCallback( |
| 3909 | upb_EpsCopyInputStream* e, const char* ptr, int overrun); |
| 3910 | |
| 3911 | // A simpler version of IsDoneWithCallback() that does not support a buffer flip |
| 3912 | // callback. Useful in cases where we do not need to insert custom logic at |
| 3913 | // every buffer flip. |
| 3914 | // |
| 3915 | // If this returns true, the user must call upb_EpsCopyInputStream_IsError() |
| 3916 | // to distinguish between EOF and error. |
| 3917 | UPB_INLINE bool upb_EpsCopyInputStream_IsDone(upb_EpsCopyInputStream* e, |
| 3918 | const char** ptr) { |
| 3919 | return upb_EpsCopyInputStream_IsDoneWithCallback( |
| 3920 | e, ptr, _upb_EpsCopyInputStream_IsDoneFallbackNoCallback); |
| 3921 | } |
| 3922 | |
| 3923 | // Returns the total number of bytes that are safe to read from the current |
| 3924 | // buffer without reading uninitialized or unallocated memory. |
| 3925 | // |
| 3926 | // Note that this check does not respect any semantic limits on the stream, |
| 3927 | // either limits from PushLimit() or the overall stream end, so some of these |
| 3928 | // bytes may have unpredictable, nonsense values in them. The guarantee is only |
| 3929 | // that the bytes are valid to read from the perspective of the C language |
| 3930 | // (ie. you can read without triggering UBSAN or ASAN). |
| 3931 | UPB_INLINE size_t upb_EpsCopyInputStream_BytesAvailable( |
| 3932 | upb_EpsCopyInputStream* e, const char* ptr) { |
| 3933 | return (e->end - ptr) + kUpb_EpsCopyInputStream_SlopBytes; |
| 3934 | } |
| 3935 | |
| 3936 | // Returns true if the given delimited field size is valid (it does not extend |
| 3937 | // beyond any previously-pushed limits). `ptr` should point to the beginning |
| 3938 | // of the field data, after the delimited size. |
| 3939 | // |
| 3940 | // Note that this does *not* guarantee that all of the data for this field is in |
| 3941 | // the current buffer. |
| 3942 | UPB_INLINE bool upb_EpsCopyInputStream_CheckSize( |
| 3943 | const upb_EpsCopyInputStream* e, const char* ptr, int size) { |
| 3944 | UPB_ASSERT(size >= 0); |
| 3945 | return ptr - e->end + size <= e->limit; |
| 3946 | } |
| 3947 | |
| 3948 | UPB_INLINE bool _upb_EpsCopyInputStream_CheckSizeAvailable( |
| 3949 | upb_EpsCopyInputStream* e, const char* ptr, int size, bool submessage) { |
| 3950 | // This is one extra branch compared to the more normal: |
| 3951 | // return (size_t)(end - ptr) < size; |
| 3952 | // However it is one less computation if we are just about to use "ptr + len": |
| 3953 | // https://godbolt.org/z/35YGPz |
| 3954 | // In microbenchmarks this shows a small improvement. |
| 3955 | uintptr_t uptr = (uintptr_t)ptr; |
| 3956 | uintptr_t uend = (uintptr_t)e->limit_ptr; |
| 3957 | uintptr_t res = uptr + (size_t)size; |
| 3958 | if (!submessage) uend += kUpb_EpsCopyInputStream_SlopBytes; |
| 3959 | // NOTE: this check depends on having a linear address space. This is not |
| 3960 | // technically guaranteed by uintptr_t. |
| 3961 | bool ret = res >= uptr && res <= uend; |
| 3962 | if (size < 0) UPB_ASSERT(!ret); |
| 3963 | return ret; |
| 3964 | } |
| 3965 | |
| 3966 | // Returns true if the given delimited field size is valid (it does not extend |
| 3967 | // beyond any previously-pushed limited) *and* all of the data for this field is |
| 3968 | // available to be read in the current buffer. |
| 3969 | // |
| 3970 | // If the size is negative, this function will always return false. This |
| 3971 | // property can be useful in some cases. |
| 3972 | UPB_INLINE bool upb_EpsCopyInputStream_CheckDataSizeAvailable( |
| 3973 | upb_EpsCopyInputStream* e, const char* ptr, int size) { |
| 3974 | return _upb_EpsCopyInputStream_CheckSizeAvailable(e, ptr, size, false); |
| 3975 | } |
| 3976 | |
| 3977 | // Returns true if the given sub-message size is valid (it does not extend |
| 3978 | // beyond any previously-pushed limited) *and* all of the data for this |
| 3979 | // sub-message is available to be parsed in the current buffer. |
| 3980 | // |
| 3981 | // This implies that all fields from the sub-message can be parsed from the |
| 3982 | // current buffer while maintaining the invariant that we always have at least |
| 3983 | // kUpb_EpsCopyInputStream_SlopBytes of data available past the beginning of |
| 3984 | // any individual field start. |
| 3985 | // |
| 3986 | // If the size is negative, this function will always return false. This |
| 3987 | // property can be useful in some cases. |
| 3988 | UPB_INLINE bool upb_EpsCopyInputStream_CheckSubMessageSizeAvailable( |
| 3989 | upb_EpsCopyInputStream* e, const char* ptr, int size) { |
| 3990 | return _upb_EpsCopyInputStream_CheckSizeAvailable(e, ptr, size, true); |
| 3991 | } |
| 3992 | |
| 3993 | // Returns true if aliasing_enabled=true was passed to |
| 3994 | // upb_EpsCopyInputStream_Init() when this stream was initialized. |
| 3995 | UPB_INLINE bool upb_EpsCopyInputStream_AliasingEnabled( |
| 3996 | upb_EpsCopyInputStream* e) { |
| 3997 | return e->aliasing != kUpb_EpsCopyInputStream_NoAliasing; |
| 3998 | } |
| 3999 | |
| 4000 | // Returns true if aliasing_enabled=true was passed to |
| 4001 | // upb_EpsCopyInputStream_Init() when this stream was initialized *and* we can |
| 4002 | // alias into the region [ptr, size] in an input buffer. |
| 4003 | UPB_INLINE bool upb_EpsCopyInputStream_AliasingAvailable( |
| 4004 | upb_EpsCopyInputStream* e, const char* ptr, size_t size) { |
| 4005 | // When EpsCopyInputStream supports streaming, this will need to become a |
| 4006 | // runtime check. |
| 4007 | return upb_EpsCopyInputStream_CheckDataSizeAvailable(e, ptr, size) && |
| 4008 | e->aliasing >= kUpb_EpsCopyInputStream_NoDelta; |
| 4009 | } |
| 4010 | |
| 4011 | // Returns a pointer into an input buffer that corresponds to the parsing |
| 4012 | // pointer `ptr`. The returned pointer may be the same as `ptr`, but also may |
| 4013 | // be different if we are currently parsing out of the patch buffer. |
| 4014 | // |
| 4015 | // REQUIRES: Aliasing must be available for the given pointer. If the input is a |
| 4016 | // flat buffer and aliasing is enabled, then aliasing will always be available. |
| 4017 | UPB_INLINE const char* upb_EpsCopyInputStream_GetAliasedPtr( |
| 4018 | upb_EpsCopyInputStream* e, const char* ptr) { |
| 4019 | UPB_ASSUME(upb_EpsCopyInputStream_AliasingAvailable(e, ptr, 0)); |
| 4020 | uintptr_t delta = |
| 4021 | e->aliasing == kUpb_EpsCopyInputStream_NoDelta ? 0 : e->aliasing; |
| 4022 | return (const char*)((uintptr_t)ptr + delta); |
| 4023 | } |
| 4024 | |
| 4025 | // Reads string data from the input, aliasing into the input buffer instead of |
| 4026 | // copying. The parsing pointer is passed in `*ptr`, and will be updated if |
| 4027 | // necessary to point to the actual input buffer. Returns the new parsing |
| 4028 | // pointer, which will be advanced past the string data. |
| 4029 | // |
| 4030 | // REQUIRES: Aliasing must be available for this data region (test with |
| 4031 | // upb_EpsCopyInputStream_AliasingAvailable(). |
| 4032 | UPB_INLINE const char* upb_EpsCopyInputStream_ReadStringAliased( |
| 4033 | upb_EpsCopyInputStream* e, const char** ptr, size_t size) { |
| 4034 | UPB_ASSUME(upb_EpsCopyInputStream_AliasingAvailable(e, *ptr, size)); |
| 4035 | const char* ret = *ptr + size; |
| 4036 | *ptr = upb_EpsCopyInputStream_GetAliasedPtr(e, *ptr); |
| 4037 | UPB_ASSUME(ret != NULL); |
| 4038 | return ret; |
| 4039 | } |
| 4040 | |
| 4041 | // Skips `size` bytes of data from the input and returns a pointer past the end. |
| 4042 | // Returns NULL on end of stream or error. |
| 4043 | UPB_INLINE const char* upb_EpsCopyInputStream_Skip(upb_EpsCopyInputStream* e, |
| 4044 | const char* ptr, int size) { |
| 4045 | if (!upb_EpsCopyInputStream_CheckDataSizeAvailable(e, ptr, size)) return NULL; |
| 4046 | return ptr + size; |
| 4047 | } |
| 4048 | |
| 4049 | // Copies `size` bytes of data from the input `ptr` into the buffer `to`, and |
| 4050 | // returns a pointer past the end. Returns NULL on end of stream or error. |
| 4051 | UPB_INLINE const char* upb_EpsCopyInputStream_Copy(upb_EpsCopyInputStream* e, |
| 4052 | const char* ptr, void* to, |
| 4053 | int size) { |
| 4054 | if (!upb_EpsCopyInputStream_CheckDataSizeAvailable(e, ptr, size)) return NULL; |
| 4055 | memcpy(to, ptr, size); |
| 4056 | return ptr + size; |
| 4057 | } |
| 4058 | |
| 4059 | // Reads string data from the stream and advances the pointer accordingly. |
| 4060 | // If aliasing was enabled when the stream was initialized, then the returned |
| 4061 | // pointer will point into the input buffer if possible, otherwise new data |
| 4062 | // will be allocated from arena and copied into. We may be forced to copy even |
| 4063 | // if aliasing was enabled if the input data spans input buffers. |
| 4064 | // |
| 4065 | // Returns NULL if memory allocation failed, or we reached a premature EOF. |
| 4066 | UPB_INLINE const char* upb_EpsCopyInputStream_ReadString( |
| 4067 | upb_EpsCopyInputStream* e, const char** ptr, size_t size, |
| 4068 | upb_Arena* arena) { |
| 4069 | if (upb_EpsCopyInputStream_AliasingAvailable(e, *ptr, size)) { |
| 4070 | return upb_EpsCopyInputStream_ReadStringAliased(e, ptr, size); |
| 4071 | } else { |
| 4072 | // We need to allocate and copy. |
| 4073 | if (!upb_EpsCopyInputStream_CheckDataSizeAvailable(e, *ptr, size)) { |
| 4074 | return NULL; |
| 4075 | } |
| 4076 | UPB_ASSERT(arena); |
| 4077 | char* data = (char*)upb_Arena_Malloc(arena, size); |
| 4078 | if (!data) return NULL; |
| 4079 | const char* ret = upb_EpsCopyInputStream_Copy(e, *ptr, data, size); |
| 4080 | *ptr = data; |
| 4081 | return ret; |
| 4082 | } |
| 4083 | } |
| 4084 | |
| 4085 | UPB_INLINE void _upb_EpsCopyInputStream_CheckLimit(upb_EpsCopyInputStream* e) { |
| 4086 | UPB_ASSERT(e->limit_ptr == e->end + UPB_MIN(0, e->limit)); |
| 4087 | } |
| 4088 | |
| 4089 | // Pushes a limit onto the stack of limits for the current stream. The limit |
| 4090 | // will extend for `size` bytes beyond the position in `ptr`. Future calls to |
| 4091 | // upb_EpsCopyInputStream_IsDone() will return `true` when the stream position |
| 4092 | // reaches this limit. |
| 4093 | // |
| 4094 | // Returns a delta that the caller must store and supply to PopLimit() below. |
| 4095 | UPB_INLINE int upb_EpsCopyInputStream_PushLimit(upb_EpsCopyInputStream* e, |
| 4096 | const char* ptr, int size) { |
| 4097 | int limit = size + (int)(ptr - e->end); |
| 4098 | int delta = e->limit - limit; |
| 4099 | _upb_EpsCopyInputStream_CheckLimit(e); |
| 4100 | UPB_ASSERT(limit <= e->limit); |
| 4101 | e->limit = limit; |
| 4102 | e->limit_ptr = e->end + UPB_MIN(0, limit); |
| 4103 | _upb_EpsCopyInputStream_CheckLimit(e); |
| 4104 | return delta; |
| 4105 | } |
| 4106 | |
| 4107 | // Pops the last limit that was pushed on this stream. This may only be called |
| 4108 | // once IsDone() returns true. The user must pass the delta that was returned |
| 4109 | // from PushLimit(). |
| 4110 | UPB_INLINE void upb_EpsCopyInputStream_PopLimit(upb_EpsCopyInputStream* e, |
| 4111 | const char* ptr, |
| 4112 | int saved_delta) { |
| 4113 | UPB_ASSERT(ptr - e->end == e->limit); |
| 4114 | _upb_EpsCopyInputStream_CheckLimit(e); |
| 4115 | e->limit += saved_delta; |
| 4116 | e->limit_ptr = e->end + UPB_MIN(0, e->limit); |
| 4117 | _upb_EpsCopyInputStream_CheckLimit(e); |
| 4118 | } |
| 4119 | |
| 4120 | UPB_INLINE const char* _upb_EpsCopyInputStream_IsDoneFallbackInline( |
| 4121 | upb_EpsCopyInputStream* e, const char* ptr, int overrun, |
| 4122 | upb_EpsCopyInputStream_BufferFlipCallback* callback) { |
| 4123 | if (overrun < e->limit) { |
| 4124 | // Need to copy remaining data into patch buffer. |
| 4125 | UPB_ASSERT(overrun < kUpb_EpsCopyInputStream_SlopBytes); |
| 4126 | const char* old_end = ptr; |
| 4127 | const char* new_start = &e->patch[0] + overrun; |
| 4128 | memset(e->patch + kUpb_EpsCopyInputStream_SlopBytes, 0, |
| 4129 | kUpb_EpsCopyInputStream_SlopBytes); |
| 4130 | memcpy(e->patch, e->end, kUpb_EpsCopyInputStream_SlopBytes); |
| 4131 | ptr = new_start; |
| 4132 | e->end = &e->patch[kUpb_EpsCopyInputStream_SlopBytes]; |
| 4133 | e->limit -= kUpb_EpsCopyInputStream_SlopBytes; |
| 4134 | e->limit_ptr = e->end + e->limit; |
| 4135 | UPB_ASSERT(ptr < e->limit_ptr); |
| 4136 | if (e->aliasing != kUpb_EpsCopyInputStream_NoAliasing) { |
| 4137 | e->aliasing = (uintptr_t)old_end - (uintptr_t)new_start; |
| 4138 | } |
| 4139 | return callback(e, old_end, new_start); |
| 4140 | } else { |
| 4141 | UPB_ASSERT(overrun > e->limit); |
| 4142 | e->error = true; |
| 4143 | return callback(e, NULL, NULL); |
| 4144 | } |
| 4145 | } |
| 4146 | |
| 4147 | typedef const char* upb_EpsCopyInputStream_ParseDelimitedFunc( |
| 4148 | upb_EpsCopyInputStream* e, const char* ptr, void* ctx); |
| 4149 | |
| 4150 | // Tries to perform a fast-path handling of the given delimited message data. |
| 4151 | // If the sub-message beginning at `*ptr` and extending for `len` is short and |
| 4152 | // fits within this buffer, calls `func` with `ctx` as a parameter, where the |
| 4153 | // pushing and popping of limits is handled automatically and with lower cost |
| 4154 | // than the normal PushLimit()/PopLimit() sequence. |
| 4155 | static UPB_FORCEINLINE bool upb_EpsCopyInputStream_TryParseDelimitedFast( |
| 4156 | upb_EpsCopyInputStream* e, const char** ptr, int len, |
| 4157 | upb_EpsCopyInputStream_ParseDelimitedFunc* func, void* ctx) { |
| 4158 | if (!upb_EpsCopyInputStream_CheckSubMessageSizeAvailable(e, *ptr, len)) { |
| 4159 | return false; |
| 4160 | } |
| 4161 | |
| 4162 | // Fast case: Sub-message is <128 bytes and fits in the current buffer. |
| 4163 | // This means we can preserve limit/limit_ptr verbatim. |
| 4164 | const char* saved_limit_ptr = e->limit_ptr; |
| 4165 | int saved_limit = e->limit; |
| 4166 | e->limit_ptr = *ptr + len; |
| 4167 | e->limit = e->limit_ptr - e->end; |
| 4168 | UPB_ASSERT(e->limit_ptr == e->end + UPB_MIN(0, e->limit)); |
| 4169 | *ptr = func(e, *ptr, ctx); |
| 4170 | e->limit_ptr = saved_limit_ptr; |
| 4171 | e->limit = saved_limit; |
| 4172 | UPB_ASSERT(e->limit_ptr == e->end + UPB_MIN(0, e->limit)); |
| 4173 | return true; |
| 4174 | } |
| 4175 | |
| 4176 | #ifdef __cplusplus |
| 4177 | } /* extern "C" */ |
| 4178 | #endif |
| 4179 | |
| 4180 | |
| 4181 | #endif // UPB_WIRE_EPS_COPY_INPUT_STREAM_H_ |
| 4182 | |
| 4183 | #ifndef UPB_HASH_INT_TABLE_H_ |
| 4184 | #define UPB_HASH_INT_TABLE_H_ |
| 4185 | |
| 4186 | |
| 4187 | // Must be last. |
| 4188 | |
| 4189 | typedef struct { |
| 4190 | upb_table t; // For entries that don't fit in the array part. |
| 4191 | const upb_tabval* array; // Array part of the table. See const note above. |
| 4192 | size_t array_size; // Array part size. |
| 4193 | size_t array_count; // Array part number of elements. |
| 4194 | } upb_inttable; |
| 4195 | |
| 4196 | #ifdef __cplusplus |
| 4197 | extern "C" { |
| 4198 | #endif |
| 4199 | |
| 4200 | // Initialize a table. If memory allocation failed, false is returned and |
| 4201 | // the table is uninitialized. |
| 4202 | bool upb_inttable_init(upb_inttable* table, upb_Arena* a); |
| 4203 | |
| 4204 | // Returns the number of values in the table. |
| 4205 | size_t upb_inttable_count(const upb_inttable* t); |
| 4206 | |
| 4207 | // Inserts the given key into the hashtable with the given value. |
| 4208 | // The key must not already exist in the hash table. |
| 4209 | // The value must not be UINTPTR_MAX. |
| 4210 | // |
| 4211 | // If a table resize was required but memory allocation failed, false is |
| 4212 | // returned and the table is unchanged. |
| 4213 | bool upb_inttable_insert(upb_inttable* t, uintptr_t key, upb_value val, |
| 4214 | upb_Arena* a); |
| 4215 | |
| 4216 | // Looks up key in this table, returning "true" if the key was found. |
| 4217 | // If v is non-NULL, copies the value for this key into *v. |
| 4218 | bool upb_inttable_lookup(const upb_inttable* t, uintptr_t key, upb_value* v); |
| 4219 | |
| 4220 | // Removes an item from the table. Returns true if the remove was successful, |
| 4221 | // and stores the removed item in *val if non-NULL. |
| 4222 | bool upb_inttable_remove(upb_inttable* t, uintptr_t key, upb_value* val); |
| 4223 | |
| 4224 | // Updates an existing entry in an inttable. |
| 4225 | // If the entry does not exist, returns false and does nothing. |
| 4226 | // Unlike insert/remove, this does not invalidate iterators. |
| 4227 | bool upb_inttable_replace(upb_inttable* t, uintptr_t key, upb_value val); |
| 4228 | |
| 4229 | // Optimizes the table for the current set of entries, for both memory use and |
| 4230 | // lookup time. Client should call this after all entries have been inserted; |
| 4231 | // inserting more entries is legal, but will likely require a table resize. |
| 4232 | void upb_inttable_compact(upb_inttable* t, upb_Arena* a); |
| 4233 | |
| 4234 | // Iteration over inttable: |
| 4235 | // |
| 4236 | // intptr_t iter = UPB_INTTABLE_BEGIN; |
| 4237 | // uintptr_t key; |
| 4238 | // upb_value val; |
| 4239 | // while (upb_inttable_next(t, &key, &val, &iter)) { |
| 4240 | // // ... |
| 4241 | // } |
| 4242 | |
| 4243 | #define UPB_INTTABLE_BEGIN -1 |
| 4244 | |
| 4245 | bool upb_inttable_next(const upb_inttable* t, uintptr_t* key, upb_value* val, |
| 4246 | intptr_t* iter); |
| 4247 | void upb_inttable_removeiter(upb_inttable* t, intptr_t* iter); |
| 4248 | |
| 4249 | #ifdef __cplusplus |
| 4250 | } /* extern "C" */ |
| 4251 | #endif |
| 4252 | |
| 4253 | |
| 4254 | #endif /* UPB_HASH_INT_TABLE_H_ */ |
| 4255 | |
| 4256 | #ifndef UPB_JSON_DECODE_H_ |
| 4257 | #define UPB_JSON_DECODE_H_ |
| 4258 | |
| 4259 | |
| 4260 | #ifndef UPB_REFLECTION_DEF_H_ |
| 4261 | #define UPB_REFLECTION_DEF_H_ |
| 4262 | |
| 4263 | // IWYU pragma: begin_exports |
| 4264 | |
| 4265 | // IWYU pragma: private, include "upb/upb/reflection/def.h" |
| 4266 | |
| 4267 | #ifndef UPB_REFLECTION_DEF_POOL_H_ |
| 4268 | #define UPB_REFLECTION_DEF_POOL_H_ |
| 4269 | |
| 4270 | |
| 4271 | // IWYU pragma: private, include "upb/upb/reflection/def.h" |
| 4272 | |
| 4273 | // Declarations common to all public def types. |
| 4274 | |
| 4275 | #ifndef UPB_REFLECTION_COMMON_H_ |
| 4276 | #define UPB_REFLECTION_COMMON_H_ |
| 4277 | |
| 4278 | // begin:google_only |
| 4279 | // #ifndef UPB_BOOTSTRAP_STAGE0 |
| 4280 | // #include "net/proto2/proto/descriptor.upb.h" |
| 4281 | // #else |
| 4282 | // #include "google/protobuf/descriptor.upb.h" |
| 4283 | // #endif |
| 4284 | // end:google_only |
| 4285 | |
| 4286 | // begin:github_only |
| 4287 | /* This file was generated by upbc (the upb compiler) from the input |
| 4288 | * file: |
| 4289 | * |
| 4290 | * google/protobuf/descriptor.proto |
| 4291 | * |
| 4292 | * Do not edit -- your changes will be discarded when the file is |
| 4293 | * regenerated. */ |
| 4294 | |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 4295 | #ifndef GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_H_ |
| 4296 | #define GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_H_ |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4297 | |
Protobuf Team Bot | 111d655 | 2023-09-15 21:07:08 +0000 | [diff] [blame] | 4298 | |
| 4299 | |
| 4300 | // Must be last. |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4301 | |
| 4302 | #ifdef __cplusplus |
| 4303 | extern "C" { |
| 4304 | #endif |
| 4305 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4306 | typedef struct google_protobuf_FileDescriptorSet google_protobuf_FileDescriptorSet; |
| 4307 | typedef struct google_protobuf_FileDescriptorProto google_protobuf_FileDescriptorProto; |
| 4308 | typedef struct google_protobuf_DescriptorProto google_protobuf_DescriptorProto; |
| 4309 | typedef struct google_protobuf_DescriptorProto_ExtensionRange google_protobuf_DescriptorProto_ExtensionRange; |
| 4310 | typedef struct google_protobuf_DescriptorProto_ReservedRange google_protobuf_DescriptorProto_ReservedRange; |
| 4311 | typedef struct google_protobuf_ExtensionRangeOptions google_protobuf_ExtensionRangeOptions; |
Mike Kruskal | 145900f | 2023-03-27 09:55:52 -0700 | [diff] [blame] | 4312 | typedef struct google_protobuf_ExtensionRangeOptions_Declaration google_protobuf_ExtensionRangeOptions_Declaration; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4313 | typedef struct google_protobuf_FieldDescriptorProto google_protobuf_FieldDescriptorProto; |
| 4314 | typedef struct google_protobuf_OneofDescriptorProto google_protobuf_OneofDescriptorProto; |
| 4315 | typedef struct google_protobuf_EnumDescriptorProto google_protobuf_EnumDescriptorProto; |
| 4316 | typedef struct google_protobuf_EnumDescriptorProto_EnumReservedRange google_protobuf_EnumDescriptorProto_EnumReservedRange; |
| 4317 | typedef struct google_protobuf_EnumValueDescriptorProto google_protobuf_EnumValueDescriptorProto; |
| 4318 | typedef struct google_protobuf_ServiceDescriptorProto google_protobuf_ServiceDescriptorProto; |
| 4319 | typedef struct google_protobuf_MethodDescriptorProto google_protobuf_MethodDescriptorProto; |
| 4320 | typedef struct google_protobuf_FileOptions google_protobuf_FileOptions; |
| 4321 | typedef struct google_protobuf_MessageOptions google_protobuf_MessageOptions; |
| 4322 | typedef struct google_protobuf_FieldOptions google_protobuf_FieldOptions; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 4323 | typedef struct google_protobuf_FieldOptions_EditionDefault google_protobuf_FieldOptions_EditionDefault; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4324 | typedef struct google_protobuf_OneofOptions google_protobuf_OneofOptions; |
| 4325 | typedef struct google_protobuf_EnumOptions google_protobuf_EnumOptions; |
| 4326 | typedef struct google_protobuf_EnumValueOptions google_protobuf_EnumValueOptions; |
| 4327 | typedef struct google_protobuf_ServiceOptions google_protobuf_ServiceOptions; |
| 4328 | typedef struct google_protobuf_MethodOptions google_protobuf_MethodOptions; |
| 4329 | typedef struct google_protobuf_UninterpretedOption google_protobuf_UninterpretedOption; |
| 4330 | typedef struct google_protobuf_UninterpretedOption_NamePart google_protobuf_UninterpretedOption_NamePart; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 4331 | typedef struct google_protobuf_FeatureSet google_protobuf_FeatureSet; |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 4332 | typedef struct google_protobuf_FeatureSetDefaults google_protobuf_FeatureSetDefaults; |
| 4333 | typedef struct google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4334 | typedef struct google_protobuf_SourceCodeInfo google_protobuf_SourceCodeInfo; |
| 4335 | typedef struct google_protobuf_SourceCodeInfo_Location google_protobuf_SourceCodeInfo_Location; |
| 4336 | typedef struct google_protobuf_GeneratedCodeInfo google_protobuf_GeneratedCodeInfo; |
| 4337 | typedef struct google_protobuf_GeneratedCodeInfo_Annotation google_protobuf_GeneratedCodeInfo_Annotation; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4338 | |
| 4339 | typedef enum { |
Protobuf Team Bot | fa98bb3 | 2023-09-01 18:11:09 +0000 | [diff] [blame] | 4340 | google_protobuf_EDITION_UNKNOWN = 0, |
| 4341 | google_protobuf_EDITION_1_TEST_ONLY = 1, |
| 4342 | google_protobuf_EDITION_2_TEST_ONLY = 2, |
| 4343 | google_protobuf_EDITION_2023 = 1000, |
| 4344 | google_protobuf_EDITION_99997_TEST_ONLY = 99997, |
| 4345 | google_protobuf_EDITION_99998_TEST_ONLY = 99998, |
| 4346 | google_protobuf_EDITION_99999_TEST_ONLY = 99999 |
| 4347 | } google_protobuf_Edition; |
| 4348 | |
| 4349 | typedef enum { |
Protobuf Team Bot | 469f027 | 2023-04-21 18:12:45 -0700 | [diff] [blame] | 4350 | google_protobuf_ExtensionRangeOptions_DECLARATION = 0, |
| 4351 | google_protobuf_ExtensionRangeOptions_UNVERIFIED = 1 |
| 4352 | } google_protobuf_ExtensionRangeOptions_VerificationState; |
| 4353 | |
| 4354 | typedef enum { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 4355 | google_protobuf_FeatureSet_ENUM_TYPE_UNKNOWN = 0, |
| 4356 | google_protobuf_FeatureSet_OPEN = 1, |
| 4357 | google_protobuf_FeatureSet_CLOSED = 2 |
| 4358 | } google_protobuf_FeatureSet_EnumType; |
| 4359 | |
| 4360 | typedef enum { |
| 4361 | google_protobuf_FeatureSet_FIELD_PRESENCE_UNKNOWN = 0, |
| 4362 | google_protobuf_FeatureSet_EXPLICIT = 1, |
| 4363 | google_protobuf_FeatureSet_IMPLICIT = 2, |
| 4364 | google_protobuf_FeatureSet_LEGACY_REQUIRED = 3 |
| 4365 | } google_protobuf_FeatureSet_FieldPresence; |
| 4366 | |
| 4367 | typedef enum { |
| 4368 | google_protobuf_FeatureSet_JSON_FORMAT_UNKNOWN = 0, |
| 4369 | google_protobuf_FeatureSet_ALLOW = 1, |
| 4370 | google_protobuf_FeatureSet_LEGACY_BEST_EFFORT = 2 |
| 4371 | } google_protobuf_FeatureSet_JsonFormat; |
| 4372 | |
| 4373 | typedef enum { |
| 4374 | google_protobuf_FeatureSet_MESSAGE_ENCODING_UNKNOWN = 0, |
| 4375 | google_protobuf_FeatureSet_LENGTH_PREFIXED = 1, |
| 4376 | google_protobuf_FeatureSet_DELIMITED = 2 |
| 4377 | } google_protobuf_FeatureSet_MessageEncoding; |
| 4378 | |
| 4379 | typedef enum { |
| 4380 | google_protobuf_FeatureSet_REPEATED_FIELD_ENCODING_UNKNOWN = 0, |
| 4381 | google_protobuf_FeatureSet_PACKED = 1, |
| 4382 | google_protobuf_FeatureSet_EXPANDED = 2 |
| 4383 | } google_protobuf_FeatureSet_RepeatedFieldEncoding; |
| 4384 | |
| 4385 | typedef enum { |
Mike Kruskal | ccbdaa7 | 2023-02-02 20:42:14 -0800 | [diff] [blame] | 4386 | google_protobuf_FieldDescriptorProto_LABEL_OPTIONAL = 1, |
| 4387 | google_protobuf_FieldDescriptorProto_LABEL_REQUIRED = 2, |
| 4388 | google_protobuf_FieldDescriptorProto_LABEL_REPEATED = 3 |
| 4389 | } google_protobuf_FieldDescriptorProto_Label; |
| 4390 | |
| 4391 | typedef enum { |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4392 | google_protobuf_FieldDescriptorProto_TYPE_DOUBLE = 1, |
| 4393 | google_protobuf_FieldDescriptorProto_TYPE_FLOAT = 2, |
| 4394 | google_protobuf_FieldDescriptorProto_TYPE_INT64 = 3, |
| 4395 | google_protobuf_FieldDescriptorProto_TYPE_UINT64 = 4, |
| 4396 | google_protobuf_FieldDescriptorProto_TYPE_INT32 = 5, |
| 4397 | google_protobuf_FieldDescriptorProto_TYPE_FIXED64 = 6, |
| 4398 | google_protobuf_FieldDescriptorProto_TYPE_FIXED32 = 7, |
| 4399 | google_protobuf_FieldDescriptorProto_TYPE_BOOL = 8, |
| 4400 | google_protobuf_FieldDescriptorProto_TYPE_STRING = 9, |
| 4401 | google_protobuf_FieldDescriptorProto_TYPE_GROUP = 10, |
| 4402 | google_protobuf_FieldDescriptorProto_TYPE_MESSAGE = 11, |
| 4403 | google_protobuf_FieldDescriptorProto_TYPE_BYTES = 12, |
| 4404 | google_protobuf_FieldDescriptorProto_TYPE_UINT32 = 13, |
| 4405 | google_protobuf_FieldDescriptorProto_TYPE_ENUM = 14, |
| 4406 | google_protobuf_FieldDescriptorProto_TYPE_SFIXED32 = 15, |
| 4407 | google_protobuf_FieldDescriptorProto_TYPE_SFIXED64 = 16, |
| 4408 | google_protobuf_FieldDescriptorProto_TYPE_SINT32 = 17, |
| 4409 | google_protobuf_FieldDescriptorProto_TYPE_SINT64 = 18 |
| 4410 | } google_protobuf_FieldDescriptorProto_Type; |
| 4411 | |
| 4412 | typedef enum { |
| 4413 | google_protobuf_FieldOptions_STRING = 0, |
| 4414 | google_protobuf_FieldOptions_CORD = 1, |
| 4415 | google_protobuf_FieldOptions_STRING_PIECE = 2 |
| 4416 | } google_protobuf_FieldOptions_CType; |
| 4417 | |
| 4418 | typedef enum { |
| 4419 | google_protobuf_FieldOptions_JS_NORMAL = 0, |
| 4420 | google_protobuf_FieldOptions_JS_STRING = 1, |
| 4421 | google_protobuf_FieldOptions_JS_NUMBER = 2 |
| 4422 | } google_protobuf_FieldOptions_JSType; |
| 4423 | |
| 4424 | typedef enum { |
Adam Cozzette | 90ff32c | 2023-01-21 15:04:56 -0800 | [diff] [blame] | 4425 | google_protobuf_FieldOptions_RETENTION_UNKNOWN = 0, |
| 4426 | google_protobuf_FieldOptions_RETENTION_RUNTIME = 1, |
| 4427 | google_protobuf_FieldOptions_RETENTION_SOURCE = 2 |
| 4428 | } google_protobuf_FieldOptions_OptionRetention; |
| 4429 | |
| 4430 | typedef enum { |
| 4431 | google_protobuf_FieldOptions_TARGET_TYPE_UNKNOWN = 0, |
| 4432 | google_protobuf_FieldOptions_TARGET_TYPE_FILE = 1, |
| 4433 | google_protobuf_FieldOptions_TARGET_TYPE_EXTENSION_RANGE = 2, |
| 4434 | google_protobuf_FieldOptions_TARGET_TYPE_MESSAGE = 3, |
| 4435 | google_protobuf_FieldOptions_TARGET_TYPE_FIELD = 4, |
| 4436 | google_protobuf_FieldOptions_TARGET_TYPE_ONEOF = 5, |
| 4437 | google_protobuf_FieldOptions_TARGET_TYPE_ENUM = 6, |
| 4438 | google_protobuf_FieldOptions_TARGET_TYPE_ENUM_ENTRY = 7, |
| 4439 | google_protobuf_FieldOptions_TARGET_TYPE_SERVICE = 8, |
| 4440 | google_protobuf_FieldOptions_TARGET_TYPE_METHOD = 9 |
| 4441 | } google_protobuf_FieldOptions_OptionTargetType; |
| 4442 | |
| 4443 | typedef enum { |
Mike Kruskal | ccbdaa7 | 2023-02-02 20:42:14 -0800 | [diff] [blame] | 4444 | google_protobuf_FileOptions_SPEED = 1, |
| 4445 | google_protobuf_FileOptions_CODE_SIZE = 2, |
| 4446 | google_protobuf_FileOptions_LITE_RUNTIME = 3 |
| 4447 | } google_protobuf_FileOptions_OptimizeMode; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4448 | |
| 4449 | typedef enum { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4450 | google_protobuf_GeneratedCodeInfo_Annotation_NONE = 0, |
| 4451 | google_protobuf_GeneratedCodeInfo_Annotation_SET = 1, |
| 4452 | google_protobuf_GeneratedCodeInfo_Annotation_ALIAS = 2 |
| 4453 | } google_protobuf_GeneratedCodeInfo_Annotation_Semantic; |
| 4454 | |
Mike Kruskal | ccbdaa7 | 2023-02-02 20:42:14 -0800 | [diff] [blame] | 4455 | typedef enum { |
| 4456 | google_protobuf_MethodOptions_IDEMPOTENCY_UNKNOWN = 0, |
| 4457 | google_protobuf_MethodOptions_NO_SIDE_EFFECTS = 1, |
| 4458 | google_protobuf_MethodOptions_IDEMPOTENT = 2 |
| 4459 | } google_protobuf_MethodOptions_IdempotencyLevel; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4460 | |
Mike Kruskal | ccbdaa7 | 2023-02-02 20:42:14 -0800 | [diff] [blame] | 4461 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4462 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4463 | /* google.protobuf.FileDescriptorSet */ |
| 4464 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4465 | UPB_INLINE google_protobuf_FileDescriptorSet* google_protobuf_FileDescriptorSet_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4466 | return (google_protobuf_FileDescriptorSet*)_upb_Message_New(&google_protobuf_FileDescriptorSet_msg_init, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4467 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4468 | UPB_INLINE google_protobuf_FileDescriptorSet* google_protobuf_FileDescriptorSet_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 4469 | google_protobuf_FileDescriptorSet* ret = google_protobuf_FileDescriptorSet_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 4470 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4471 | if (upb_Decode(buf, size, ret, &google_protobuf_FileDescriptorSet_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 4472 | return NULL; |
| 4473 | } |
| 4474 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4475 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4476 | UPB_INLINE google_protobuf_FileDescriptorSet* google_protobuf_FileDescriptorSet_parse_ex(const char* buf, size_t size, |
| 4477 | const upb_ExtensionRegistry* extreg, |
| 4478 | int options, upb_Arena* arena) { |
| 4479 | google_protobuf_FileDescriptorSet* ret = google_protobuf_FileDescriptorSet_new(arena); |
| 4480 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4481 | if (upb_Decode(buf, size, ret, &google_protobuf_FileDescriptorSet_msg_init, extreg, options, arena) != |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4482 | kUpb_DecodeStatus_Ok) { |
| 4483 | return NULL; |
| 4484 | } |
| 4485 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4486 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4487 | UPB_INLINE char* google_protobuf_FileDescriptorSet_serialize(const google_protobuf_FileDescriptorSet* msg, upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4488 | char* ptr; |
| 4489 | (void)upb_Encode(msg, &google_protobuf_FileDescriptorSet_msg_init, 0, arena, &ptr, len); |
| 4490 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4491 | } |
| 4492 | UPB_INLINE char* google_protobuf_FileDescriptorSet_serialize_ex(const google_protobuf_FileDescriptorSet* msg, int options, |
| 4493 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4494 | char* ptr; |
| 4495 | (void)upb_Encode(msg, &google_protobuf_FileDescriptorSet_msg_init, options, arena, &ptr, len); |
| 4496 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4497 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4498 | UPB_INLINE void google_protobuf_FileDescriptorSet_clear_file(google_protobuf_FileDescriptorSet* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4499 | const upb_MiniTableField field = {1, 0, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 4500 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4501 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4502 | UPB_INLINE const google_protobuf_FileDescriptorProto* const* google_protobuf_FileDescriptorSet_file(const google_protobuf_FileDescriptorSet* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4503 | const upb_MiniTableField field = {1, 0, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4504 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4505 | if (arr) { |
| 4506 | if (size) *size = arr->size; |
| 4507 | return (const google_protobuf_FileDescriptorProto* const*)_upb_array_constptr(arr); |
| 4508 | } else { |
| 4509 | if (size) *size = 0; |
| 4510 | return NULL; |
| 4511 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4512 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 4513 | UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorSet_file_upb_array(const google_protobuf_FileDescriptorSet* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4514 | const upb_MiniTableField field = {1, 0, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 4515 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4516 | if (size) { |
| 4517 | *size = arr ? arr->size : 0; |
| 4518 | } |
| 4519 | return arr; |
| 4520 | } |
| 4521 | UPB_INLINE upb_Array* _google_protobuf_FileDescriptorSet_file_mutable_upb_array(const google_protobuf_FileDescriptorSet* msg, size_t* size, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4522 | const upb_MiniTableField field = {1, 0, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 4523 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 4524 | (upb_Message*)msg, &field, arena); |
| 4525 | if (size) { |
| 4526 | *size = arr ? arr->size : 0; |
| 4527 | } |
| 4528 | return arr; |
| 4529 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4530 | UPB_INLINE bool google_protobuf_FileDescriptorSet_has_file(const google_protobuf_FileDescriptorSet* msg) { |
| 4531 | size_t size; |
| 4532 | google_protobuf_FileDescriptorSet_file(msg, &size); |
| 4533 | return size != 0; |
| 4534 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4535 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4536 | UPB_INLINE google_protobuf_FileDescriptorProto** google_protobuf_FileDescriptorSet_mutable_file(google_protobuf_FileDescriptorSet* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4537 | upb_MiniTableField field = {1, 0, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4538 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 4539 | if (arr) { |
| 4540 | if (size) *size = arr->size; |
| 4541 | return (google_protobuf_FileDescriptorProto**)_upb_array_ptr(arr); |
| 4542 | } else { |
| 4543 | if (size) *size = 0; |
| 4544 | return NULL; |
| 4545 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4546 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4547 | UPB_INLINE google_protobuf_FileDescriptorProto** google_protobuf_FileDescriptorSet_resize_file(google_protobuf_FileDescriptorSet* msg, size_t size, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4548 | upb_MiniTableField field = {1, 0, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Jie Luo | f36a5c6 | 2023-05-23 17:56:18 -0700 | [diff] [blame] | 4549 | return (google_protobuf_FileDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4550 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4551 | UPB_INLINE struct google_protobuf_FileDescriptorProto* google_protobuf_FileDescriptorSet_add_file(google_protobuf_FileDescriptorSet* msg, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4552 | upb_MiniTableField field = {1, 0, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4553 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 4554 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 4555 | return NULL; |
| 4556 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4557 | struct google_protobuf_FileDescriptorProto* sub = (struct google_protobuf_FileDescriptorProto*)_upb_Message_New(&google_protobuf_FileDescriptorProto_msg_init, arena); |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4558 | if (!arr || !sub) return NULL; |
| 4559 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4560 | return sub; |
| 4561 | } |
| 4562 | |
| 4563 | /* google.protobuf.FileDescriptorProto */ |
| 4564 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4565 | UPB_INLINE google_protobuf_FileDescriptorProto* google_protobuf_FileDescriptorProto_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4566 | return (google_protobuf_FileDescriptorProto*)_upb_Message_New(&google_protobuf_FileDescriptorProto_msg_init, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4567 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4568 | UPB_INLINE google_protobuf_FileDescriptorProto* google_protobuf_FileDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 4569 | google_protobuf_FileDescriptorProto* ret = google_protobuf_FileDescriptorProto_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 4570 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4571 | if (upb_Decode(buf, size, ret, &google_protobuf_FileDescriptorProto_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 4572 | return NULL; |
| 4573 | } |
| 4574 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4575 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4576 | UPB_INLINE google_protobuf_FileDescriptorProto* google_protobuf_FileDescriptorProto_parse_ex(const char* buf, size_t size, |
| 4577 | const upb_ExtensionRegistry* extreg, |
| 4578 | int options, upb_Arena* arena) { |
| 4579 | google_protobuf_FileDescriptorProto* ret = google_protobuf_FileDescriptorProto_new(arena); |
| 4580 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4581 | if (upb_Decode(buf, size, ret, &google_protobuf_FileDescriptorProto_msg_init, extreg, options, arena) != |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4582 | kUpb_DecodeStatus_Ok) { |
| 4583 | return NULL; |
| 4584 | } |
| 4585 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4586 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4587 | UPB_INLINE char* google_protobuf_FileDescriptorProto_serialize(const google_protobuf_FileDescriptorProto* msg, upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4588 | char* ptr; |
| 4589 | (void)upb_Encode(msg, &google_protobuf_FileDescriptorProto_msg_init, 0, arena, &ptr, len); |
| 4590 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4591 | } |
| 4592 | UPB_INLINE char* google_protobuf_FileDescriptorProto_serialize_ex(const google_protobuf_FileDescriptorProto* msg, int options, |
| 4593 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4594 | char* ptr; |
| 4595 | (void)upb_Encode(msg, &google_protobuf_FileDescriptorProto_msg_init, options, arena, &ptr, len); |
| 4596 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4597 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4598 | UPB_INLINE void google_protobuf_FileDescriptorProto_clear_name(google_protobuf_FileDescriptorProto* msg) { |
Protobuf Team Bot | 0e484c7 | 2023-09-06 19:28:27 +0000 | [diff] [blame] | 4599 | const upb_MiniTableField field = {1, UPB_SIZE(44, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 4600 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4601 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4602 | UPB_INLINE upb_StringView google_protobuf_FileDescriptorProto_name(const google_protobuf_FileDescriptorProto* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 4603 | upb_StringView default_val = upb_StringView_FromString(""); |
| 4604 | upb_StringView ret; |
Protobuf Team Bot | 0e484c7 | 2023-09-06 19:28:27 +0000 | [diff] [blame] | 4605 | const upb_MiniTableField field = {1, UPB_SIZE(44, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 4606 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 4607 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4608 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4609 | UPB_INLINE bool google_protobuf_FileDescriptorProto_has_name(const google_protobuf_FileDescriptorProto* msg) { |
Protobuf Team Bot | 0e484c7 | 2023-09-06 19:28:27 +0000 | [diff] [blame] | 4610 | const upb_MiniTableField field = {1, UPB_SIZE(44, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 4611 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4612 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4613 | UPB_INLINE void google_protobuf_FileDescriptorProto_clear_package(google_protobuf_FileDescriptorProto* msg) { |
Protobuf Team Bot | 0e484c7 | 2023-09-06 19:28:27 +0000 | [diff] [blame] | 4614 | const upb_MiniTableField field = {2, UPB_SIZE(52, 24), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 4615 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4616 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4617 | UPB_INLINE upb_StringView google_protobuf_FileDescriptorProto_package(const google_protobuf_FileDescriptorProto* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 4618 | upb_StringView default_val = upb_StringView_FromString(""); |
| 4619 | upb_StringView ret; |
Protobuf Team Bot | 0e484c7 | 2023-09-06 19:28:27 +0000 | [diff] [blame] | 4620 | const upb_MiniTableField field = {2, UPB_SIZE(52, 24), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 4621 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 4622 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4623 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4624 | UPB_INLINE bool google_protobuf_FileDescriptorProto_has_package(const google_protobuf_FileDescriptorProto* msg) { |
Protobuf Team Bot | 0e484c7 | 2023-09-06 19:28:27 +0000 | [diff] [blame] | 4625 | const upb_MiniTableField field = {2, UPB_SIZE(52, 24), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 4626 | return _upb_Message_HasNonExtensionField(msg, &field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4627 | } |
| 4628 | UPB_INLINE void google_protobuf_FileDescriptorProto_clear_dependency(google_protobuf_FileDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4629 | const upb_MiniTableField field = {3, UPB_SIZE(4, 40), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 4630 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4631 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4632 | UPB_INLINE upb_StringView const* google_protobuf_FileDescriptorProto_dependency(const google_protobuf_FileDescriptorProto* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4633 | const upb_MiniTableField field = {3, UPB_SIZE(4, 40), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4634 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4635 | if (arr) { |
| 4636 | if (size) *size = arr->size; |
| 4637 | return (upb_StringView const*)_upb_array_constptr(arr); |
| 4638 | } else { |
| 4639 | if (size) *size = 0; |
| 4640 | return NULL; |
| 4641 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4642 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 4643 | UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_dependency_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4644 | const upb_MiniTableField field = {3, UPB_SIZE(4, 40), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 4645 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4646 | if (size) { |
| 4647 | *size = arr ? arr->size : 0; |
| 4648 | } |
| 4649 | return arr; |
| 4650 | } |
| 4651 | UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_dependency_mutable_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4652 | const upb_MiniTableField field = {3, UPB_SIZE(4, 40), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 4653 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 4654 | (upb_Message*)msg, &field, arena); |
| 4655 | if (size) { |
| 4656 | *size = arr ? arr->size : 0; |
| 4657 | } |
| 4658 | return arr; |
| 4659 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4660 | UPB_INLINE bool google_protobuf_FileDescriptorProto_has_dependency(const google_protobuf_FileDescriptorProto* msg) { |
| 4661 | size_t size; |
| 4662 | google_protobuf_FileDescriptorProto_dependency(msg, &size); |
| 4663 | return size != 0; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4664 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4665 | UPB_INLINE void google_protobuf_FileDescriptorProto_clear_message_type(google_protobuf_FileDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4666 | const upb_MiniTableField field = {4, UPB_SIZE(8, 48), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 4667 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4668 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4669 | UPB_INLINE const google_protobuf_DescriptorProto* const* google_protobuf_FileDescriptorProto_message_type(const google_protobuf_FileDescriptorProto* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4670 | const upb_MiniTableField field = {4, UPB_SIZE(8, 48), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4671 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4672 | if (arr) { |
| 4673 | if (size) *size = arr->size; |
| 4674 | return (const google_protobuf_DescriptorProto* const*)_upb_array_constptr(arr); |
| 4675 | } else { |
| 4676 | if (size) *size = 0; |
| 4677 | return NULL; |
| 4678 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4679 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 4680 | UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_message_type_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4681 | const upb_MiniTableField field = {4, UPB_SIZE(8, 48), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 4682 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4683 | if (size) { |
| 4684 | *size = arr ? arr->size : 0; |
| 4685 | } |
| 4686 | return arr; |
| 4687 | } |
| 4688 | UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_message_type_mutable_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4689 | const upb_MiniTableField field = {4, UPB_SIZE(8, 48), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 4690 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 4691 | (upb_Message*)msg, &field, arena); |
| 4692 | if (size) { |
| 4693 | *size = arr ? arr->size : 0; |
| 4694 | } |
| 4695 | return arr; |
| 4696 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4697 | UPB_INLINE bool google_protobuf_FileDescriptorProto_has_message_type(const google_protobuf_FileDescriptorProto* msg) { |
| 4698 | size_t size; |
| 4699 | google_protobuf_FileDescriptorProto_message_type(msg, &size); |
| 4700 | return size != 0; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4701 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4702 | UPB_INLINE void google_protobuf_FileDescriptorProto_clear_enum_type(google_protobuf_FileDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4703 | const upb_MiniTableField field = {5, UPB_SIZE(12, 56), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 4704 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4705 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4706 | UPB_INLINE const google_protobuf_EnumDescriptorProto* const* google_protobuf_FileDescriptorProto_enum_type(const google_protobuf_FileDescriptorProto* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4707 | const upb_MiniTableField field = {5, UPB_SIZE(12, 56), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4708 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4709 | if (arr) { |
| 4710 | if (size) *size = arr->size; |
| 4711 | return (const google_protobuf_EnumDescriptorProto* const*)_upb_array_constptr(arr); |
| 4712 | } else { |
| 4713 | if (size) *size = 0; |
| 4714 | return NULL; |
| 4715 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4716 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 4717 | UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_enum_type_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4718 | const upb_MiniTableField field = {5, UPB_SIZE(12, 56), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 4719 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4720 | if (size) { |
| 4721 | *size = arr ? arr->size : 0; |
| 4722 | } |
| 4723 | return arr; |
| 4724 | } |
| 4725 | UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_enum_type_mutable_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4726 | const upb_MiniTableField field = {5, UPB_SIZE(12, 56), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 4727 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 4728 | (upb_Message*)msg, &field, arena); |
| 4729 | if (size) { |
| 4730 | *size = arr ? arr->size : 0; |
| 4731 | } |
| 4732 | return arr; |
| 4733 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4734 | UPB_INLINE bool google_protobuf_FileDescriptorProto_has_enum_type(const google_protobuf_FileDescriptorProto* msg) { |
| 4735 | size_t size; |
| 4736 | google_protobuf_FileDescriptorProto_enum_type(msg, &size); |
| 4737 | return size != 0; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4738 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4739 | UPB_INLINE void google_protobuf_FileDescriptorProto_clear_service(google_protobuf_FileDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4740 | const upb_MiniTableField field = {6, UPB_SIZE(16, 64), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 4741 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4742 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4743 | UPB_INLINE const google_protobuf_ServiceDescriptorProto* const* google_protobuf_FileDescriptorProto_service(const google_protobuf_FileDescriptorProto* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4744 | const upb_MiniTableField field = {6, UPB_SIZE(16, 64), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4745 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4746 | if (arr) { |
| 4747 | if (size) *size = arr->size; |
| 4748 | return (const google_protobuf_ServiceDescriptorProto* const*)_upb_array_constptr(arr); |
| 4749 | } else { |
| 4750 | if (size) *size = 0; |
| 4751 | return NULL; |
| 4752 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4753 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 4754 | UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_service_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4755 | const upb_MiniTableField field = {6, UPB_SIZE(16, 64), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 4756 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4757 | if (size) { |
| 4758 | *size = arr ? arr->size : 0; |
| 4759 | } |
| 4760 | return arr; |
| 4761 | } |
| 4762 | UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_service_mutable_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4763 | const upb_MiniTableField field = {6, UPB_SIZE(16, 64), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 4764 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 4765 | (upb_Message*)msg, &field, arena); |
| 4766 | if (size) { |
| 4767 | *size = arr ? arr->size : 0; |
| 4768 | } |
| 4769 | return arr; |
| 4770 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4771 | UPB_INLINE bool google_protobuf_FileDescriptorProto_has_service(const google_protobuf_FileDescriptorProto* msg) { |
| 4772 | size_t size; |
| 4773 | google_protobuf_FileDescriptorProto_service(msg, &size); |
| 4774 | return size != 0; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4775 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4776 | UPB_INLINE void google_protobuf_FileDescriptorProto_clear_extension(google_protobuf_FileDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4777 | const upb_MiniTableField field = {7, UPB_SIZE(20, 72), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 4778 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4779 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4780 | UPB_INLINE const google_protobuf_FieldDescriptorProto* const* google_protobuf_FileDescriptorProto_extension(const google_protobuf_FileDescriptorProto* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4781 | const upb_MiniTableField field = {7, UPB_SIZE(20, 72), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4782 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4783 | if (arr) { |
| 4784 | if (size) *size = arr->size; |
| 4785 | return (const google_protobuf_FieldDescriptorProto* const*)_upb_array_constptr(arr); |
| 4786 | } else { |
| 4787 | if (size) *size = 0; |
| 4788 | return NULL; |
| 4789 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4790 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 4791 | UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_extension_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4792 | const upb_MiniTableField field = {7, UPB_SIZE(20, 72), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 4793 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4794 | if (size) { |
| 4795 | *size = arr ? arr->size : 0; |
| 4796 | } |
| 4797 | return arr; |
| 4798 | } |
| 4799 | UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_extension_mutable_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4800 | const upb_MiniTableField field = {7, UPB_SIZE(20, 72), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 4801 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 4802 | (upb_Message*)msg, &field, arena); |
| 4803 | if (size) { |
| 4804 | *size = arr ? arr->size : 0; |
| 4805 | } |
| 4806 | return arr; |
| 4807 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4808 | UPB_INLINE bool google_protobuf_FileDescriptorProto_has_extension(const google_protobuf_FileDescriptorProto* msg) { |
| 4809 | size_t size; |
| 4810 | google_protobuf_FileDescriptorProto_extension(msg, &size); |
| 4811 | return size != 0; |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4812 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4813 | UPB_INLINE void google_protobuf_FileDescriptorProto_clear_options(google_protobuf_FileDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4814 | const upb_MiniTableField field = {8, UPB_SIZE(24, 80), 3, 4, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 4815 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4816 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4817 | UPB_INLINE const google_protobuf_FileOptions* google_protobuf_FileDescriptorProto_options(const google_protobuf_FileDescriptorProto* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 4818 | const google_protobuf_FileOptions* default_val = NULL; |
| 4819 | const google_protobuf_FileOptions* ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4820 | const upb_MiniTableField field = {8, UPB_SIZE(24, 80), 3, 4, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 4821 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 4822 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4823 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4824 | UPB_INLINE bool google_protobuf_FileDescriptorProto_has_options(const google_protobuf_FileDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4825 | const upb_MiniTableField field = {8, UPB_SIZE(24, 80), 3, 4, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 4826 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4827 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4828 | UPB_INLINE void google_protobuf_FileDescriptorProto_clear_source_code_info(google_protobuf_FileDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4829 | const upb_MiniTableField field = {9, UPB_SIZE(28, 88), 4, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 4830 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4831 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4832 | UPB_INLINE const google_protobuf_SourceCodeInfo* google_protobuf_FileDescriptorProto_source_code_info(const google_protobuf_FileDescriptorProto* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 4833 | const google_protobuf_SourceCodeInfo* default_val = NULL; |
| 4834 | const google_protobuf_SourceCodeInfo* ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4835 | const upb_MiniTableField field = {9, UPB_SIZE(28, 88), 4, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 4836 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 4837 | return ret; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4838 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4839 | UPB_INLINE bool google_protobuf_FileDescriptorProto_has_source_code_info(const google_protobuf_FileDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4840 | const upb_MiniTableField field = {9, UPB_SIZE(28, 88), 4, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 4841 | return _upb_Message_HasNonExtensionField(msg, &field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4842 | } |
| 4843 | UPB_INLINE void google_protobuf_FileDescriptorProto_clear_public_dependency(google_protobuf_FileDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4844 | const upb_MiniTableField field = {10, UPB_SIZE(32, 96), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 4845 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4846 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4847 | UPB_INLINE int32_t const* google_protobuf_FileDescriptorProto_public_dependency(const google_protobuf_FileDescriptorProto* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4848 | const upb_MiniTableField field = {10, UPB_SIZE(32, 96), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4849 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4850 | if (arr) { |
| 4851 | if (size) *size = arr->size; |
| 4852 | return (int32_t const*)_upb_array_constptr(arr); |
| 4853 | } else { |
| 4854 | if (size) *size = 0; |
| 4855 | return NULL; |
| 4856 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4857 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 4858 | UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_public_dependency_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4859 | const upb_MiniTableField field = {10, UPB_SIZE(32, 96), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 4860 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4861 | if (size) { |
| 4862 | *size = arr ? arr->size : 0; |
| 4863 | } |
| 4864 | return arr; |
| 4865 | } |
| 4866 | UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_public_dependency_mutable_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4867 | const upb_MiniTableField field = {10, UPB_SIZE(32, 96), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 4868 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 4869 | (upb_Message*)msg, &field, arena); |
| 4870 | if (size) { |
| 4871 | *size = arr ? arr->size : 0; |
| 4872 | } |
| 4873 | return arr; |
| 4874 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4875 | UPB_INLINE bool google_protobuf_FileDescriptorProto_has_public_dependency(const google_protobuf_FileDescriptorProto* msg) { |
| 4876 | size_t size; |
| 4877 | google_protobuf_FileDescriptorProto_public_dependency(msg, &size); |
| 4878 | return size != 0; |
| 4879 | } |
| 4880 | UPB_INLINE void google_protobuf_FileDescriptorProto_clear_weak_dependency(google_protobuf_FileDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4881 | const upb_MiniTableField field = {11, UPB_SIZE(36, 104), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 4882 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4883 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4884 | UPB_INLINE int32_t const* google_protobuf_FileDescriptorProto_weak_dependency(const google_protobuf_FileDescriptorProto* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4885 | const upb_MiniTableField field = {11, UPB_SIZE(36, 104), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4886 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4887 | if (arr) { |
| 4888 | if (size) *size = arr->size; |
| 4889 | return (int32_t const*)_upb_array_constptr(arr); |
| 4890 | } else { |
| 4891 | if (size) *size = 0; |
| 4892 | return NULL; |
| 4893 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4894 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 4895 | UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_weak_dependency_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4896 | const upb_MiniTableField field = {11, UPB_SIZE(36, 104), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 4897 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4898 | if (size) { |
| 4899 | *size = arr ? arr->size : 0; |
| 4900 | } |
| 4901 | return arr; |
| 4902 | } |
| 4903 | UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_weak_dependency_mutable_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4904 | const upb_MiniTableField field = {11, UPB_SIZE(36, 104), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 4905 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 4906 | (upb_Message*)msg, &field, arena); |
| 4907 | if (size) { |
| 4908 | *size = arr ? arr->size : 0; |
| 4909 | } |
| 4910 | return arr; |
| 4911 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4912 | UPB_INLINE bool google_protobuf_FileDescriptorProto_has_weak_dependency(const google_protobuf_FileDescriptorProto* msg) { |
| 4913 | size_t size; |
| 4914 | google_protobuf_FileDescriptorProto_weak_dependency(msg, &size); |
| 4915 | return size != 0; |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4916 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4917 | UPB_INLINE void google_protobuf_FileDescriptorProto_clear_syntax(google_protobuf_FileDescriptorProto* msg) { |
Protobuf Team Bot | 0e484c7 | 2023-09-06 19:28:27 +0000 | [diff] [blame] | 4918 | const upb_MiniTableField field = {12, UPB_SIZE(60, 112), 5, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 4919 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4920 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4921 | UPB_INLINE upb_StringView google_protobuf_FileDescriptorProto_syntax(const google_protobuf_FileDescriptorProto* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 4922 | upb_StringView default_val = upb_StringView_FromString(""); |
| 4923 | upb_StringView ret; |
Protobuf Team Bot | 0e484c7 | 2023-09-06 19:28:27 +0000 | [diff] [blame] | 4924 | const upb_MiniTableField field = {12, UPB_SIZE(60, 112), 5, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 4925 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 4926 | return ret; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4927 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4928 | UPB_INLINE bool google_protobuf_FileDescriptorProto_has_syntax(const google_protobuf_FileDescriptorProto* msg) { |
Protobuf Team Bot | 0e484c7 | 2023-09-06 19:28:27 +0000 | [diff] [blame] | 4929 | const upb_MiniTableField field = {12, UPB_SIZE(60, 112), 5, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 4930 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4931 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4932 | UPB_INLINE void google_protobuf_FileDescriptorProto_clear_edition(google_protobuf_FileDescriptorProto* msg) { |
Protobuf Team Bot | 0e484c7 | 2023-09-06 19:28:27 +0000 | [diff] [blame] | 4933 | const upb_MiniTableField field = {13, UPB_SIZE(68, 128), 6, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 4934 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4935 | } |
| 4936 | UPB_INLINE upb_StringView google_protobuf_FileDescriptorProto_edition(const google_protobuf_FileDescriptorProto* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 4937 | upb_StringView default_val = upb_StringView_FromString(""); |
| 4938 | upb_StringView ret; |
Protobuf Team Bot | 0e484c7 | 2023-09-06 19:28:27 +0000 | [diff] [blame] | 4939 | const upb_MiniTableField field = {13, UPB_SIZE(68, 128), 6, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 4940 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 4941 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4942 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4943 | UPB_INLINE bool google_protobuf_FileDescriptorProto_has_edition(const google_protobuf_FileDescriptorProto* msg) { |
Protobuf Team Bot | 0e484c7 | 2023-09-06 19:28:27 +0000 | [diff] [blame] | 4944 | const upb_MiniTableField field = {13, UPB_SIZE(68, 128), 6, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
| 4945 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 4946 | } |
| 4947 | UPB_INLINE void google_protobuf_FileDescriptorProto_clear_edition_enum(google_protobuf_FileDescriptorProto* msg) { |
| 4948 | const upb_MiniTableField field = {14, UPB_SIZE(40, 4), 7, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
| 4949 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 4950 | } |
| 4951 | UPB_INLINE int32_t google_protobuf_FileDescriptorProto_edition_enum(const google_protobuf_FileDescriptorProto* msg) { |
| 4952 | int32_t default_val = 0; |
| 4953 | int32_t ret; |
| 4954 | const upb_MiniTableField field = {14, UPB_SIZE(40, 4), 7, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
| 4955 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 4956 | return ret; |
| 4957 | } |
| 4958 | UPB_INLINE bool google_protobuf_FileDescriptorProto_has_edition_enum(const google_protobuf_FileDescriptorProto* msg) { |
| 4959 | const upb_MiniTableField field = {14, UPB_SIZE(40, 4), 7, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 4960 | return _upb_Message_HasNonExtensionField(msg, &field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4961 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4962 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4963 | UPB_INLINE void google_protobuf_FileDescriptorProto_set_name(google_protobuf_FileDescriptorProto *msg, upb_StringView value) { |
Protobuf Team Bot | 0e484c7 | 2023-09-06 19:28:27 +0000 | [diff] [blame] | 4964 | const upb_MiniTableField field = {1, UPB_SIZE(44, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 4965 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 4966 | } |
| 4967 | UPB_INLINE void google_protobuf_FileDescriptorProto_set_package(google_protobuf_FileDescriptorProto *msg, upb_StringView value) { |
Protobuf Team Bot | 0e484c7 | 2023-09-06 19:28:27 +0000 | [diff] [blame] | 4968 | const upb_MiniTableField field = {2, UPB_SIZE(52, 24), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 4969 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 4970 | } |
| 4971 | UPB_INLINE upb_StringView* google_protobuf_FileDescriptorProto_mutable_dependency(google_protobuf_FileDescriptorProto* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4972 | upb_MiniTableField field = {3, UPB_SIZE(4, 40), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4973 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 4974 | if (arr) { |
| 4975 | if (size) *size = arr->size; |
| 4976 | return (upb_StringView*)_upb_array_ptr(arr); |
| 4977 | } else { |
| 4978 | if (size) *size = 0; |
| 4979 | return NULL; |
| 4980 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4981 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4982 | UPB_INLINE upb_StringView* google_protobuf_FileDescriptorProto_resize_dependency(google_protobuf_FileDescriptorProto* msg, size_t size, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4983 | upb_MiniTableField field = {3, UPB_SIZE(4, 40), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Jie Luo | f36a5c6 | 2023-05-23 17:56:18 -0700 | [diff] [blame] | 4984 | return (upb_StringView*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4985 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4986 | UPB_INLINE bool google_protobuf_FileDescriptorProto_add_dependency(google_protobuf_FileDescriptorProto* msg, upb_StringView val, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4987 | upb_MiniTableField field = {3, UPB_SIZE(4, 40), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4988 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 4989 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 4990 | return false; |
| 4991 | } |
| 4992 | _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val)); |
| 4993 | return true; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4994 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4995 | UPB_INLINE google_protobuf_DescriptorProto** google_protobuf_FileDescriptorProto_mutable_message_type(google_protobuf_FileDescriptorProto* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4996 | upb_MiniTableField field = {4, UPB_SIZE(8, 48), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4997 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 4998 | if (arr) { |
| 4999 | if (size) *size = arr->size; |
| 5000 | return (google_protobuf_DescriptorProto**)_upb_array_ptr(arr); |
| 5001 | } else { |
| 5002 | if (size) *size = 0; |
| 5003 | return NULL; |
| 5004 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5005 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5006 | UPB_INLINE google_protobuf_DescriptorProto** google_protobuf_FileDescriptorProto_resize_message_type(google_protobuf_FileDescriptorProto* msg, size_t size, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5007 | upb_MiniTableField field = {4, UPB_SIZE(8, 48), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Jie Luo | f36a5c6 | 2023-05-23 17:56:18 -0700 | [diff] [blame] | 5008 | return (google_protobuf_DescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5009 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5010 | UPB_INLINE struct google_protobuf_DescriptorProto* google_protobuf_FileDescriptorProto_add_message_type(google_protobuf_FileDescriptorProto* msg, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5011 | upb_MiniTableField field = {4, UPB_SIZE(8, 48), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5012 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 5013 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 5014 | return NULL; |
| 5015 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5016 | struct google_protobuf_DescriptorProto* sub = (struct google_protobuf_DescriptorProto*)_upb_Message_New(&google_protobuf_DescriptorProto_msg_init, arena); |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5017 | if (!arr || !sub) return NULL; |
| 5018 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5019 | return sub; |
| 5020 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5021 | UPB_INLINE google_protobuf_EnumDescriptorProto** google_protobuf_FileDescriptorProto_mutable_enum_type(google_protobuf_FileDescriptorProto* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5022 | upb_MiniTableField field = {5, UPB_SIZE(12, 56), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5023 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 5024 | if (arr) { |
| 5025 | if (size) *size = arr->size; |
| 5026 | return (google_protobuf_EnumDescriptorProto**)_upb_array_ptr(arr); |
| 5027 | } else { |
| 5028 | if (size) *size = 0; |
| 5029 | return NULL; |
| 5030 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5031 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5032 | UPB_INLINE google_protobuf_EnumDescriptorProto** google_protobuf_FileDescriptorProto_resize_enum_type(google_protobuf_FileDescriptorProto* msg, size_t size, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5033 | upb_MiniTableField field = {5, UPB_SIZE(12, 56), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Jie Luo | f36a5c6 | 2023-05-23 17:56:18 -0700 | [diff] [blame] | 5034 | return (google_protobuf_EnumDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5035 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5036 | UPB_INLINE struct google_protobuf_EnumDescriptorProto* google_protobuf_FileDescriptorProto_add_enum_type(google_protobuf_FileDescriptorProto* msg, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5037 | upb_MiniTableField field = {5, UPB_SIZE(12, 56), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5038 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 5039 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 5040 | return NULL; |
| 5041 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5042 | struct google_protobuf_EnumDescriptorProto* sub = (struct google_protobuf_EnumDescriptorProto*)_upb_Message_New(&google_protobuf_EnumDescriptorProto_msg_init, arena); |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5043 | if (!arr || !sub) return NULL; |
| 5044 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5045 | return sub; |
| 5046 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5047 | UPB_INLINE google_protobuf_ServiceDescriptorProto** google_protobuf_FileDescriptorProto_mutable_service(google_protobuf_FileDescriptorProto* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5048 | upb_MiniTableField field = {6, UPB_SIZE(16, 64), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5049 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 5050 | if (arr) { |
| 5051 | if (size) *size = arr->size; |
| 5052 | return (google_protobuf_ServiceDescriptorProto**)_upb_array_ptr(arr); |
| 5053 | } else { |
| 5054 | if (size) *size = 0; |
| 5055 | return NULL; |
| 5056 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5057 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5058 | UPB_INLINE google_protobuf_ServiceDescriptorProto** google_protobuf_FileDescriptorProto_resize_service(google_protobuf_FileDescriptorProto* msg, size_t size, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5059 | upb_MiniTableField field = {6, UPB_SIZE(16, 64), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Jie Luo | f36a5c6 | 2023-05-23 17:56:18 -0700 | [diff] [blame] | 5060 | return (google_protobuf_ServiceDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5061 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5062 | UPB_INLINE struct google_protobuf_ServiceDescriptorProto* google_protobuf_FileDescriptorProto_add_service(google_protobuf_FileDescriptorProto* msg, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5063 | upb_MiniTableField field = {6, UPB_SIZE(16, 64), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5064 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 5065 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 5066 | return NULL; |
| 5067 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5068 | struct google_protobuf_ServiceDescriptorProto* sub = (struct google_protobuf_ServiceDescriptorProto*)_upb_Message_New(&google_protobuf_ServiceDescriptorProto_msg_init, arena); |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5069 | if (!arr || !sub) return NULL; |
| 5070 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5071 | return sub; |
| 5072 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5073 | UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_FileDescriptorProto_mutable_extension(google_protobuf_FileDescriptorProto* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5074 | upb_MiniTableField field = {7, UPB_SIZE(20, 72), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5075 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 5076 | if (arr) { |
| 5077 | if (size) *size = arr->size; |
| 5078 | return (google_protobuf_FieldDescriptorProto**)_upb_array_ptr(arr); |
| 5079 | } else { |
| 5080 | if (size) *size = 0; |
| 5081 | return NULL; |
| 5082 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5083 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5084 | UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_FileDescriptorProto_resize_extension(google_protobuf_FileDescriptorProto* msg, size_t size, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5085 | upb_MiniTableField field = {7, UPB_SIZE(20, 72), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Jie Luo | f36a5c6 | 2023-05-23 17:56:18 -0700 | [diff] [blame] | 5086 | return (google_protobuf_FieldDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5087 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5088 | UPB_INLINE struct google_protobuf_FieldDescriptorProto* google_protobuf_FileDescriptorProto_add_extension(google_protobuf_FileDescriptorProto* msg, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5089 | upb_MiniTableField field = {7, UPB_SIZE(20, 72), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5090 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 5091 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 5092 | return NULL; |
| 5093 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5094 | struct google_protobuf_FieldDescriptorProto* sub = (struct google_protobuf_FieldDescriptorProto*)_upb_Message_New(&google_protobuf_FieldDescriptorProto_msg_init, arena); |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5095 | if (!arr || !sub) return NULL; |
| 5096 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5097 | return sub; |
| 5098 | } |
| 5099 | UPB_INLINE void google_protobuf_FileDescriptorProto_set_options(google_protobuf_FileDescriptorProto *msg, google_protobuf_FileOptions* value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5100 | const upb_MiniTableField field = {8, UPB_SIZE(24, 80), 3, 4, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 5101 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 5102 | } |
| 5103 | UPB_INLINE struct google_protobuf_FileOptions* google_protobuf_FileDescriptorProto_mutable_options(google_protobuf_FileDescriptorProto* msg, upb_Arena* arena) { |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5104 | struct google_protobuf_FileOptions* sub = (struct google_protobuf_FileOptions*)google_protobuf_FileDescriptorProto_options(msg); |
| 5105 | if (sub == NULL) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5106 | sub = (struct google_protobuf_FileOptions*)_upb_Message_New(&google_protobuf_FileOptions_msg_init, arena); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 5107 | if (sub) google_protobuf_FileDescriptorProto_set_options(msg, sub); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5108 | } |
| 5109 | return sub; |
| 5110 | } |
| 5111 | UPB_INLINE void google_protobuf_FileDescriptorProto_set_source_code_info(google_protobuf_FileDescriptorProto *msg, google_protobuf_SourceCodeInfo* value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5112 | const upb_MiniTableField field = {9, UPB_SIZE(28, 88), 4, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 5113 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 5114 | } |
| 5115 | UPB_INLINE struct google_protobuf_SourceCodeInfo* google_protobuf_FileDescriptorProto_mutable_source_code_info(google_protobuf_FileDescriptorProto* msg, upb_Arena* arena) { |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5116 | struct google_protobuf_SourceCodeInfo* sub = (struct google_protobuf_SourceCodeInfo*)google_protobuf_FileDescriptorProto_source_code_info(msg); |
| 5117 | if (sub == NULL) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5118 | sub = (struct google_protobuf_SourceCodeInfo*)_upb_Message_New(&google_protobuf_SourceCodeInfo_msg_init, arena); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 5119 | if (sub) google_protobuf_FileDescriptorProto_set_source_code_info(msg, sub); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5120 | } |
| 5121 | return sub; |
| 5122 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5123 | UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_mutable_public_dependency(google_protobuf_FileDescriptorProto* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5124 | upb_MiniTableField field = {10, UPB_SIZE(32, 96), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5125 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 5126 | if (arr) { |
| 5127 | if (size) *size = arr->size; |
| 5128 | return (int32_t*)_upb_array_ptr(arr); |
| 5129 | } else { |
| 5130 | if (size) *size = 0; |
| 5131 | return NULL; |
| 5132 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5133 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5134 | UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_resize_public_dependency(google_protobuf_FileDescriptorProto* msg, size_t size, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5135 | upb_MiniTableField field = {10, UPB_SIZE(32, 96), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Jie Luo | f36a5c6 | 2023-05-23 17:56:18 -0700 | [diff] [blame] | 5136 | return (int32_t*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5137 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5138 | UPB_INLINE bool google_protobuf_FileDescriptorProto_add_public_dependency(google_protobuf_FileDescriptorProto* msg, int32_t val, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5139 | upb_MiniTableField field = {10, UPB_SIZE(32, 96), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5140 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 5141 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 5142 | return false; |
| 5143 | } |
| 5144 | _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val)); |
| 5145 | return true; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5146 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5147 | UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_mutable_weak_dependency(google_protobuf_FileDescriptorProto* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5148 | upb_MiniTableField field = {11, UPB_SIZE(36, 104), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5149 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 5150 | if (arr) { |
| 5151 | if (size) *size = arr->size; |
| 5152 | return (int32_t*)_upb_array_ptr(arr); |
| 5153 | } else { |
| 5154 | if (size) *size = 0; |
| 5155 | return NULL; |
| 5156 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5157 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5158 | UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_resize_weak_dependency(google_protobuf_FileDescriptorProto* msg, size_t size, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5159 | upb_MiniTableField field = {11, UPB_SIZE(36, 104), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Jie Luo | f36a5c6 | 2023-05-23 17:56:18 -0700 | [diff] [blame] | 5160 | return (int32_t*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5161 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5162 | UPB_INLINE bool google_protobuf_FileDescriptorProto_add_weak_dependency(google_protobuf_FileDescriptorProto* msg, int32_t val, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5163 | upb_MiniTableField field = {11, UPB_SIZE(36, 104), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5164 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 5165 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 5166 | return false; |
| 5167 | } |
| 5168 | _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val)); |
| 5169 | return true; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5170 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5171 | UPB_INLINE void google_protobuf_FileDescriptorProto_set_syntax(google_protobuf_FileDescriptorProto *msg, upb_StringView value) { |
Protobuf Team Bot | 0e484c7 | 2023-09-06 19:28:27 +0000 | [diff] [blame] | 5172 | const upb_MiniTableField field = {12, UPB_SIZE(60, 112), 5, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 5173 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 5174 | } |
| 5175 | UPB_INLINE void google_protobuf_FileDescriptorProto_set_edition(google_protobuf_FileDescriptorProto *msg, upb_StringView value) { |
Protobuf Team Bot | 0e484c7 | 2023-09-06 19:28:27 +0000 | [diff] [blame] | 5176 | const upb_MiniTableField field = {13, UPB_SIZE(68, 128), 6, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
| 5177 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 5178 | } |
| 5179 | UPB_INLINE void google_protobuf_FileDescriptorProto_set_edition_enum(google_protobuf_FileDescriptorProto *msg, int32_t value) { |
| 5180 | const upb_MiniTableField field = {14, UPB_SIZE(40, 4), 7, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 5181 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5182 | } |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 5183 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5184 | /* google.protobuf.DescriptorProto */ |
| 5185 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5186 | UPB_INLINE google_protobuf_DescriptorProto* google_protobuf_DescriptorProto_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5187 | return (google_protobuf_DescriptorProto*)_upb_Message_New(&google_protobuf_DescriptorProto_msg_init, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5188 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5189 | UPB_INLINE google_protobuf_DescriptorProto* google_protobuf_DescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 5190 | google_protobuf_DescriptorProto* ret = google_protobuf_DescriptorProto_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 5191 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5192 | if (upb_Decode(buf, size, ret, &google_protobuf_DescriptorProto_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 5193 | return NULL; |
| 5194 | } |
| 5195 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5196 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5197 | UPB_INLINE google_protobuf_DescriptorProto* google_protobuf_DescriptorProto_parse_ex(const char* buf, size_t size, |
| 5198 | const upb_ExtensionRegistry* extreg, |
| 5199 | int options, upb_Arena* arena) { |
| 5200 | google_protobuf_DescriptorProto* ret = google_protobuf_DescriptorProto_new(arena); |
| 5201 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5202 | if (upb_Decode(buf, size, ret, &google_protobuf_DescriptorProto_msg_init, extreg, options, arena) != |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5203 | kUpb_DecodeStatus_Ok) { |
| 5204 | return NULL; |
| 5205 | } |
| 5206 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5207 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5208 | UPB_INLINE char* google_protobuf_DescriptorProto_serialize(const google_protobuf_DescriptorProto* msg, upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5209 | char* ptr; |
| 5210 | (void)upb_Encode(msg, &google_protobuf_DescriptorProto_msg_init, 0, arena, &ptr, len); |
| 5211 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5212 | } |
| 5213 | UPB_INLINE char* google_protobuf_DescriptorProto_serialize_ex(const google_protobuf_DescriptorProto* msg, int options, |
| 5214 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5215 | char* ptr; |
| 5216 | (void)upb_Encode(msg, &google_protobuf_DescriptorProto_msg_init, options, arena, &ptr, len); |
| 5217 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5218 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5219 | UPB_INLINE void google_protobuf_DescriptorProto_clear_name(google_protobuf_DescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5220 | const upb_MiniTableField field = {1, UPB_SIZE(40, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 5221 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5222 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5223 | UPB_INLINE upb_StringView google_protobuf_DescriptorProto_name(const google_protobuf_DescriptorProto* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 5224 | upb_StringView default_val = upb_StringView_FromString(""); |
| 5225 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5226 | const upb_MiniTableField field = {1, UPB_SIZE(40, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 5227 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 5228 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5229 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5230 | UPB_INLINE bool google_protobuf_DescriptorProto_has_name(const google_protobuf_DescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5231 | const upb_MiniTableField field = {1, UPB_SIZE(40, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 5232 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5233 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5234 | UPB_INLINE void google_protobuf_DescriptorProto_clear_field(google_protobuf_DescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5235 | const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 5236 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5237 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5238 | UPB_INLINE const google_protobuf_FieldDescriptorProto* const* google_protobuf_DescriptorProto_field(const google_protobuf_DescriptorProto* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5239 | const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5240 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 5241 | if (arr) { |
| 5242 | if (size) *size = arr->size; |
| 5243 | return (const google_protobuf_FieldDescriptorProto* const*)_upb_array_constptr(arr); |
| 5244 | } else { |
| 5245 | if (size) *size = 0; |
| 5246 | return NULL; |
| 5247 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5248 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 5249 | UPB_INLINE const upb_Array* _google_protobuf_DescriptorProto_field_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5250 | const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 5251 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 5252 | if (size) { |
| 5253 | *size = arr ? arr->size : 0; |
| 5254 | } |
| 5255 | return arr; |
| 5256 | } |
| 5257 | UPB_INLINE upb_Array* _google_protobuf_DescriptorProto_field_mutable_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5258 | const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 5259 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 5260 | (upb_Message*)msg, &field, arena); |
| 5261 | if (size) { |
| 5262 | *size = arr ? arr->size : 0; |
| 5263 | } |
| 5264 | return arr; |
| 5265 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5266 | UPB_INLINE bool google_protobuf_DescriptorProto_has_field(const google_protobuf_DescriptorProto* msg) { |
| 5267 | size_t size; |
| 5268 | google_protobuf_DescriptorProto_field(msg, &size); |
| 5269 | return size != 0; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5270 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5271 | UPB_INLINE void google_protobuf_DescriptorProto_clear_nested_type(google_protobuf_DescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5272 | const upb_MiniTableField field = {3, UPB_SIZE(8, 32), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 5273 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5274 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5275 | UPB_INLINE const google_protobuf_DescriptorProto* const* google_protobuf_DescriptorProto_nested_type(const google_protobuf_DescriptorProto* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5276 | const upb_MiniTableField field = {3, UPB_SIZE(8, 32), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5277 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 5278 | if (arr) { |
| 5279 | if (size) *size = arr->size; |
| 5280 | return (const google_protobuf_DescriptorProto* const*)_upb_array_constptr(arr); |
| 5281 | } else { |
| 5282 | if (size) *size = 0; |
| 5283 | return NULL; |
| 5284 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5285 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 5286 | UPB_INLINE const upb_Array* _google_protobuf_DescriptorProto_nested_type_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5287 | const upb_MiniTableField field = {3, UPB_SIZE(8, 32), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 5288 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 5289 | if (size) { |
| 5290 | *size = arr ? arr->size : 0; |
| 5291 | } |
| 5292 | return arr; |
| 5293 | } |
| 5294 | UPB_INLINE upb_Array* _google_protobuf_DescriptorProto_nested_type_mutable_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5295 | const upb_MiniTableField field = {3, UPB_SIZE(8, 32), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 5296 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 5297 | (upb_Message*)msg, &field, arena); |
| 5298 | if (size) { |
| 5299 | *size = arr ? arr->size : 0; |
| 5300 | } |
| 5301 | return arr; |
| 5302 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5303 | UPB_INLINE bool google_protobuf_DescriptorProto_has_nested_type(const google_protobuf_DescriptorProto* msg) { |
| 5304 | size_t size; |
| 5305 | google_protobuf_DescriptorProto_nested_type(msg, &size); |
| 5306 | return size != 0; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5307 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5308 | UPB_INLINE void google_protobuf_DescriptorProto_clear_enum_type(google_protobuf_DescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5309 | const upb_MiniTableField field = {4, UPB_SIZE(12, 40), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 5310 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5311 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5312 | UPB_INLINE const google_protobuf_EnumDescriptorProto* const* google_protobuf_DescriptorProto_enum_type(const google_protobuf_DescriptorProto* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5313 | const upb_MiniTableField field = {4, UPB_SIZE(12, 40), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5314 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 5315 | if (arr) { |
| 5316 | if (size) *size = arr->size; |
| 5317 | return (const google_protobuf_EnumDescriptorProto* const*)_upb_array_constptr(arr); |
| 5318 | } else { |
| 5319 | if (size) *size = 0; |
| 5320 | return NULL; |
| 5321 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5322 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 5323 | UPB_INLINE const upb_Array* _google_protobuf_DescriptorProto_enum_type_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5324 | const upb_MiniTableField field = {4, UPB_SIZE(12, 40), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 5325 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 5326 | if (size) { |
| 5327 | *size = arr ? arr->size : 0; |
| 5328 | } |
| 5329 | return arr; |
| 5330 | } |
| 5331 | UPB_INLINE upb_Array* _google_protobuf_DescriptorProto_enum_type_mutable_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5332 | const upb_MiniTableField field = {4, UPB_SIZE(12, 40), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 5333 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 5334 | (upb_Message*)msg, &field, arena); |
| 5335 | if (size) { |
| 5336 | *size = arr ? arr->size : 0; |
| 5337 | } |
| 5338 | return arr; |
| 5339 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5340 | UPB_INLINE bool google_protobuf_DescriptorProto_has_enum_type(const google_protobuf_DescriptorProto* msg) { |
| 5341 | size_t size; |
| 5342 | google_protobuf_DescriptorProto_enum_type(msg, &size); |
| 5343 | return size != 0; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5344 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5345 | UPB_INLINE void google_protobuf_DescriptorProto_clear_extension_range(google_protobuf_DescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5346 | const upb_MiniTableField field = {5, UPB_SIZE(16, 48), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 5347 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5348 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5349 | UPB_INLINE const google_protobuf_DescriptorProto_ExtensionRange* const* google_protobuf_DescriptorProto_extension_range(const google_protobuf_DescriptorProto* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5350 | const upb_MiniTableField field = {5, UPB_SIZE(16, 48), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5351 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 5352 | if (arr) { |
| 5353 | if (size) *size = arr->size; |
| 5354 | return (const google_protobuf_DescriptorProto_ExtensionRange* const*)_upb_array_constptr(arr); |
| 5355 | } else { |
| 5356 | if (size) *size = 0; |
| 5357 | return NULL; |
| 5358 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5359 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 5360 | UPB_INLINE const upb_Array* _google_protobuf_DescriptorProto_extension_range_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5361 | const upb_MiniTableField field = {5, UPB_SIZE(16, 48), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 5362 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 5363 | if (size) { |
| 5364 | *size = arr ? arr->size : 0; |
| 5365 | } |
| 5366 | return arr; |
| 5367 | } |
| 5368 | UPB_INLINE upb_Array* _google_protobuf_DescriptorProto_extension_range_mutable_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5369 | const upb_MiniTableField field = {5, UPB_SIZE(16, 48), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 5370 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 5371 | (upb_Message*)msg, &field, arena); |
| 5372 | if (size) { |
| 5373 | *size = arr ? arr->size : 0; |
| 5374 | } |
| 5375 | return arr; |
| 5376 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5377 | UPB_INLINE bool google_protobuf_DescriptorProto_has_extension_range(const google_protobuf_DescriptorProto* msg) { |
| 5378 | size_t size; |
| 5379 | google_protobuf_DescriptorProto_extension_range(msg, &size); |
| 5380 | return size != 0; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5381 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5382 | UPB_INLINE void google_protobuf_DescriptorProto_clear_extension(google_protobuf_DescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5383 | const upb_MiniTableField field = {6, UPB_SIZE(20, 56), 0, 4, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 5384 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5385 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5386 | UPB_INLINE const google_protobuf_FieldDescriptorProto* const* google_protobuf_DescriptorProto_extension(const google_protobuf_DescriptorProto* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5387 | const upb_MiniTableField field = {6, UPB_SIZE(20, 56), 0, 4, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5388 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 5389 | if (arr) { |
| 5390 | if (size) *size = arr->size; |
| 5391 | return (const google_protobuf_FieldDescriptorProto* const*)_upb_array_constptr(arr); |
| 5392 | } else { |
| 5393 | if (size) *size = 0; |
| 5394 | return NULL; |
| 5395 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5396 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 5397 | UPB_INLINE const upb_Array* _google_protobuf_DescriptorProto_extension_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5398 | const upb_MiniTableField field = {6, UPB_SIZE(20, 56), 0, 4, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 5399 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 5400 | if (size) { |
| 5401 | *size = arr ? arr->size : 0; |
| 5402 | } |
| 5403 | return arr; |
| 5404 | } |
| 5405 | UPB_INLINE upb_Array* _google_protobuf_DescriptorProto_extension_mutable_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5406 | const upb_MiniTableField field = {6, UPB_SIZE(20, 56), 0, 4, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 5407 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 5408 | (upb_Message*)msg, &field, arena); |
| 5409 | if (size) { |
| 5410 | *size = arr ? arr->size : 0; |
| 5411 | } |
| 5412 | return arr; |
| 5413 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5414 | UPB_INLINE bool google_protobuf_DescriptorProto_has_extension(const google_protobuf_DescriptorProto* msg) { |
| 5415 | size_t size; |
| 5416 | google_protobuf_DescriptorProto_extension(msg, &size); |
| 5417 | return size != 0; |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5418 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5419 | UPB_INLINE void google_protobuf_DescriptorProto_clear_options(google_protobuf_DescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5420 | const upb_MiniTableField field = {7, UPB_SIZE(24, 64), 2, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 5421 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5422 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5423 | UPB_INLINE const google_protobuf_MessageOptions* google_protobuf_DescriptorProto_options(const google_protobuf_DescriptorProto* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 5424 | const google_protobuf_MessageOptions* default_val = NULL; |
| 5425 | const google_protobuf_MessageOptions* ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5426 | const upb_MiniTableField field = {7, UPB_SIZE(24, 64), 2, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 5427 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 5428 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5429 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5430 | UPB_INLINE bool google_protobuf_DescriptorProto_has_options(const google_protobuf_DescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5431 | const upb_MiniTableField field = {7, UPB_SIZE(24, 64), 2, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 5432 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5433 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5434 | UPB_INLINE void google_protobuf_DescriptorProto_clear_oneof_decl(google_protobuf_DescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5435 | const upb_MiniTableField field = {8, UPB_SIZE(28, 72), 0, 6, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 5436 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5437 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5438 | UPB_INLINE const google_protobuf_OneofDescriptorProto* const* google_protobuf_DescriptorProto_oneof_decl(const google_protobuf_DescriptorProto* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5439 | const upb_MiniTableField field = {8, UPB_SIZE(28, 72), 0, 6, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5440 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 5441 | if (arr) { |
| 5442 | if (size) *size = arr->size; |
| 5443 | return (const google_protobuf_OneofDescriptorProto* const*)_upb_array_constptr(arr); |
| 5444 | } else { |
| 5445 | if (size) *size = 0; |
| 5446 | return NULL; |
| 5447 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5448 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 5449 | UPB_INLINE const upb_Array* _google_protobuf_DescriptorProto_oneof_decl_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5450 | const upb_MiniTableField field = {8, UPB_SIZE(28, 72), 0, 6, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 5451 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 5452 | if (size) { |
| 5453 | *size = arr ? arr->size : 0; |
| 5454 | } |
| 5455 | return arr; |
| 5456 | } |
| 5457 | UPB_INLINE upb_Array* _google_protobuf_DescriptorProto_oneof_decl_mutable_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5458 | const upb_MiniTableField field = {8, UPB_SIZE(28, 72), 0, 6, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 5459 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 5460 | (upb_Message*)msg, &field, arena); |
| 5461 | if (size) { |
| 5462 | *size = arr ? arr->size : 0; |
| 5463 | } |
| 5464 | return arr; |
| 5465 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5466 | UPB_INLINE bool google_protobuf_DescriptorProto_has_oneof_decl(const google_protobuf_DescriptorProto* msg) { |
| 5467 | size_t size; |
| 5468 | google_protobuf_DescriptorProto_oneof_decl(msg, &size); |
| 5469 | return size != 0; |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5470 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5471 | UPB_INLINE void google_protobuf_DescriptorProto_clear_reserved_range(google_protobuf_DescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5472 | const upb_MiniTableField field = {9, UPB_SIZE(32, 80), 0, 7, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 5473 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5474 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5475 | UPB_INLINE const google_protobuf_DescriptorProto_ReservedRange* const* google_protobuf_DescriptorProto_reserved_range(const google_protobuf_DescriptorProto* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5476 | const upb_MiniTableField field = {9, UPB_SIZE(32, 80), 0, 7, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5477 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 5478 | if (arr) { |
| 5479 | if (size) *size = arr->size; |
| 5480 | return (const google_protobuf_DescriptorProto_ReservedRange* const*)_upb_array_constptr(arr); |
| 5481 | } else { |
| 5482 | if (size) *size = 0; |
| 5483 | return NULL; |
| 5484 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5485 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 5486 | UPB_INLINE const upb_Array* _google_protobuf_DescriptorProto_reserved_range_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5487 | const upb_MiniTableField field = {9, UPB_SIZE(32, 80), 0, 7, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 5488 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 5489 | if (size) { |
| 5490 | *size = arr ? arr->size : 0; |
| 5491 | } |
| 5492 | return arr; |
| 5493 | } |
| 5494 | UPB_INLINE upb_Array* _google_protobuf_DescriptorProto_reserved_range_mutable_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5495 | const upb_MiniTableField field = {9, UPB_SIZE(32, 80), 0, 7, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 5496 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 5497 | (upb_Message*)msg, &field, arena); |
| 5498 | if (size) { |
| 5499 | *size = arr ? arr->size : 0; |
| 5500 | } |
| 5501 | return arr; |
| 5502 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5503 | UPB_INLINE bool google_protobuf_DescriptorProto_has_reserved_range(const google_protobuf_DescriptorProto* msg) { |
| 5504 | size_t size; |
| 5505 | google_protobuf_DescriptorProto_reserved_range(msg, &size); |
| 5506 | return size != 0; |
| 5507 | } |
| 5508 | UPB_INLINE void google_protobuf_DescriptorProto_clear_reserved_name(google_protobuf_DescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5509 | const upb_MiniTableField field = {10, UPB_SIZE(36, 88), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 5510 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5511 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5512 | UPB_INLINE upb_StringView const* google_protobuf_DescriptorProto_reserved_name(const google_protobuf_DescriptorProto* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5513 | const upb_MiniTableField field = {10, UPB_SIZE(36, 88), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5514 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 5515 | if (arr) { |
| 5516 | if (size) *size = arr->size; |
| 5517 | return (upb_StringView const*)_upb_array_constptr(arr); |
| 5518 | } else { |
| 5519 | if (size) *size = 0; |
| 5520 | return NULL; |
| 5521 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5522 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 5523 | UPB_INLINE const upb_Array* _google_protobuf_DescriptorProto_reserved_name_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5524 | const upb_MiniTableField field = {10, UPB_SIZE(36, 88), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 5525 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 5526 | if (size) { |
| 5527 | *size = arr ? arr->size : 0; |
| 5528 | } |
| 5529 | return arr; |
| 5530 | } |
| 5531 | UPB_INLINE upb_Array* _google_protobuf_DescriptorProto_reserved_name_mutable_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5532 | const upb_MiniTableField field = {10, UPB_SIZE(36, 88), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 5533 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 5534 | (upb_Message*)msg, &field, arena); |
| 5535 | if (size) { |
| 5536 | *size = arr ? arr->size : 0; |
| 5537 | } |
| 5538 | return arr; |
| 5539 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5540 | UPB_INLINE bool google_protobuf_DescriptorProto_has_reserved_name(const google_protobuf_DescriptorProto* msg) { |
| 5541 | size_t size; |
| 5542 | google_protobuf_DescriptorProto_reserved_name(msg, &size); |
| 5543 | return size != 0; |
| 5544 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5545 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5546 | UPB_INLINE void google_protobuf_DescriptorProto_set_name(google_protobuf_DescriptorProto *msg, upb_StringView value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5547 | const upb_MiniTableField field = {1, UPB_SIZE(40, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 5548 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 5549 | } |
| 5550 | UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_DescriptorProto_mutable_field(google_protobuf_DescriptorProto* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5551 | upb_MiniTableField field = {2, UPB_SIZE(4, 24), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5552 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 5553 | if (arr) { |
| 5554 | if (size) *size = arr->size; |
| 5555 | return (google_protobuf_FieldDescriptorProto**)_upb_array_ptr(arr); |
| 5556 | } else { |
| 5557 | if (size) *size = 0; |
| 5558 | return NULL; |
| 5559 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5560 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5561 | UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_DescriptorProto_resize_field(google_protobuf_DescriptorProto* msg, size_t size, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5562 | upb_MiniTableField field = {2, UPB_SIZE(4, 24), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Jie Luo | f36a5c6 | 2023-05-23 17:56:18 -0700 | [diff] [blame] | 5563 | return (google_protobuf_FieldDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5564 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5565 | UPB_INLINE struct google_protobuf_FieldDescriptorProto* google_protobuf_DescriptorProto_add_field(google_protobuf_DescriptorProto* msg, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5566 | upb_MiniTableField field = {2, UPB_SIZE(4, 24), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5567 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 5568 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 5569 | return NULL; |
| 5570 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5571 | struct google_protobuf_FieldDescriptorProto* sub = (struct google_protobuf_FieldDescriptorProto*)_upb_Message_New(&google_protobuf_FieldDescriptorProto_msg_init, arena); |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5572 | if (!arr || !sub) return NULL; |
| 5573 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5574 | return sub; |
| 5575 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5576 | UPB_INLINE google_protobuf_DescriptorProto** google_protobuf_DescriptorProto_mutable_nested_type(google_protobuf_DescriptorProto* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5577 | upb_MiniTableField field = {3, UPB_SIZE(8, 32), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5578 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 5579 | if (arr) { |
| 5580 | if (size) *size = arr->size; |
| 5581 | return (google_protobuf_DescriptorProto**)_upb_array_ptr(arr); |
| 5582 | } else { |
| 5583 | if (size) *size = 0; |
| 5584 | return NULL; |
| 5585 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5586 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5587 | UPB_INLINE google_protobuf_DescriptorProto** google_protobuf_DescriptorProto_resize_nested_type(google_protobuf_DescriptorProto* msg, size_t size, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5588 | upb_MiniTableField field = {3, UPB_SIZE(8, 32), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Jie Luo | f36a5c6 | 2023-05-23 17:56:18 -0700 | [diff] [blame] | 5589 | return (google_protobuf_DescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5590 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5591 | UPB_INLINE struct google_protobuf_DescriptorProto* google_protobuf_DescriptorProto_add_nested_type(google_protobuf_DescriptorProto* msg, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5592 | upb_MiniTableField field = {3, UPB_SIZE(8, 32), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5593 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 5594 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 5595 | return NULL; |
| 5596 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5597 | struct google_protobuf_DescriptorProto* sub = (struct google_protobuf_DescriptorProto*)_upb_Message_New(&google_protobuf_DescriptorProto_msg_init, arena); |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5598 | if (!arr || !sub) return NULL; |
| 5599 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5600 | return sub; |
| 5601 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5602 | UPB_INLINE google_protobuf_EnumDescriptorProto** google_protobuf_DescriptorProto_mutable_enum_type(google_protobuf_DescriptorProto* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5603 | upb_MiniTableField field = {4, UPB_SIZE(12, 40), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5604 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 5605 | if (arr) { |
| 5606 | if (size) *size = arr->size; |
| 5607 | return (google_protobuf_EnumDescriptorProto**)_upb_array_ptr(arr); |
| 5608 | } else { |
| 5609 | if (size) *size = 0; |
| 5610 | return NULL; |
| 5611 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5612 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5613 | UPB_INLINE google_protobuf_EnumDescriptorProto** google_protobuf_DescriptorProto_resize_enum_type(google_protobuf_DescriptorProto* msg, size_t size, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5614 | upb_MiniTableField field = {4, UPB_SIZE(12, 40), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Jie Luo | f36a5c6 | 2023-05-23 17:56:18 -0700 | [diff] [blame] | 5615 | return (google_protobuf_EnumDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5616 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5617 | UPB_INLINE struct google_protobuf_EnumDescriptorProto* google_protobuf_DescriptorProto_add_enum_type(google_protobuf_DescriptorProto* msg, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5618 | upb_MiniTableField field = {4, UPB_SIZE(12, 40), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5619 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 5620 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 5621 | return NULL; |
| 5622 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5623 | struct google_protobuf_EnumDescriptorProto* sub = (struct google_protobuf_EnumDescriptorProto*)_upb_Message_New(&google_protobuf_EnumDescriptorProto_msg_init, arena); |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5624 | if (!arr || !sub) return NULL; |
| 5625 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5626 | return sub; |
| 5627 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5628 | UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange** google_protobuf_DescriptorProto_mutable_extension_range(google_protobuf_DescriptorProto* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5629 | upb_MiniTableField field = {5, UPB_SIZE(16, 48), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5630 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 5631 | if (arr) { |
| 5632 | if (size) *size = arr->size; |
| 5633 | return (google_protobuf_DescriptorProto_ExtensionRange**)_upb_array_ptr(arr); |
| 5634 | } else { |
| 5635 | if (size) *size = 0; |
| 5636 | return NULL; |
| 5637 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5638 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5639 | UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange** google_protobuf_DescriptorProto_resize_extension_range(google_protobuf_DescriptorProto* msg, size_t size, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5640 | upb_MiniTableField field = {5, UPB_SIZE(16, 48), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Jie Luo | f36a5c6 | 2023-05-23 17:56:18 -0700 | [diff] [blame] | 5641 | return (google_protobuf_DescriptorProto_ExtensionRange**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5642 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5643 | UPB_INLINE struct google_protobuf_DescriptorProto_ExtensionRange* google_protobuf_DescriptorProto_add_extension_range(google_protobuf_DescriptorProto* msg, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5644 | upb_MiniTableField field = {5, UPB_SIZE(16, 48), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5645 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 5646 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 5647 | return NULL; |
| 5648 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5649 | struct google_protobuf_DescriptorProto_ExtensionRange* sub = (struct google_protobuf_DescriptorProto_ExtensionRange*)_upb_Message_New(&google_protobuf_DescriptorProto_ExtensionRange_msg_init, arena); |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5650 | if (!arr || !sub) return NULL; |
| 5651 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5652 | return sub; |
| 5653 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5654 | UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_DescriptorProto_mutable_extension(google_protobuf_DescriptorProto* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5655 | upb_MiniTableField field = {6, UPB_SIZE(20, 56), 0, 4, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5656 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 5657 | if (arr) { |
| 5658 | if (size) *size = arr->size; |
| 5659 | return (google_protobuf_FieldDescriptorProto**)_upb_array_ptr(arr); |
| 5660 | } else { |
| 5661 | if (size) *size = 0; |
| 5662 | return NULL; |
| 5663 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5664 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5665 | UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_DescriptorProto_resize_extension(google_protobuf_DescriptorProto* msg, size_t size, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5666 | upb_MiniTableField field = {6, UPB_SIZE(20, 56), 0, 4, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Jie Luo | f36a5c6 | 2023-05-23 17:56:18 -0700 | [diff] [blame] | 5667 | return (google_protobuf_FieldDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5668 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5669 | UPB_INLINE struct google_protobuf_FieldDescriptorProto* google_protobuf_DescriptorProto_add_extension(google_protobuf_DescriptorProto* msg, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5670 | upb_MiniTableField field = {6, UPB_SIZE(20, 56), 0, 4, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5671 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 5672 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 5673 | return NULL; |
| 5674 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5675 | struct google_protobuf_FieldDescriptorProto* sub = (struct google_protobuf_FieldDescriptorProto*)_upb_Message_New(&google_protobuf_FieldDescriptorProto_msg_init, arena); |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5676 | if (!arr || !sub) return NULL; |
| 5677 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5678 | return sub; |
| 5679 | } |
| 5680 | UPB_INLINE void google_protobuf_DescriptorProto_set_options(google_protobuf_DescriptorProto *msg, google_protobuf_MessageOptions* value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5681 | const upb_MiniTableField field = {7, UPB_SIZE(24, 64), 2, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 5682 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 5683 | } |
| 5684 | UPB_INLINE struct google_protobuf_MessageOptions* google_protobuf_DescriptorProto_mutable_options(google_protobuf_DescriptorProto* msg, upb_Arena* arena) { |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5685 | struct google_protobuf_MessageOptions* sub = (struct google_protobuf_MessageOptions*)google_protobuf_DescriptorProto_options(msg); |
| 5686 | if (sub == NULL) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5687 | sub = (struct google_protobuf_MessageOptions*)_upb_Message_New(&google_protobuf_MessageOptions_msg_init, arena); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 5688 | if (sub) google_protobuf_DescriptorProto_set_options(msg, sub); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5689 | } |
| 5690 | return sub; |
| 5691 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5692 | UPB_INLINE google_protobuf_OneofDescriptorProto** google_protobuf_DescriptorProto_mutable_oneof_decl(google_protobuf_DescriptorProto* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5693 | upb_MiniTableField field = {8, UPB_SIZE(28, 72), 0, 6, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5694 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 5695 | if (arr) { |
| 5696 | if (size) *size = arr->size; |
| 5697 | return (google_protobuf_OneofDescriptorProto**)_upb_array_ptr(arr); |
| 5698 | } else { |
| 5699 | if (size) *size = 0; |
| 5700 | return NULL; |
| 5701 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5702 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5703 | UPB_INLINE google_protobuf_OneofDescriptorProto** google_protobuf_DescriptorProto_resize_oneof_decl(google_protobuf_DescriptorProto* msg, size_t size, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5704 | upb_MiniTableField field = {8, UPB_SIZE(28, 72), 0, 6, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Jie Luo | f36a5c6 | 2023-05-23 17:56:18 -0700 | [diff] [blame] | 5705 | return (google_protobuf_OneofDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5706 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5707 | UPB_INLINE struct google_protobuf_OneofDescriptorProto* google_protobuf_DescriptorProto_add_oneof_decl(google_protobuf_DescriptorProto* msg, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5708 | upb_MiniTableField field = {8, UPB_SIZE(28, 72), 0, 6, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5709 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 5710 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 5711 | return NULL; |
| 5712 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5713 | struct google_protobuf_OneofDescriptorProto* sub = (struct google_protobuf_OneofDescriptorProto*)_upb_Message_New(&google_protobuf_OneofDescriptorProto_msg_init, arena); |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5714 | if (!arr || !sub) return NULL; |
| 5715 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5716 | return sub; |
| 5717 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5718 | UPB_INLINE google_protobuf_DescriptorProto_ReservedRange** google_protobuf_DescriptorProto_mutable_reserved_range(google_protobuf_DescriptorProto* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5719 | upb_MiniTableField field = {9, UPB_SIZE(32, 80), 0, 7, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5720 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 5721 | if (arr) { |
| 5722 | if (size) *size = arr->size; |
| 5723 | return (google_protobuf_DescriptorProto_ReservedRange**)_upb_array_ptr(arr); |
| 5724 | } else { |
| 5725 | if (size) *size = 0; |
| 5726 | return NULL; |
| 5727 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5728 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5729 | UPB_INLINE google_protobuf_DescriptorProto_ReservedRange** google_protobuf_DescriptorProto_resize_reserved_range(google_protobuf_DescriptorProto* msg, size_t size, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5730 | upb_MiniTableField field = {9, UPB_SIZE(32, 80), 0, 7, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Jie Luo | f36a5c6 | 2023-05-23 17:56:18 -0700 | [diff] [blame] | 5731 | return (google_protobuf_DescriptorProto_ReservedRange**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5732 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5733 | UPB_INLINE struct google_protobuf_DescriptorProto_ReservedRange* google_protobuf_DescriptorProto_add_reserved_range(google_protobuf_DescriptorProto* msg, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5734 | upb_MiniTableField field = {9, UPB_SIZE(32, 80), 0, 7, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5735 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 5736 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 5737 | return NULL; |
| 5738 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5739 | struct google_protobuf_DescriptorProto_ReservedRange* sub = (struct google_protobuf_DescriptorProto_ReservedRange*)_upb_Message_New(&google_protobuf_DescriptorProto_ReservedRange_msg_init, arena); |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5740 | if (!arr || !sub) return NULL; |
| 5741 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5742 | return sub; |
| 5743 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5744 | UPB_INLINE upb_StringView* google_protobuf_DescriptorProto_mutable_reserved_name(google_protobuf_DescriptorProto* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5745 | upb_MiniTableField field = {10, UPB_SIZE(36, 88), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5746 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 5747 | if (arr) { |
| 5748 | if (size) *size = arr->size; |
| 5749 | return (upb_StringView*)_upb_array_ptr(arr); |
| 5750 | } else { |
| 5751 | if (size) *size = 0; |
| 5752 | return NULL; |
| 5753 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5754 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5755 | UPB_INLINE upb_StringView* google_protobuf_DescriptorProto_resize_reserved_name(google_protobuf_DescriptorProto* msg, size_t size, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5756 | upb_MiniTableField field = {10, UPB_SIZE(36, 88), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Jie Luo | f36a5c6 | 2023-05-23 17:56:18 -0700 | [diff] [blame] | 5757 | return (upb_StringView*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5758 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5759 | UPB_INLINE bool google_protobuf_DescriptorProto_add_reserved_name(google_protobuf_DescriptorProto* msg, upb_StringView val, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5760 | upb_MiniTableField field = {10, UPB_SIZE(36, 88), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5761 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 5762 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 5763 | return false; |
| 5764 | } |
| 5765 | _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val)); |
| 5766 | return true; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5767 | } |
| 5768 | |
| 5769 | /* google.protobuf.DescriptorProto.ExtensionRange */ |
| 5770 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5771 | UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange* google_protobuf_DescriptorProto_ExtensionRange_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5772 | return (google_protobuf_DescriptorProto_ExtensionRange*)_upb_Message_New(&google_protobuf_DescriptorProto_ExtensionRange_msg_init, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5773 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5774 | UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange* google_protobuf_DescriptorProto_ExtensionRange_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 5775 | google_protobuf_DescriptorProto_ExtensionRange* ret = google_protobuf_DescriptorProto_ExtensionRange_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 5776 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5777 | if (upb_Decode(buf, size, ret, &google_protobuf_DescriptorProto_ExtensionRange_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 5778 | return NULL; |
| 5779 | } |
| 5780 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5781 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5782 | UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange* google_protobuf_DescriptorProto_ExtensionRange_parse_ex(const char* buf, size_t size, |
| 5783 | const upb_ExtensionRegistry* extreg, |
| 5784 | int options, upb_Arena* arena) { |
| 5785 | google_protobuf_DescriptorProto_ExtensionRange* ret = google_protobuf_DescriptorProto_ExtensionRange_new(arena); |
| 5786 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5787 | if (upb_Decode(buf, size, ret, &google_protobuf_DescriptorProto_ExtensionRange_msg_init, extreg, options, arena) != |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5788 | kUpb_DecodeStatus_Ok) { |
| 5789 | return NULL; |
| 5790 | } |
| 5791 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5792 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5793 | UPB_INLINE char* google_protobuf_DescriptorProto_ExtensionRange_serialize(const google_protobuf_DescriptorProto_ExtensionRange* msg, upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5794 | char* ptr; |
| 5795 | (void)upb_Encode(msg, &google_protobuf_DescriptorProto_ExtensionRange_msg_init, 0, arena, &ptr, len); |
| 5796 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5797 | } |
| 5798 | UPB_INLINE char* google_protobuf_DescriptorProto_ExtensionRange_serialize_ex(const google_protobuf_DescriptorProto_ExtensionRange* msg, int options, |
| 5799 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5800 | char* ptr; |
| 5801 | (void)upb_Encode(msg, &google_protobuf_DescriptorProto_ExtensionRange_msg_init, options, arena, &ptr, len); |
| 5802 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5803 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5804 | UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_clear_start(google_protobuf_DescriptorProto_ExtensionRange* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5805 | const upb_MiniTableField field = {1, 4, 1, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 5806 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5807 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5808 | UPB_INLINE int32_t google_protobuf_DescriptorProto_ExtensionRange_start(const google_protobuf_DescriptorProto_ExtensionRange* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 5809 | int32_t default_val = (int32_t)0; |
| 5810 | int32_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5811 | const upb_MiniTableField field = {1, 4, 1, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 5812 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 5813 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5814 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5815 | UPB_INLINE bool google_protobuf_DescriptorProto_ExtensionRange_has_start(const google_protobuf_DescriptorProto_ExtensionRange* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5816 | const upb_MiniTableField field = {1, 4, 1, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 5817 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5818 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5819 | UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_clear_end(google_protobuf_DescriptorProto_ExtensionRange* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5820 | const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 5821 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5822 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5823 | UPB_INLINE int32_t google_protobuf_DescriptorProto_ExtensionRange_end(const google_protobuf_DescriptorProto_ExtensionRange* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 5824 | int32_t default_val = (int32_t)0; |
| 5825 | int32_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5826 | const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 5827 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 5828 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5829 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5830 | UPB_INLINE bool google_protobuf_DescriptorProto_ExtensionRange_has_end(const google_protobuf_DescriptorProto_ExtensionRange* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5831 | const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 5832 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5833 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5834 | UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_clear_options(google_protobuf_DescriptorProto_ExtensionRange* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5835 | const upb_MiniTableField field = {3, UPB_SIZE(12, 16), 3, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 5836 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5837 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5838 | UPB_INLINE const google_protobuf_ExtensionRangeOptions* google_protobuf_DescriptorProto_ExtensionRange_options(const google_protobuf_DescriptorProto_ExtensionRange* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 5839 | const google_protobuf_ExtensionRangeOptions* default_val = NULL; |
| 5840 | const google_protobuf_ExtensionRangeOptions* ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5841 | const upb_MiniTableField field = {3, UPB_SIZE(12, 16), 3, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 5842 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 5843 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5844 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5845 | UPB_INLINE bool google_protobuf_DescriptorProto_ExtensionRange_has_options(const google_protobuf_DescriptorProto_ExtensionRange* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5846 | const upb_MiniTableField field = {3, UPB_SIZE(12, 16), 3, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 5847 | return _upb_Message_HasNonExtensionField(msg, &field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5848 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5849 | |
| 5850 | UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_set_start(google_protobuf_DescriptorProto_ExtensionRange *msg, int32_t value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5851 | const upb_MiniTableField field = {1, 4, 1, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 5852 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 5853 | } |
| 5854 | UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_set_end(google_protobuf_DescriptorProto_ExtensionRange *msg, int32_t value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5855 | const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 5856 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 5857 | } |
| 5858 | UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_set_options(google_protobuf_DescriptorProto_ExtensionRange *msg, google_protobuf_ExtensionRangeOptions* value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5859 | const upb_MiniTableField field = {3, UPB_SIZE(12, 16), 3, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 5860 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 5861 | } |
| 5862 | UPB_INLINE struct google_protobuf_ExtensionRangeOptions* google_protobuf_DescriptorProto_ExtensionRange_mutable_options(google_protobuf_DescriptorProto_ExtensionRange* msg, upb_Arena* arena) { |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5863 | struct google_protobuf_ExtensionRangeOptions* sub = (struct google_protobuf_ExtensionRangeOptions*)google_protobuf_DescriptorProto_ExtensionRange_options(msg); |
| 5864 | if (sub == NULL) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5865 | sub = (struct google_protobuf_ExtensionRangeOptions*)_upb_Message_New(&google_protobuf_ExtensionRangeOptions_msg_init, arena); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 5866 | if (sub) google_protobuf_DescriptorProto_ExtensionRange_set_options(msg, sub); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5867 | } |
| 5868 | return sub; |
| 5869 | } |
| 5870 | |
| 5871 | /* google.protobuf.DescriptorProto.ReservedRange */ |
| 5872 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5873 | UPB_INLINE google_protobuf_DescriptorProto_ReservedRange* google_protobuf_DescriptorProto_ReservedRange_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5874 | return (google_protobuf_DescriptorProto_ReservedRange*)_upb_Message_New(&google_protobuf_DescriptorProto_ReservedRange_msg_init, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5875 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5876 | UPB_INLINE google_protobuf_DescriptorProto_ReservedRange* google_protobuf_DescriptorProto_ReservedRange_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 5877 | google_protobuf_DescriptorProto_ReservedRange* ret = google_protobuf_DescriptorProto_ReservedRange_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 5878 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5879 | if (upb_Decode(buf, size, ret, &google_protobuf_DescriptorProto_ReservedRange_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 5880 | return NULL; |
| 5881 | } |
| 5882 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5883 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5884 | UPB_INLINE google_protobuf_DescriptorProto_ReservedRange* google_protobuf_DescriptorProto_ReservedRange_parse_ex(const char* buf, size_t size, |
| 5885 | const upb_ExtensionRegistry* extreg, |
| 5886 | int options, upb_Arena* arena) { |
| 5887 | google_protobuf_DescriptorProto_ReservedRange* ret = google_protobuf_DescriptorProto_ReservedRange_new(arena); |
| 5888 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5889 | if (upb_Decode(buf, size, ret, &google_protobuf_DescriptorProto_ReservedRange_msg_init, extreg, options, arena) != |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5890 | kUpb_DecodeStatus_Ok) { |
| 5891 | return NULL; |
| 5892 | } |
| 5893 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5894 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5895 | UPB_INLINE char* google_protobuf_DescriptorProto_ReservedRange_serialize(const google_protobuf_DescriptorProto_ReservedRange* msg, upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5896 | char* ptr; |
| 5897 | (void)upb_Encode(msg, &google_protobuf_DescriptorProto_ReservedRange_msg_init, 0, arena, &ptr, len); |
| 5898 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5899 | } |
| 5900 | UPB_INLINE char* google_protobuf_DescriptorProto_ReservedRange_serialize_ex(const google_protobuf_DescriptorProto_ReservedRange* msg, int options, |
| 5901 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5902 | char* ptr; |
| 5903 | (void)upb_Encode(msg, &google_protobuf_DescriptorProto_ReservedRange_msg_init, options, arena, &ptr, len); |
| 5904 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5905 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5906 | UPB_INLINE void google_protobuf_DescriptorProto_ReservedRange_clear_start(google_protobuf_DescriptorProto_ReservedRange* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5907 | const upb_MiniTableField field = {1, 4, 1, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 5908 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5909 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5910 | UPB_INLINE int32_t google_protobuf_DescriptorProto_ReservedRange_start(const google_protobuf_DescriptorProto_ReservedRange* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 5911 | int32_t default_val = (int32_t)0; |
| 5912 | int32_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5913 | const upb_MiniTableField field = {1, 4, 1, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 5914 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 5915 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5916 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5917 | UPB_INLINE bool google_protobuf_DescriptorProto_ReservedRange_has_start(const google_protobuf_DescriptorProto_ReservedRange* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5918 | const upb_MiniTableField field = {1, 4, 1, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 5919 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5920 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5921 | UPB_INLINE void google_protobuf_DescriptorProto_ReservedRange_clear_end(google_protobuf_DescriptorProto_ReservedRange* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5922 | const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 5923 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5924 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5925 | UPB_INLINE int32_t google_protobuf_DescriptorProto_ReservedRange_end(const google_protobuf_DescriptorProto_ReservedRange* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 5926 | int32_t default_val = (int32_t)0; |
| 5927 | int32_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5928 | const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 5929 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 5930 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5931 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5932 | UPB_INLINE bool google_protobuf_DescriptorProto_ReservedRange_has_end(const google_protobuf_DescriptorProto_ReservedRange* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5933 | const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 5934 | return _upb_Message_HasNonExtensionField(msg, &field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5935 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5936 | |
| 5937 | UPB_INLINE void google_protobuf_DescriptorProto_ReservedRange_set_start(google_protobuf_DescriptorProto_ReservedRange *msg, int32_t value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5938 | const upb_MiniTableField field = {1, 4, 1, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 5939 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 5940 | } |
| 5941 | UPB_INLINE void google_protobuf_DescriptorProto_ReservedRange_set_end(google_protobuf_DescriptorProto_ReservedRange *msg, int32_t value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5942 | const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 5943 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5944 | } |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 5945 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5946 | /* google.protobuf.ExtensionRangeOptions */ |
| 5947 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5948 | UPB_INLINE google_protobuf_ExtensionRangeOptions* google_protobuf_ExtensionRangeOptions_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5949 | return (google_protobuf_ExtensionRangeOptions*)_upb_Message_New(&google_protobuf_ExtensionRangeOptions_msg_init, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5950 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5951 | UPB_INLINE google_protobuf_ExtensionRangeOptions* google_protobuf_ExtensionRangeOptions_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 5952 | google_protobuf_ExtensionRangeOptions* ret = google_protobuf_ExtensionRangeOptions_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 5953 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5954 | if (upb_Decode(buf, size, ret, &google_protobuf_ExtensionRangeOptions_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 5955 | return NULL; |
| 5956 | } |
| 5957 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5958 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5959 | UPB_INLINE google_protobuf_ExtensionRangeOptions* google_protobuf_ExtensionRangeOptions_parse_ex(const char* buf, size_t size, |
| 5960 | const upb_ExtensionRegistry* extreg, |
| 5961 | int options, upb_Arena* arena) { |
| 5962 | google_protobuf_ExtensionRangeOptions* ret = google_protobuf_ExtensionRangeOptions_new(arena); |
| 5963 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5964 | if (upb_Decode(buf, size, ret, &google_protobuf_ExtensionRangeOptions_msg_init, extreg, options, arena) != |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5965 | kUpb_DecodeStatus_Ok) { |
| 5966 | return NULL; |
| 5967 | } |
| 5968 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5969 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5970 | UPB_INLINE char* google_protobuf_ExtensionRangeOptions_serialize(const google_protobuf_ExtensionRangeOptions* msg, upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5971 | char* ptr; |
| 5972 | (void)upb_Encode(msg, &google_protobuf_ExtensionRangeOptions_msg_init, 0, arena, &ptr, len); |
| 5973 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5974 | } |
| 5975 | UPB_INLINE char* google_protobuf_ExtensionRangeOptions_serialize_ex(const google_protobuf_ExtensionRangeOptions* msg, int options, |
| 5976 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5977 | char* ptr; |
| 5978 | (void)upb_Encode(msg, &google_protobuf_ExtensionRangeOptions_msg_init, options, arena, &ptr, len); |
| 5979 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5980 | } |
Mike Kruskal | 145900f | 2023-03-27 09:55:52 -0700 | [diff] [blame] | 5981 | UPB_INLINE void google_protobuf_ExtensionRangeOptions_clear_declaration(google_protobuf_ExtensionRangeOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5982 | const upb_MiniTableField field = {2, UPB_SIZE(4, 8), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 145900f | 2023-03-27 09:55:52 -0700 | [diff] [blame] | 5983 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 5984 | } |
| 5985 | UPB_INLINE const google_protobuf_ExtensionRangeOptions_Declaration* const* google_protobuf_ExtensionRangeOptions_declaration(const google_protobuf_ExtensionRangeOptions* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5986 | const upb_MiniTableField field = {2, UPB_SIZE(4, 8), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 145900f | 2023-03-27 09:55:52 -0700 | [diff] [blame] | 5987 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 5988 | if (arr) { |
| 5989 | if (size) *size = arr->size; |
| 5990 | return (const google_protobuf_ExtensionRangeOptions_Declaration* const*)_upb_array_constptr(arr); |
| 5991 | } else { |
| 5992 | if (size) *size = 0; |
| 5993 | return NULL; |
| 5994 | } |
| 5995 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 5996 | UPB_INLINE const upb_Array* _google_protobuf_ExtensionRangeOptions_declaration_upb_array(const google_protobuf_ExtensionRangeOptions* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5997 | const upb_MiniTableField field = {2, UPB_SIZE(4, 8), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 5998 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 5999 | if (size) { |
| 6000 | *size = arr ? arr->size : 0; |
| 6001 | } |
| 6002 | return arr; |
| 6003 | } |
| 6004 | UPB_INLINE upb_Array* _google_protobuf_ExtensionRangeOptions_declaration_mutable_upb_array(const google_protobuf_ExtensionRangeOptions* msg, size_t* size, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6005 | const upb_MiniTableField field = {2, UPB_SIZE(4, 8), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 6006 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 6007 | (upb_Message*)msg, &field, arena); |
| 6008 | if (size) { |
| 6009 | *size = arr ? arr->size : 0; |
| 6010 | } |
| 6011 | return arr; |
| 6012 | } |
Mike Kruskal | 145900f | 2023-03-27 09:55:52 -0700 | [diff] [blame] | 6013 | UPB_INLINE bool google_protobuf_ExtensionRangeOptions_has_declaration(const google_protobuf_ExtensionRangeOptions* msg) { |
| 6014 | size_t size; |
| 6015 | google_protobuf_ExtensionRangeOptions_declaration(msg, &size); |
| 6016 | return size != 0; |
| 6017 | } |
Protobuf Team Bot | 469f027 | 2023-04-21 18:12:45 -0700 | [diff] [blame] | 6018 | UPB_INLINE void google_protobuf_ExtensionRangeOptions_clear_verification(google_protobuf_ExtensionRangeOptions* msg) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 6019 | const upb_MiniTableField field = {3, UPB_SIZE(8, 4), 1, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Protobuf Team Bot | 469f027 | 2023-04-21 18:12:45 -0700 | [diff] [blame] | 6020 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 6021 | } |
| 6022 | UPB_INLINE int32_t google_protobuf_ExtensionRangeOptions_verification(const google_protobuf_ExtensionRangeOptions* msg) { |
| 6023 | int32_t default_val = 1; |
| 6024 | int32_t ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 6025 | const upb_MiniTableField field = {3, UPB_SIZE(8, 4), 1, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Protobuf Team Bot | 469f027 | 2023-04-21 18:12:45 -0700 | [diff] [blame] | 6026 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 6027 | return ret; |
| 6028 | } |
| 6029 | UPB_INLINE bool google_protobuf_ExtensionRangeOptions_has_verification(const google_protobuf_ExtensionRangeOptions* msg) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 6030 | const upb_MiniTableField field = {3, UPB_SIZE(8, 4), 1, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
| 6031 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 6032 | } |
| 6033 | UPB_INLINE void google_protobuf_ExtensionRangeOptions_clear_features(google_protobuf_ExtensionRangeOptions* msg) { |
| 6034 | const upb_MiniTableField field = {50, UPB_SIZE(12, 16), 2, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
| 6035 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 6036 | } |
| 6037 | UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_ExtensionRangeOptions_features(const google_protobuf_ExtensionRangeOptions* msg) { |
| 6038 | const google_protobuf_FeatureSet* default_val = NULL; |
| 6039 | const google_protobuf_FeatureSet* ret; |
| 6040 | const upb_MiniTableField field = {50, UPB_SIZE(12, 16), 2, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
| 6041 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 6042 | return ret; |
| 6043 | } |
| 6044 | UPB_INLINE bool google_protobuf_ExtensionRangeOptions_has_features(const google_protobuf_ExtensionRangeOptions* msg) { |
| 6045 | const upb_MiniTableField field = {50, UPB_SIZE(12, 16), 2, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Protobuf Team Bot | 469f027 | 2023-04-21 18:12:45 -0700 | [diff] [blame] | 6046 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 6047 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6048 | UPB_INLINE void google_protobuf_ExtensionRangeOptions_clear_uninterpreted_option(google_protobuf_ExtensionRangeOptions* msg) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 6049 | const upb_MiniTableField field = {999, UPB_SIZE(16, 24), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 6050 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6051 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 6052 | UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_ExtensionRangeOptions_uninterpreted_option(const google_protobuf_ExtensionRangeOptions* msg, size_t* size) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 6053 | const upb_MiniTableField field = {999, UPB_SIZE(16, 24), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 6054 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 6055 | if (arr) { |
| 6056 | if (size) *size = arr->size; |
| 6057 | return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr); |
| 6058 | } else { |
| 6059 | if (size) *size = 0; |
| 6060 | return NULL; |
| 6061 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6062 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 6063 | UPB_INLINE const upb_Array* _google_protobuf_ExtensionRangeOptions_uninterpreted_option_upb_array(const google_protobuf_ExtensionRangeOptions* msg, size_t* size) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 6064 | const upb_MiniTableField field = {999, UPB_SIZE(16, 24), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 6065 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 6066 | if (size) { |
| 6067 | *size = arr ? arr->size : 0; |
| 6068 | } |
| 6069 | return arr; |
| 6070 | } |
| 6071 | UPB_INLINE upb_Array* _google_protobuf_ExtensionRangeOptions_uninterpreted_option_mutable_upb_array(const google_protobuf_ExtensionRangeOptions* msg, size_t* size, upb_Arena* arena) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 6072 | const upb_MiniTableField field = {999, UPB_SIZE(16, 24), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 6073 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 6074 | (upb_Message*)msg, &field, arena); |
| 6075 | if (size) { |
| 6076 | *size = arr ? arr->size : 0; |
| 6077 | } |
| 6078 | return arr; |
| 6079 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6080 | UPB_INLINE bool google_protobuf_ExtensionRangeOptions_has_uninterpreted_option(const google_protobuf_ExtensionRangeOptions* msg) { |
| 6081 | size_t size; |
| 6082 | google_protobuf_ExtensionRangeOptions_uninterpreted_option(msg, &size); |
| 6083 | return size != 0; |
| 6084 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6085 | |
Mike Kruskal | 145900f | 2023-03-27 09:55:52 -0700 | [diff] [blame] | 6086 | UPB_INLINE google_protobuf_ExtensionRangeOptions_Declaration** google_protobuf_ExtensionRangeOptions_mutable_declaration(google_protobuf_ExtensionRangeOptions* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6087 | upb_MiniTableField field = {2, UPB_SIZE(4, 8), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 145900f | 2023-03-27 09:55:52 -0700 | [diff] [blame] | 6088 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 6089 | if (arr) { |
| 6090 | if (size) *size = arr->size; |
| 6091 | return (google_protobuf_ExtensionRangeOptions_Declaration**)_upb_array_ptr(arr); |
| 6092 | } else { |
| 6093 | if (size) *size = 0; |
| 6094 | return NULL; |
| 6095 | } |
| 6096 | } |
| 6097 | UPB_INLINE google_protobuf_ExtensionRangeOptions_Declaration** google_protobuf_ExtensionRangeOptions_resize_declaration(google_protobuf_ExtensionRangeOptions* msg, size_t size, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6098 | upb_MiniTableField field = {2, UPB_SIZE(4, 8), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Jie Luo | f36a5c6 | 2023-05-23 17:56:18 -0700 | [diff] [blame] | 6099 | return (google_protobuf_ExtensionRangeOptions_Declaration**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Mike Kruskal | 145900f | 2023-03-27 09:55:52 -0700 | [diff] [blame] | 6100 | } |
| 6101 | UPB_INLINE struct google_protobuf_ExtensionRangeOptions_Declaration* google_protobuf_ExtensionRangeOptions_add_declaration(google_protobuf_ExtensionRangeOptions* msg, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6102 | upb_MiniTableField field = {2, UPB_SIZE(4, 8), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 145900f | 2023-03-27 09:55:52 -0700 | [diff] [blame] | 6103 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 6104 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 6105 | return NULL; |
| 6106 | } |
| 6107 | struct google_protobuf_ExtensionRangeOptions_Declaration* sub = (struct google_protobuf_ExtensionRangeOptions_Declaration*)_upb_Message_New(&google_protobuf_ExtensionRangeOptions_Declaration_msg_init, arena); |
| 6108 | if (!arr || !sub) return NULL; |
| 6109 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
| 6110 | return sub; |
| 6111 | } |
Protobuf Team Bot | 469f027 | 2023-04-21 18:12:45 -0700 | [diff] [blame] | 6112 | UPB_INLINE void google_protobuf_ExtensionRangeOptions_set_verification(google_protobuf_ExtensionRangeOptions *msg, int32_t value) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 6113 | const upb_MiniTableField field = {3, UPB_SIZE(8, 4), 1, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Protobuf Team Bot | 469f027 | 2023-04-21 18:12:45 -0700 | [diff] [blame] | 6114 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 6115 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 6116 | UPB_INLINE void google_protobuf_ExtensionRangeOptions_set_features(google_protobuf_ExtensionRangeOptions *msg, google_protobuf_FeatureSet* value) { |
| 6117 | const upb_MiniTableField field = {50, UPB_SIZE(12, 16), 2, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
| 6118 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 6119 | } |
| 6120 | UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_ExtensionRangeOptions_mutable_features(google_protobuf_ExtensionRangeOptions* msg, upb_Arena* arena) { |
| 6121 | struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_ExtensionRangeOptions_features(msg); |
| 6122 | if (sub == NULL) { |
| 6123 | sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google_protobuf_FeatureSet_msg_init, arena); |
| 6124 | if (sub) google_protobuf_ExtensionRangeOptions_set_features(msg, sub); |
| 6125 | } |
| 6126 | return sub; |
| 6127 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 6128 | UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_ExtensionRangeOptions_mutable_uninterpreted_option(google_protobuf_ExtensionRangeOptions* msg, size_t* size) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 6129 | upb_MiniTableField field = {999, UPB_SIZE(16, 24), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 6130 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 6131 | if (arr) { |
| 6132 | if (size) *size = arr->size; |
| 6133 | return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr); |
| 6134 | } else { |
| 6135 | if (size) *size = 0; |
| 6136 | return NULL; |
| 6137 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6138 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 6139 | UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_ExtensionRangeOptions_resize_uninterpreted_option(google_protobuf_ExtensionRangeOptions* msg, size_t size, upb_Arena* arena) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 6140 | upb_MiniTableField field = {999, UPB_SIZE(16, 24), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Jie Luo | f36a5c6 | 2023-05-23 17:56:18 -0700 | [diff] [blame] | 6141 | return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6142 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6143 | UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_ExtensionRangeOptions_add_uninterpreted_option(google_protobuf_ExtensionRangeOptions* msg, upb_Arena* arena) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 6144 | upb_MiniTableField field = {999, UPB_SIZE(16, 24), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 6145 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 6146 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 6147 | return NULL; |
| 6148 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6149 | struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)_upb_Message_New(&google_protobuf_UninterpretedOption_msg_init, arena); |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 6150 | if (!arr || !sub) return NULL; |
| 6151 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6152 | return sub; |
| 6153 | } |
| 6154 | |
Mike Kruskal | 145900f | 2023-03-27 09:55:52 -0700 | [diff] [blame] | 6155 | /* google.protobuf.ExtensionRangeOptions.Declaration */ |
| 6156 | |
| 6157 | UPB_INLINE google_protobuf_ExtensionRangeOptions_Declaration* google_protobuf_ExtensionRangeOptions_Declaration_new(upb_Arena* arena) { |
| 6158 | return (google_protobuf_ExtensionRangeOptions_Declaration*)_upb_Message_New(&google_protobuf_ExtensionRangeOptions_Declaration_msg_init, arena); |
| 6159 | } |
| 6160 | UPB_INLINE google_protobuf_ExtensionRangeOptions_Declaration* google_protobuf_ExtensionRangeOptions_Declaration_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 6161 | google_protobuf_ExtensionRangeOptions_Declaration* ret = google_protobuf_ExtensionRangeOptions_Declaration_new(arena); |
| 6162 | if (!ret) return NULL; |
| 6163 | if (upb_Decode(buf, size, ret, &google_protobuf_ExtensionRangeOptions_Declaration_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { |
| 6164 | return NULL; |
| 6165 | } |
| 6166 | return ret; |
| 6167 | } |
| 6168 | UPB_INLINE google_protobuf_ExtensionRangeOptions_Declaration* google_protobuf_ExtensionRangeOptions_Declaration_parse_ex(const char* buf, size_t size, |
| 6169 | const upb_ExtensionRegistry* extreg, |
| 6170 | int options, upb_Arena* arena) { |
| 6171 | google_protobuf_ExtensionRangeOptions_Declaration* ret = google_protobuf_ExtensionRangeOptions_Declaration_new(arena); |
| 6172 | if (!ret) return NULL; |
| 6173 | if (upb_Decode(buf, size, ret, &google_protobuf_ExtensionRangeOptions_Declaration_msg_init, extreg, options, arena) != |
| 6174 | kUpb_DecodeStatus_Ok) { |
| 6175 | return NULL; |
| 6176 | } |
| 6177 | return ret; |
| 6178 | } |
| 6179 | UPB_INLINE char* google_protobuf_ExtensionRangeOptions_Declaration_serialize(const google_protobuf_ExtensionRangeOptions_Declaration* msg, upb_Arena* arena, size_t* len) { |
| 6180 | char* ptr; |
| 6181 | (void)upb_Encode(msg, &google_protobuf_ExtensionRangeOptions_Declaration_msg_init, 0, arena, &ptr, len); |
| 6182 | return ptr; |
| 6183 | } |
| 6184 | UPB_INLINE char* google_protobuf_ExtensionRangeOptions_Declaration_serialize_ex(const google_protobuf_ExtensionRangeOptions_Declaration* msg, int options, |
| 6185 | upb_Arena* arena, size_t* len) { |
| 6186 | char* ptr; |
| 6187 | (void)upb_Encode(msg, &google_protobuf_ExtensionRangeOptions_Declaration_msg_init, options, arena, &ptr, len); |
| 6188 | return ptr; |
| 6189 | } |
| 6190 | UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_clear_number(google_protobuf_ExtensionRangeOptions_Declaration* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6191 | const upb_MiniTableField field = {1, 4, 1, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 145900f | 2023-03-27 09:55:52 -0700 | [diff] [blame] | 6192 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 6193 | } |
| 6194 | UPB_INLINE int32_t google_protobuf_ExtensionRangeOptions_Declaration_number(const google_protobuf_ExtensionRangeOptions_Declaration* msg) { |
| 6195 | int32_t default_val = (int32_t)0; |
| 6196 | int32_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6197 | const upb_MiniTableField field = {1, 4, 1, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 145900f | 2023-03-27 09:55:52 -0700 | [diff] [blame] | 6198 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 6199 | return ret; |
| 6200 | } |
| 6201 | UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_has_number(const google_protobuf_ExtensionRangeOptions_Declaration* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6202 | const upb_MiniTableField field = {1, 4, 1, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 145900f | 2023-03-27 09:55:52 -0700 | [diff] [blame] | 6203 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 6204 | } |
| 6205 | UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_clear_full_name(google_protobuf_ExtensionRangeOptions_Declaration* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6206 | const upb_MiniTableField field = {2, UPB_SIZE(12, 16), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 145900f | 2023-03-27 09:55:52 -0700 | [diff] [blame] | 6207 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 6208 | } |
| 6209 | UPB_INLINE upb_StringView google_protobuf_ExtensionRangeOptions_Declaration_full_name(const google_protobuf_ExtensionRangeOptions_Declaration* msg) { |
| 6210 | upb_StringView default_val = upb_StringView_FromString(""); |
| 6211 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6212 | const upb_MiniTableField field = {2, UPB_SIZE(12, 16), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 145900f | 2023-03-27 09:55:52 -0700 | [diff] [blame] | 6213 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 6214 | return ret; |
| 6215 | } |
| 6216 | UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_has_full_name(const google_protobuf_ExtensionRangeOptions_Declaration* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6217 | const upb_MiniTableField field = {2, UPB_SIZE(12, 16), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 145900f | 2023-03-27 09:55:52 -0700 | [diff] [blame] | 6218 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 6219 | } |
| 6220 | UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_clear_type(google_protobuf_ExtensionRangeOptions_Declaration* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6221 | const upb_MiniTableField field = {3, UPB_SIZE(20, 32), 3, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 145900f | 2023-03-27 09:55:52 -0700 | [diff] [blame] | 6222 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 6223 | } |
| 6224 | UPB_INLINE upb_StringView google_protobuf_ExtensionRangeOptions_Declaration_type(const google_protobuf_ExtensionRangeOptions_Declaration* msg) { |
| 6225 | upb_StringView default_val = upb_StringView_FromString(""); |
| 6226 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6227 | const upb_MiniTableField field = {3, UPB_SIZE(20, 32), 3, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 145900f | 2023-03-27 09:55:52 -0700 | [diff] [blame] | 6228 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 6229 | return ret; |
| 6230 | } |
| 6231 | UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_has_type(const google_protobuf_ExtensionRangeOptions_Declaration* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6232 | const upb_MiniTableField field = {3, UPB_SIZE(20, 32), 3, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 145900f | 2023-03-27 09:55:52 -0700 | [diff] [blame] | 6233 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 6234 | } |
Protobuf Team Bot | 41287bd | 2023-04-10 18:57:14 -0700 | [diff] [blame] | 6235 | UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_clear_reserved(google_protobuf_ExtensionRangeOptions_Declaration* msg) { |
Sandy Zhang | 96c601d | 2023-07-05 12:39:20 -0700 | [diff] [blame] | 6236 | const upb_MiniTableField field = {5, 8, 4, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Protobuf Team Bot | 41287bd | 2023-04-10 18:57:14 -0700 | [diff] [blame] | 6237 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 6238 | } |
| 6239 | UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_reserved(const google_protobuf_ExtensionRangeOptions_Declaration* msg) { |
| 6240 | bool default_val = false; |
| 6241 | bool ret; |
Sandy Zhang | 96c601d | 2023-07-05 12:39:20 -0700 | [diff] [blame] | 6242 | const upb_MiniTableField field = {5, 8, 4, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Protobuf Team Bot | 41287bd | 2023-04-10 18:57:14 -0700 | [diff] [blame] | 6243 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 6244 | return ret; |
| 6245 | } |
| 6246 | UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_has_reserved(const google_protobuf_ExtensionRangeOptions_Declaration* msg) { |
Sandy Zhang | 96c601d | 2023-07-05 12:39:20 -0700 | [diff] [blame] | 6247 | const upb_MiniTableField field = {5, 8, 4, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Protobuf Team Bot | 41287bd | 2023-04-10 18:57:14 -0700 | [diff] [blame] | 6248 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 6249 | } |
Protobuf Team Bot | 469f027 | 2023-04-21 18:12:45 -0700 | [diff] [blame] | 6250 | UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_clear_repeated(google_protobuf_ExtensionRangeOptions_Declaration* msg) { |
Sandy Zhang | 96c601d | 2023-07-05 12:39:20 -0700 | [diff] [blame] | 6251 | const upb_MiniTableField field = {6, 9, 5, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Protobuf Team Bot | 469f027 | 2023-04-21 18:12:45 -0700 | [diff] [blame] | 6252 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 6253 | } |
| 6254 | UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_repeated(const google_protobuf_ExtensionRangeOptions_Declaration* msg) { |
| 6255 | bool default_val = false; |
| 6256 | bool ret; |
Sandy Zhang | 96c601d | 2023-07-05 12:39:20 -0700 | [diff] [blame] | 6257 | const upb_MiniTableField field = {6, 9, 5, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Protobuf Team Bot | 469f027 | 2023-04-21 18:12:45 -0700 | [diff] [blame] | 6258 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 6259 | return ret; |
| 6260 | } |
| 6261 | UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_has_repeated(const google_protobuf_ExtensionRangeOptions_Declaration* msg) { |
Sandy Zhang | 96c601d | 2023-07-05 12:39:20 -0700 | [diff] [blame] | 6262 | const upb_MiniTableField field = {6, 9, 5, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Protobuf Team Bot | 469f027 | 2023-04-21 18:12:45 -0700 | [diff] [blame] | 6263 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 6264 | } |
Mike Kruskal | 145900f | 2023-03-27 09:55:52 -0700 | [diff] [blame] | 6265 | |
| 6266 | UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_set_number(google_protobuf_ExtensionRangeOptions_Declaration *msg, int32_t value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6267 | const upb_MiniTableField field = {1, 4, 1, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 145900f | 2023-03-27 09:55:52 -0700 | [diff] [blame] | 6268 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 6269 | } |
| 6270 | UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_set_full_name(google_protobuf_ExtensionRangeOptions_Declaration *msg, upb_StringView value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6271 | const upb_MiniTableField field = {2, UPB_SIZE(12, 16), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 145900f | 2023-03-27 09:55:52 -0700 | [diff] [blame] | 6272 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 6273 | } |
| 6274 | UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_set_type(google_protobuf_ExtensionRangeOptions_Declaration *msg, upb_StringView value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6275 | const upb_MiniTableField field = {3, UPB_SIZE(20, 32), 3, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 145900f | 2023-03-27 09:55:52 -0700 | [diff] [blame] | 6276 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 6277 | } |
Protobuf Team Bot | 41287bd | 2023-04-10 18:57:14 -0700 | [diff] [blame] | 6278 | UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_set_reserved(google_protobuf_ExtensionRangeOptions_Declaration *msg, bool value) { |
Sandy Zhang | 96c601d | 2023-07-05 12:39:20 -0700 | [diff] [blame] | 6279 | const upb_MiniTableField field = {5, 8, 4, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Protobuf Team Bot | 41287bd | 2023-04-10 18:57:14 -0700 | [diff] [blame] | 6280 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 6281 | } |
Protobuf Team Bot | 469f027 | 2023-04-21 18:12:45 -0700 | [diff] [blame] | 6282 | UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_set_repeated(google_protobuf_ExtensionRangeOptions_Declaration *msg, bool value) { |
Sandy Zhang | 96c601d | 2023-07-05 12:39:20 -0700 | [diff] [blame] | 6283 | const upb_MiniTableField field = {6, 9, 5, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Protobuf Team Bot | 469f027 | 2023-04-21 18:12:45 -0700 | [diff] [blame] | 6284 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 6285 | } |
Mike Kruskal | 145900f | 2023-03-27 09:55:52 -0700 | [diff] [blame] | 6286 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6287 | /* google.protobuf.FieldDescriptorProto */ |
| 6288 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6289 | UPB_INLINE google_protobuf_FieldDescriptorProto* google_protobuf_FieldDescriptorProto_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6290 | return (google_protobuf_FieldDescriptorProto*)_upb_Message_New(&google_protobuf_FieldDescriptorProto_msg_init, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6291 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6292 | UPB_INLINE google_protobuf_FieldDescriptorProto* google_protobuf_FieldDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 6293 | google_protobuf_FieldDescriptorProto* ret = google_protobuf_FieldDescriptorProto_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 6294 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6295 | if (upb_Decode(buf, size, ret, &google_protobuf_FieldDescriptorProto_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 6296 | return NULL; |
| 6297 | } |
| 6298 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6299 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6300 | UPB_INLINE google_protobuf_FieldDescriptorProto* google_protobuf_FieldDescriptorProto_parse_ex(const char* buf, size_t size, |
| 6301 | const upb_ExtensionRegistry* extreg, |
| 6302 | int options, upb_Arena* arena) { |
| 6303 | google_protobuf_FieldDescriptorProto* ret = google_protobuf_FieldDescriptorProto_new(arena); |
| 6304 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6305 | if (upb_Decode(buf, size, ret, &google_protobuf_FieldDescriptorProto_msg_init, extreg, options, arena) != |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6306 | kUpb_DecodeStatus_Ok) { |
| 6307 | return NULL; |
| 6308 | } |
| 6309 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6310 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6311 | UPB_INLINE char* google_protobuf_FieldDescriptorProto_serialize(const google_protobuf_FieldDescriptorProto* msg, upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6312 | char* ptr; |
| 6313 | (void)upb_Encode(msg, &google_protobuf_FieldDescriptorProto_msg_init, 0, arena, &ptr, len); |
| 6314 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6315 | } |
| 6316 | UPB_INLINE char* google_protobuf_FieldDescriptorProto_serialize_ex(const google_protobuf_FieldDescriptorProto* msg, int options, |
| 6317 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6318 | char* ptr; |
| 6319 | (void)upb_Encode(msg, &google_protobuf_FieldDescriptorProto_msg_init, options, arena, &ptr, len); |
| 6320 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6321 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6322 | UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_name(google_protobuf_FieldDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6323 | const upb_MiniTableField field = {1, UPB_SIZE(28, 24), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 6324 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6325 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6326 | UPB_INLINE upb_StringView google_protobuf_FieldDescriptorProto_name(const google_protobuf_FieldDescriptorProto* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6327 | upb_StringView default_val = upb_StringView_FromString(""); |
| 6328 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6329 | const upb_MiniTableField field = {1, UPB_SIZE(28, 24), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 6330 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6331 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6332 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6333 | UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_name(const google_protobuf_FieldDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6334 | const upb_MiniTableField field = {1, UPB_SIZE(28, 24), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 6335 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6336 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6337 | UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_extendee(google_protobuf_FieldDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6338 | const upb_MiniTableField field = {2, UPB_SIZE(36, 40), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 6339 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6340 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6341 | UPB_INLINE upb_StringView google_protobuf_FieldDescriptorProto_extendee(const google_protobuf_FieldDescriptorProto* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6342 | upb_StringView default_val = upb_StringView_FromString(""); |
| 6343 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6344 | const upb_MiniTableField field = {2, UPB_SIZE(36, 40), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 6345 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6346 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6347 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6348 | UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_extendee(const google_protobuf_FieldDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6349 | const upb_MiniTableField field = {2, UPB_SIZE(36, 40), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 6350 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6351 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6352 | UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_number(google_protobuf_FieldDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6353 | const upb_MiniTableField field = {3, 4, 3, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 6354 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6355 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6356 | UPB_INLINE int32_t google_protobuf_FieldDescriptorProto_number(const google_protobuf_FieldDescriptorProto* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6357 | int32_t default_val = (int32_t)0; |
| 6358 | int32_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6359 | const upb_MiniTableField field = {3, 4, 3, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 6360 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6361 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6362 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6363 | UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_number(const google_protobuf_FieldDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6364 | const upb_MiniTableField field = {3, 4, 3, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 6365 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6366 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6367 | UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_label(google_protobuf_FieldDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6368 | const upb_MiniTableField field = {4, 8, 4, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 6369 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6370 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6371 | UPB_INLINE int32_t google_protobuf_FieldDescriptorProto_label(const google_protobuf_FieldDescriptorProto* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6372 | int32_t default_val = 1; |
| 6373 | int32_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6374 | const upb_MiniTableField field = {4, 8, 4, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 6375 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6376 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6377 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6378 | UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_label(const google_protobuf_FieldDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6379 | const upb_MiniTableField field = {4, 8, 4, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 6380 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6381 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6382 | UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_type(google_protobuf_FieldDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6383 | const upb_MiniTableField field = {5, 12, 5, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 6384 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6385 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6386 | UPB_INLINE int32_t google_protobuf_FieldDescriptorProto_type(const google_protobuf_FieldDescriptorProto* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6387 | int32_t default_val = 1; |
| 6388 | int32_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6389 | const upb_MiniTableField field = {5, 12, 5, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 6390 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6391 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6392 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6393 | UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_type(const google_protobuf_FieldDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6394 | const upb_MiniTableField field = {5, 12, 5, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 6395 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6396 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6397 | UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_type_name(google_protobuf_FieldDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6398 | const upb_MiniTableField field = {6, UPB_SIZE(44, 56), 6, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 6399 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6400 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6401 | UPB_INLINE upb_StringView google_protobuf_FieldDescriptorProto_type_name(const google_protobuf_FieldDescriptorProto* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6402 | upb_StringView default_val = upb_StringView_FromString(""); |
| 6403 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6404 | const upb_MiniTableField field = {6, UPB_SIZE(44, 56), 6, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 6405 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6406 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6407 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6408 | UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_type_name(const google_protobuf_FieldDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6409 | const upb_MiniTableField field = {6, UPB_SIZE(44, 56), 6, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 6410 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6411 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6412 | UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_default_value(google_protobuf_FieldDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6413 | const upb_MiniTableField field = {7, UPB_SIZE(52, 72), 7, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 6414 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6415 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6416 | UPB_INLINE upb_StringView google_protobuf_FieldDescriptorProto_default_value(const google_protobuf_FieldDescriptorProto* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6417 | upb_StringView default_val = upb_StringView_FromString(""); |
| 6418 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6419 | const upb_MiniTableField field = {7, UPB_SIZE(52, 72), 7, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 6420 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6421 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6422 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6423 | UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_default_value(const google_protobuf_FieldDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6424 | const upb_MiniTableField field = {7, UPB_SIZE(52, 72), 7, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 6425 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6426 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6427 | UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_options(google_protobuf_FieldDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6428 | const upb_MiniTableField field = {8, UPB_SIZE(16, 88), 8, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 6429 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6430 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6431 | UPB_INLINE const google_protobuf_FieldOptions* google_protobuf_FieldDescriptorProto_options(const google_protobuf_FieldDescriptorProto* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6432 | const google_protobuf_FieldOptions* default_val = NULL; |
| 6433 | const google_protobuf_FieldOptions* ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6434 | const upb_MiniTableField field = {8, UPB_SIZE(16, 88), 8, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 6435 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6436 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6437 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6438 | UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_options(const google_protobuf_FieldDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6439 | const upb_MiniTableField field = {8, UPB_SIZE(16, 88), 8, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 6440 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6441 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6442 | UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_oneof_index(google_protobuf_FieldDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6443 | const upb_MiniTableField field = {9, UPB_SIZE(20, 16), 9, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 6444 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6445 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6446 | UPB_INLINE int32_t google_protobuf_FieldDescriptorProto_oneof_index(const google_protobuf_FieldDescriptorProto* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6447 | int32_t default_val = (int32_t)0; |
| 6448 | int32_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6449 | const upb_MiniTableField field = {9, UPB_SIZE(20, 16), 9, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 6450 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6451 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6452 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6453 | UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_oneof_index(const google_protobuf_FieldDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6454 | const upb_MiniTableField field = {9, UPB_SIZE(20, 16), 9, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 6455 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6456 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6457 | UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_json_name(google_protobuf_FieldDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6458 | const upb_MiniTableField field = {10, UPB_SIZE(60, 96), 10, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 6459 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6460 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6461 | UPB_INLINE upb_StringView google_protobuf_FieldDescriptorProto_json_name(const google_protobuf_FieldDescriptorProto* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6462 | upb_StringView default_val = upb_StringView_FromString(""); |
| 6463 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6464 | const upb_MiniTableField field = {10, UPB_SIZE(60, 96), 10, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 6465 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6466 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6467 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6468 | UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_json_name(const google_protobuf_FieldDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6469 | const upb_MiniTableField field = {10, UPB_SIZE(60, 96), 10, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 6470 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6471 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6472 | UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_proto3_optional(google_protobuf_FieldDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6473 | const upb_MiniTableField field = {17, UPB_SIZE(24, 20), 11, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 6474 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6475 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6476 | UPB_INLINE bool google_protobuf_FieldDescriptorProto_proto3_optional(const google_protobuf_FieldDescriptorProto* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6477 | bool default_val = false; |
| 6478 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6479 | const upb_MiniTableField field = {17, UPB_SIZE(24, 20), 11, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 6480 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6481 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6482 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6483 | UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_proto3_optional(const google_protobuf_FieldDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6484 | const upb_MiniTableField field = {17, UPB_SIZE(24, 20), 11, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 6485 | return _upb_Message_HasNonExtensionField(msg, &field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6486 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6487 | |
| 6488 | UPB_INLINE void google_protobuf_FieldDescriptorProto_set_name(google_protobuf_FieldDescriptorProto *msg, upb_StringView value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6489 | const upb_MiniTableField field = {1, UPB_SIZE(28, 24), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 6490 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6491 | } |
| 6492 | UPB_INLINE void google_protobuf_FieldDescriptorProto_set_extendee(google_protobuf_FieldDescriptorProto *msg, upb_StringView value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6493 | const upb_MiniTableField field = {2, UPB_SIZE(36, 40), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 6494 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6495 | } |
| 6496 | UPB_INLINE void google_protobuf_FieldDescriptorProto_set_number(google_protobuf_FieldDescriptorProto *msg, int32_t value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6497 | const upb_MiniTableField field = {3, 4, 3, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 6498 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6499 | } |
| 6500 | UPB_INLINE void google_protobuf_FieldDescriptorProto_set_label(google_protobuf_FieldDescriptorProto *msg, int32_t value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6501 | const upb_MiniTableField field = {4, 8, 4, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 6502 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6503 | } |
| 6504 | UPB_INLINE void google_protobuf_FieldDescriptorProto_set_type(google_protobuf_FieldDescriptorProto *msg, int32_t value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6505 | const upb_MiniTableField field = {5, 12, 5, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 6506 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6507 | } |
| 6508 | UPB_INLINE void google_protobuf_FieldDescriptorProto_set_type_name(google_protobuf_FieldDescriptorProto *msg, upb_StringView value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6509 | const upb_MiniTableField field = {6, UPB_SIZE(44, 56), 6, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 6510 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6511 | } |
| 6512 | UPB_INLINE void google_protobuf_FieldDescriptorProto_set_default_value(google_protobuf_FieldDescriptorProto *msg, upb_StringView value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6513 | const upb_MiniTableField field = {7, UPB_SIZE(52, 72), 7, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 6514 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6515 | } |
| 6516 | UPB_INLINE void google_protobuf_FieldDescriptorProto_set_options(google_protobuf_FieldDescriptorProto *msg, google_protobuf_FieldOptions* value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6517 | const upb_MiniTableField field = {8, UPB_SIZE(16, 88), 8, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 6518 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6519 | } |
| 6520 | UPB_INLINE struct google_protobuf_FieldOptions* google_protobuf_FieldDescriptorProto_mutable_options(google_protobuf_FieldDescriptorProto* msg, upb_Arena* arena) { |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6521 | struct google_protobuf_FieldOptions* sub = (struct google_protobuf_FieldOptions*)google_protobuf_FieldDescriptorProto_options(msg); |
| 6522 | if (sub == NULL) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6523 | sub = (struct google_protobuf_FieldOptions*)_upb_Message_New(&google_protobuf_FieldOptions_msg_init, arena); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6524 | if (sub) google_protobuf_FieldDescriptorProto_set_options(msg, sub); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6525 | } |
| 6526 | return sub; |
| 6527 | } |
| 6528 | UPB_INLINE void google_protobuf_FieldDescriptorProto_set_oneof_index(google_protobuf_FieldDescriptorProto *msg, int32_t value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6529 | const upb_MiniTableField field = {9, UPB_SIZE(20, 16), 9, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 6530 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6531 | } |
| 6532 | UPB_INLINE void google_protobuf_FieldDescriptorProto_set_json_name(google_protobuf_FieldDescriptorProto *msg, upb_StringView value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6533 | const upb_MiniTableField field = {10, UPB_SIZE(60, 96), 10, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 6534 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6535 | } |
| 6536 | UPB_INLINE void google_protobuf_FieldDescriptorProto_set_proto3_optional(google_protobuf_FieldDescriptorProto *msg, bool value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6537 | const upb_MiniTableField field = {17, UPB_SIZE(24, 20), 11, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 6538 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6539 | } |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6540 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6541 | /* google.protobuf.OneofDescriptorProto */ |
| 6542 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6543 | UPB_INLINE google_protobuf_OneofDescriptorProto* google_protobuf_OneofDescriptorProto_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6544 | return (google_protobuf_OneofDescriptorProto*)_upb_Message_New(&google_protobuf_OneofDescriptorProto_msg_init, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6545 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6546 | UPB_INLINE google_protobuf_OneofDescriptorProto* google_protobuf_OneofDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 6547 | google_protobuf_OneofDescriptorProto* ret = google_protobuf_OneofDescriptorProto_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 6548 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6549 | if (upb_Decode(buf, size, ret, &google_protobuf_OneofDescriptorProto_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 6550 | return NULL; |
| 6551 | } |
| 6552 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6553 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6554 | UPB_INLINE google_protobuf_OneofDescriptorProto* google_protobuf_OneofDescriptorProto_parse_ex(const char* buf, size_t size, |
| 6555 | const upb_ExtensionRegistry* extreg, |
| 6556 | int options, upb_Arena* arena) { |
| 6557 | google_protobuf_OneofDescriptorProto* ret = google_protobuf_OneofDescriptorProto_new(arena); |
| 6558 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6559 | if (upb_Decode(buf, size, ret, &google_protobuf_OneofDescriptorProto_msg_init, extreg, options, arena) != |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6560 | kUpb_DecodeStatus_Ok) { |
| 6561 | return NULL; |
| 6562 | } |
| 6563 | return ret; |
| 6564 | } |
| 6565 | UPB_INLINE char* google_protobuf_OneofDescriptorProto_serialize(const google_protobuf_OneofDescriptorProto* msg, upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6566 | char* ptr; |
| 6567 | (void)upb_Encode(msg, &google_protobuf_OneofDescriptorProto_msg_init, 0, arena, &ptr, len); |
| 6568 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6569 | } |
| 6570 | UPB_INLINE char* google_protobuf_OneofDescriptorProto_serialize_ex(const google_protobuf_OneofDescriptorProto* msg, int options, |
| 6571 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6572 | char* ptr; |
| 6573 | (void)upb_Encode(msg, &google_protobuf_OneofDescriptorProto_msg_init, options, arena, &ptr, len); |
| 6574 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6575 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6576 | UPB_INLINE void google_protobuf_OneofDescriptorProto_clear_name(google_protobuf_OneofDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6577 | const upb_MiniTableField field = {1, 8, 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 6578 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6579 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6580 | UPB_INLINE upb_StringView google_protobuf_OneofDescriptorProto_name(const google_protobuf_OneofDescriptorProto* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6581 | upb_StringView default_val = upb_StringView_FromString(""); |
| 6582 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6583 | const upb_MiniTableField field = {1, 8, 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 6584 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6585 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6586 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6587 | UPB_INLINE bool google_protobuf_OneofDescriptorProto_has_name(const google_protobuf_OneofDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6588 | const upb_MiniTableField field = {1, 8, 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 6589 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6590 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6591 | UPB_INLINE void google_protobuf_OneofDescriptorProto_clear_options(google_protobuf_OneofDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6592 | const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 2, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 6593 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6594 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6595 | UPB_INLINE const google_protobuf_OneofOptions* google_protobuf_OneofDescriptorProto_options(const google_protobuf_OneofDescriptorProto* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6596 | const google_protobuf_OneofOptions* default_val = NULL; |
| 6597 | const google_protobuf_OneofOptions* ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6598 | const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 2, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 6599 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6600 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6601 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6602 | UPB_INLINE bool google_protobuf_OneofDescriptorProto_has_options(const google_protobuf_OneofDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6603 | const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 2, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 6604 | return _upb_Message_HasNonExtensionField(msg, &field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6605 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6606 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6607 | UPB_INLINE void google_protobuf_OneofDescriptorProto_set_name(google_protobuf_OneofDescriptorProto *msg, upb_StringView value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6608 | const upb_MiniTableField field = {1, 8, 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 6609 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6610 | } |
| 6611 | UPB_INLINE void google_protobuf_OneofDescriptorProto_set_options(google_protobuf_OneofDescriptorProto *msg, google_protobuf_OneofOptions* value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6612 | const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 2, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 6613 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6614 | } |
| 6615 | UPB_INLINE struct google_protobuf_OneofOptions* google_protobuf_OneofDescriptorProto_mutable_options(google_protobuf_OneofDescriptorProto* msg, upb_Arena* arena) { |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6616 | struct google_protobuf_OneofOptions* sub = (struct google_protobuf_OneofOptions*)google_protobuf_OneofDescriptorProto_options(msg); |
| 6617 | if (sub == NULL) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6618 | sub = (struct google_protobuf_OneofOptions*)_upb_Message_New(&google_protobuf_OneofOptions_msg_init, arena); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6619 | if (sub) google_protobuf_OneofDescriptorProto_set_options(msg, sub); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6620 | } |
| 6621 | return sub; |
| 6622 | } |
| 6623 | |
| 6624 | /* google.protobuf.EnumDescriptorProto */ |
| 6625 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6626 | UPB_INLINE google_protobuf_EnumDescriptorProto* google_protobuf_EnumDescriptorProto_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6627 | return (google_protobuf_EnumDescriptorProto*)_upb_Message_New(&google_protobuf_EnumDescriptorProto_msg_init, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6628 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6629 | UPB_INLINE google_protobuf_EnumDescriptorProto* google_protobuf_EnumDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 6630 | google_protobuf_EnumDescriptorProto* ret = google_protobuf_EnumDescriptorProto_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 6631 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6632 | if (upb_Decode(buf, size, ret, &google_protobuf_EnumDescriptorProto_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 6633 | return NULL; |
| 6634 | } |
| 6635 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6636 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6637 | UPB_INLINE google_protobuf_EnumDescriptorProto* google_protobuf_EnumDescriptorProto_parse_ex(const char* buf, size_t size, |
| 6638 | const upb_ExtensionRegistry* extreg, |
| 6639 | int options, upb_Arena* arena) { |
| 6640 | google_protobuf_EnumDescriptorProto* ret = google_protobuf_EnumDescriptorProto_new(arena); |
| 6641 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6642 | if (upb_Decode(buf, size, ret, &google_protobuf_EnumDescriptorProto_msg_init, extreg, options, arena) != |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6643 | kUpb_DecodeStatus_Ok) { |
| 6644 | return NULL; |
| 6645 | } |
| 6646 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6647 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6648 | UPB_INLINE char* google_protobuf_EnumDescriptorProto_serialize(const google_protobuf_EnumDescriptorProto* msg, upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6649 | char* ptr; |
| 6650 | (void)upb_Encode(msg, &google_protobuf_EnumDescriptorProto_msg_init, 0, arena, &ptr, len); |
| 6651 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6652 | } |
| 6653 | UPB_INLINE char* google_protobuf_EnumDescriptorProto_serialize_ex(const google_protobuf_EnumDescriptorProto* msg, int options, |
| 6654 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6655 | char* ptr; |
| 6656 | (void)upb_Encode(msg, &google_protobuf_EnumDescriptorProto_msg_init, options, arena, &ptr, len); |
| 6657 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6658 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6659 | UPB_INLINE void google_protobuf_EnumDescriptorProto_clear_name(google_protobuf_EnumDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6660 | const upb_MiniTableField field = {1, UPB_SIZE(20, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 6661 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6662 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6663 | UPB_INLINE upb_StringView google_protobuf_EnumDescriptorProto_name(const google_protobuf_EnumDescriptorProto* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6664 | upb_StringView default_val = upb_StringView_FromString(""); |
| 6665 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6666 | const upb_MiniTableField field = {1, UPB_SIZE(20, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 6667 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6668 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6669 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6670 | UPB_INLINE bool google_protobuf_EnumDescriptorProto_has_name(const google_protobuf_EnumDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6671 | const upb_MiniTableField field = {1, UPB_SIZE(20, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 6672 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6673 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6674 | UPB_INLINE void google_protobuf_EnumDescriptorProto_clear_value(google_protobuf_EnumDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6675 | const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 6676 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6677 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 6678 | UPB_INLINE const google_protobuf_EnumValueDescriptorProto* const* google_protobuf_EnumDescriptorProto_value(const google_protobuf_EnumDescriptorProto* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6679 | const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 6680 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 6681 | if (arr) { |
| 6682 | if (size) *size = arr->size; |
| 6683 | return (const google_protobuf_EnumValueDescriptorProto* const*)_upb_array_constptr(arr); |
| 6684 | } else { |
| 6685 | if (size) *size = 0; |
| 6686 | return NULL; |
| 6687 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6688 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 6689 | UPB_INLINE const upb_Array* _google_protobuf_EnumDescriptorProto_value_upb_array(const google_protobuf_EnumDescriptorProto* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6690 | const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 6691 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 6692 | if (size) { |
| 6693 | *size = arr ? arr->size : 0; |
| 6694 | } |
| 6695 | return arr; |
| 6696 | } |
| 6697 | UPB_INLINE upb_Array* _google_protobuf_EnumDescriptorProto_value_mutable_upb_array(const google_protobuf_EnumDescriptorProto* msg, size_t* size, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6698 | const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 6699 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 6700 | (upb_Message*)msg, &field, arena); |
| 6701 | if (size) { |
| 6702 | *size = arr ? arr->size : 0; |
| 6703 | } |
| 6704 | return arr; |
| 6705 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6706 | UPB_INLINE bool google_protobuf_EnumDescriptorProto_has_value(const google_protobuf_EnumDescriptorProto* msg) { |
| 6707 | size_t size; |
| 6708 | google_protobuf_EnumDescriptorProto_value(msg, &size); |
| 6709 | return size != 0; |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6710 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6711 | UPB_INLINE void google_protobuf_EnumDescriptorProto_clear_options(google_protobuf_EnumDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6712 | const upb_MiniTableField field = {3, UPB_SIZE(8, 32), 2, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 6713 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6714 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6715 | UPB_INLINE const google_protobuf_EnumOptions* google_protobuf_EnumDescriptorProto_options(const google_protobuf_EnumDescriptorProto* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6716 | const google_protobuf_EnumOptions* default_val = NULL; |
| 6717 | const google_protobuf_EnumOptions* ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6718 | const upb_MiniTableField field = {3, UPB_SIZE(8, 32), 2, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 6719 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6720 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6721 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6722 | UPB_INLINE bool google_protobuf_EnumDescriptorProto_has_options(const google_protobuf_EnumDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6723 | const upb_MiniTableField field = {3, UPB_SIZE(8, 32), 2, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 6724 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6725 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6726 | UPB_INLINE void google_protobuf_EnumDescriptorProto_clear_reserved_range(google_protobuf_EnumDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6727 | const upb_MiniTableField field = {4, UPB_SIZE(12, 40), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 6728 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6729 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 6730 | UPB_INLINE const google_protobuf_EnumDescriptorProto_EnumReservedRange* const* google_protobuf_EnumDescriptorProto_reserved_range(const google_protobuf_EnumDescriptorProto* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6731 | const upb_MiniTableField field = {4, UPB_SIZE(12, 40), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 6732 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 6733 | if (arr) { |
| 6734 | if (size) *size = arr->size; |
| 6735 | return (const google_protobuf_EnumDescriptorProto_EnumReservedRange* const*)_upb_array_constptr(arr); |
| 6736 | } else { |
| 6737 | if (size) *size = 0; |
| 6738 | return NULL; |
| 6739 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6740 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 6741 | UPB_INLINE const upb_Array* _google_protobuf_EnumDescriptorProto_reserved_range_upb_array(const google_protobuf_EnumDescriptorProto* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6742 | const upb_MiniTableField field = {4, UPB_SIZE(12, 40), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 6743 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 6744 | if (size) { |
| 6745 | *size = arr ? arr->size : 0; |
| 6746 | } |
| 6747 | return arr; |
| 6748 | } |
| 6749 | UPB_INLINE upb_Array* _google_protobuf_EnumDescriptorProto_reserved_range_mutable_upb_array(const google_protobuf_EnumDescriptorProto* msg, size_t* size, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6750 | const upb_MiniTableField field = {4, UPB_SIZE(12, 40), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 6751 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 6752 | (upb_Message*)msg, &field, arena); |
| 6753 | if (size) { |
| 6754 | *size = arr ? arr->size : 0; |
| 6755 | } |
| 6756 | return arr; |
| 6757 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6758 | UPB_INLINE bool google_protobuf_EnumDescriptorProto_has_reserved_range(const google_protobuf_EnumDescriptorProto* msg) { |
| 6759 | size_t size; |
| 6760 | google_protobuf_EnumDescriptorProto_reserved_range(msg, &size); |
| 6761 | return size != 0; |
| 6762 | } |
| 6763 | UPB_INLINE void google_protobuf_EnumDescriptorProto_clear_reserved_name(google_protobuf_EnumDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6764 | const upb_MiniTableField field = {5, UPB_SIZE(16, 48), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 6765 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6766 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 6767 | UPB_INLINE upb_StringView const* google_protobuf_EnumDescriptorProto_reserved_name(const google_protobuf_EnumDescriptorProto* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6768 | const upb_MiniTableField field = {5, UPB_SIZE(16, 48), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 6769 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 6770 | if (arr) { |
| 6771 | if (size) *size = arr->size; |
| 6772 | return (upb_StringView const*)_upb_array_constptr(arr); |
| 6773 | } else { |
| 6774 | if (size) *size = 0; |
| 6775 | return NULL; |
| 6776 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6777 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 6778 | UPB_INLINE const upb_Array* _google_protobuf_EnumDescriptorProto_reserved_name_upb_array(const google_protobuf_EnumDescriptorProto* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6779 | const upb_MiniTableField field = {5, UPB_SIZE(16, 48), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 6780 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 6781 | if (size) { |
| 6782 | *size = arr ? arr->size : 0; |
| 6783 | } |
| 6784 | return arr; |
| 6785 | } |
| 6786 | UPB_INLINE upb_Array* _google_protobuf_EnumDescriptorProto_reserved_name_mutable_upb_array(const google_protobuf_EnumDescriptorProto* msg, size_t* size, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6787 | const upb_MiniTableField field = {5, UPB_SIZE(16, 48), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 6788 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 6789 | (upb_Message*)msg, &field, arena); |
| 6790 | if (size) { |
| 6791 | *size = arr ? arr->size : 0; |
| 6792 | } |
| 6793 | return arr; |
| 6794 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6795 | UPB_INLINE bool google_protobuf_EnumDescriptorProto_has_reserved_name(const google_protobuf_EnumDescriptorProto* msg) { |
| 6796 | size_t size; |
| 6797 | google_protobuf_EnumDescriptorProto_reserved_name(msg, &size); |
| 6798 | return size != 0; |
| 6799 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6800 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6801 | UPB_INLINE void google_protobuf_EnumDescriptorProto_set_name(google_protobuf_EnumDescriptorProto *msg, upb_StringView value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6802 | const upb_MiniTableField field = {1, UPB_SIZE(20, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 6803 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6804 | } |
| 6805 | UPB_INLINE google_protobuf_EnumValueDescriptorProto** google_protobuf_EnumDescriptorProto_mutable_value(google_protobuf_EnumDescriptorProto* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6806 | upb_MiniTableField field = {2, UPB_SIZE(4, 24), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 6807 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 6808 | if (arr) { |
| 6809 | if (size) *size = arr->size; |
| 6810 | return (google_protobuf_EnumValueDescriptorProto**)_upb_array_ptr(arr); |
| 6811 | } else { |
| 6812 | if (size) *size = 0; |
| 6813 | return NULL; |
| 6814 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6815 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 6816 | UPB_INLINE google_protobuf_EnumValueDescriptorProto** google_protobuf_EnumDescriptorProto_resize_value(google_protobuf_EnumDescriptorProto* msg, size_t size, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6817 | upb_MiniTableField field = {2, UPB_SIZE(4, 24), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Jie Luo | f36a5c6 | 2023-05-23 17:56:18 -0700 | [diff] [blame] | 6818 | return (google_protobuf_EnumValueDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6819 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6820 | UPB_INLINE struct google_protobuf_EnumValueDescriptorProto* google_protobuf_EnumDescriptorProto_add_value(google_protobuf_EnumDescriptorProto* msg, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6821 | upb_MiniTableField field = {2, UPB_SIZE(4, 24), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 6822 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 6823 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 6824 | return NULL; |
| 6825 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6826 | struct google_protobuf_EnumValueDescriptorProto* sub = (struct google_protobuf_EnumValueDescriptorProto*)_upb_Message_New(&google_protobuf_EnumValueDescriptorProto_msg_init, arena); |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 6827 | if (!arr || !sub) return NULL; |
| 6828 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6829 | return sub; |
| 6830 | } |
| 6831 | UPB_INLINE void google_protobuf_EnumDescriptorProto_set_options(google_protobuf_EnumDescriptorProto *msg, google_protobuf_EnumOptions* value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6832 | const upb_MiniTableField field = {3, UPB_SIZE(8, 32), 2, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 6833 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6834 | } |
| 6835 | UPB_INLINE struct google_protobuf_EnumOptions* google_protobuf_EnumDescriptorProto_mutable_options(google_protobuf_EnumDescriptorProto* msg, upb_Arena* arena) { |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6836 | struct google_protobuf_EnumOptions* sub = (struct google_protobuf_EnumOptions*)google_protobuf_EnumDescriptorProto_options(msg); |
| 6837 | if (sub == NULL) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6838 | sub = (struct google_protobuf_EnumOptions*)_upb_Message_New(&google_protobuf_EnumOptions_msg_init, arena); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6839 | if (sub) google_protobuf_EnumDescriptorProto_set_options(msg, sub); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6840 | } |
| 6841 | return sub; |
| 6842 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 6843 | UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange** google_protobuf_EnumDescriptorProto_mutable_reserved_range(google_protobuf_EnumDescriptorProto* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6844 | upb_MiniTableField field = {4, UPB_SIZE(12, 40), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 6845 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 6846 | if (arr) { |
| 6847 | if (size) *size = arr->size; |
| 6848 | return (google_protobuf_EnumDescriptorProto_EnumReservedRange**)_upb_array_ptr(arr); |
| 6849 | } else { |
| 6850 | if (size) *size = 0; |
| 6851 | return NULL; |
| 6852 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6853 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 6854 | UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange** google_protobuf_EnumDescriptorProto_resize_reserved_range(google_protobuf_EnumDescriptorProto* msg, size_t size, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6855 | upb_MiniTableField field = {4, UPB_SIZE(12, 40), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Jie Luo | f36a5c6 | 2023-05-23 17:56:18 -0700 | [diff] [blame] | 6856 | return (google_protobuf_EnumDescriptorProto_EnumReservedRange**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6857 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6858 | UPB_INLINE struct google_protobuf_EnumDescriptorProto_EnumReservedRange* google_protobuf_EnumDescriptorProto_add_reserved_range(google_protobuf_EnumDescriptorProto* msg, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6859 | upb_MiniTableField field = {4, UPB_SIZE(12, 40), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 6860 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 6861 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 6862 | return NULL; |
| 6863 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6864 | struct google_protobuf_EnumDescriptorProto_EnumReservedRange* sub = (struct google_protobuf_EnumDescriptorProto_EnumReservedRange*)_upb_Message_New(&google_protobuf_EnumDescriptorProto_EnumReservedRange_msg_init, arena); |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 6865 | if (!arr || !sub) return NULL; |
| 6866 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6867 | return sub; |
| 6868 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 6869 | UPB_INLINE upb_StringView* google_protobuf_EnumDescriptorProto_mutable_reserved_name(google_protobuf_EnumDescriptorProto* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6870 | upb_MiniTableField field = {5, UPB_SIZE(16, 48), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 6871 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 6872 | if (arr) { |
| 6873 | if (size) *size = arr->size; |
| 6874 | return (upb_StringView*)_upb_array_ptr(arr); |
| 6875 | } else { |
| 6876 | if (size) *size = 0; |
| 6877 | return NULL; |
| 6878 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6879 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 6880 | UPB_INLINE upb_StringView* google_protobuf_EnumDescriptorProto_resize_reserved_name(google_protobuf_EnumDescriptorProto* msg, size_t size, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6881 | upb_MiniTableField field = {5, UPB_SIZE(16, 48), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Jie Luo | f36a5c6 | 2023-05-23 17:56:18 -0700 | [diff] [blame] | 6882 | return (upb_StringView*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6883 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6884 | UPB_INLINE bool google_protobuf_EnumDescriptorProto_add_reserved_name(google_protobuf_EnumDescriptorProto* msg, upb_StringView val, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6885 | upb_MiniTableField field = {5, UPB_SIZE(16, 48), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 6886 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 6887 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 6888 | return false; |
| 6889 | } |
| 6890 | _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val)); |
| 6891 | return true; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6892 | } |
| 6893 | |
| 6894 | /* google.protobuf.EnumDescriptorProto.EnumReservedRange */ |
| 6895 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6896 | UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange* google_protobuf_EnumDescriptorProto_EnumReservedRange_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6897 | return (google_protobuf_EnumDescriptorProto_EnumReservedRange*)_upb_Message_New(&google_protobuf_EnumDescriptorProto_EnumReservedRange_msg_init, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6898 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6899 | UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange* google_protobuf_EnumDescriptorProto_EnumReservedRange_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 6900 | google_protobuf_EnumDescriptorProto_EnumReservedRange* ret = google_protobuf_EnumDescriptorProto_EnumReservedRange_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 6901 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6902 | if (upb_Decode(buf, size, ret, &google_protobuf_EnumDescriptorProto_EnumReservedRange_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 6903 | return NULL; |
| 6904 | } |
| 6905 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6906 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6907 | UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange* google_protobuf_EnumDescriptorProto_EnumReservedRange_parse_ex(const char* buf, size_t size, |
| 6908 | const upb_ExtensionRegistry* extreg, |
| 6909 | int options, upb_Arena* arena) { |
| 6910 | google_protobuf_EnumDescriptorProto_EnumReservedRange* ret = google_protobuf_EnumDescriptorProto_EnumReservedRange_new(arena); |
| 6911 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6912 | if (upb_Decode(buf, size, ret, &google_protobuf_EnumDescriptorProto_EnumReservedRange_msg_init, extreg, options, arena) != |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6913 | kUpb_DecodeStatus_Ok) { |
| 6914 | return NULL; |
| 6915 | } |
| 6916 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6917 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6918 | UPB_INLINE char* google_protobuf_EnumDescriptorProto_EnumReservedRange_serialize(const google_protobuf_EnumDescriptorProto_EnumReservedRange* msg, upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6919 | char* ptr; |
| 6920 | (void)upb_Encode(msg, &google_protobuf_EnumDescriptorProto_EnumReservedRange_msg_init, 0, arena, &ptr, len); |
| 6921 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6922 | } |
| 6923 | UPB_INLINE char* google_protobuf_EnumDescriptorProto_EnumReservedRange_serialize_ex(const google_protobuf_EnumDescriptorProto_EnumReservedRange* msg, int options, |
| 6924 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6925 | char* ptr; |
| 6926 | (void)upb_Encode(msg, &google_protobuf_EnumDescriptorProto_EnumReservedRange_msg_init, options, arena, &ptr, len); |
| 6927 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6928 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6929 | UPB_INLINE void google_protobuf_EnumDescriptorProto_EnumReservedRange_clear_start(google_protobuf_EnumDescriptorProto_EnumReservedRange* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6930 | const upb_MiniTableField field = {1, 4, 1, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 6931 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6932 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6933 | UPB_INLINE int32_t google_protobuf_EnumDescriptorProto_EnumReservedRange_start(const google_protobuf_EnumDescriptorProto_EnumReservedRange* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6934 | int32_t default_val = (int32_t)0; |
| 6935 | int32_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6936 | const upb_MiniTableField field = {1, 4, 1, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 6937 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6938 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6939 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6940 | UPB_INLINE bool google_protobuf_EnumDescriptorProto_EnumReservedRange_has_start(const google_protobuf_EnumDescriptorProto_EnumReservedRange* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6941 | const upb_MiniTableField field = {1, 4, 1, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 6942 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6943 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6944 | UPB_INLINE void google_protobuf_EnumDescriptorProto_EnumReservedRange_clear_end(google_protobuf_EnumDescriptorProto_EnumReservedRange* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6945 | const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 6946 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6947 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6948 | UPB_INLINE int32_t google_protobuf_EnumDescriptorProto_EnumReservedRange_end(const google_protobuf_EnumDescriptorProto_EnumReservedRange* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6949 | int32_t default_val = (int32_t)0; |
| 6950 | int32_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6951 | const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 6952 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6953 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6954 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6955 | UPB_INLINE bool google_protobuf_EnumDescriptorProto_EnumReservedRange_has_end(const google_protobuf_EnumDescriptorProto_EnumReservedRange* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6956 | const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 6957 | return _upb_Message_HasNonExtensionField(msg, &field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6958 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6959 | |
| 6960 | UPB_INLINE void google_protobuf_EnumDescriptorProto_EnumReservedRange_set_start(google_protobuf_EnumDescriptorProto_EnumReservedRange *msg, int32_t value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6961 | const upb_MiniTableField field = {1, 4, 1, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 6962 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6963 | } |
| 6964 | UPB_INLINE void google_protobuf_EnumDescriptorProto_EnumReservedRange_set_end(google_protobuf_EnumDescriptorProto_EnumReservedRange *msg, int32_t value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6965 | const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 6966 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6967 | } |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6968 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6969 | /* google.protobuf.EnumValueDescriptorProto */ |
| 6970 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6971 | UPB_INLINE google_protobuf_EnumValueDescriptorProto* google_protobuf_EnumValueDescriptorProto_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6972 | return (google_protobuf_EnumValueDescriptorProto*)_upb_Message_New(&google_protobuf_EnumValueDescriptorProto_msg_init, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6973 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6974 | UPB_INLINE google_protobuf_EnumValueDescriptorProto* google_protobuf_EnumValueDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 6975 | google_protobuf_EnumValueDescriptorProto* ret = google_protobuf_EnumValueDescriptorProto_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 6976 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6977 | if (upb_Decode(buf, size, ret, &google_protobuf_EnumValueDescriptorProto_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 6978 | return NULL; |
| 6979 | } |
| 6980 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6981 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6982 | UPB_INLINE google_protobuf_EnumValueDescriptorProto* google_protobuf_EnumValueDescriptorProto_parse_ex(const char* buf, size_t size, |
| 6983 | const upb_ExtensionRegistry* extreg, |
| 6984 | int options, upb_Arena* arena) { |
| 6985 | google_protobuf_EnumValueDescriptorProto* ret = google_protobuf_EnumValueDescriptorProto_new(arena); |
| 6986 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6987 | if (upb_Decode(buf, size, ret, &google_protobuf_EnumValueDescriptorProto_msg_init, extreg, options, arena) != |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6988 | kUpb_DecodeStatus_Ok) { |
| 6989 | return NULL; |
| 6990 | } |
| 6991 | return ret; |
| 6992 | } |
| 6993 | UPB_INLINE char* google_protobuf_EnumValueDescriptorProto_serialize(const google_protobuf_EnumValueDescriptorProto* msg, upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6994 | char* ptr; |
| 6995 | (void)upb_Encode(msg, &google_protobuf_EnumValueDescriptorProto_msg_init, 0, arena, &ptr, len); |
| 6996 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6997 | } |
| 6998 | UPB_INLINE char* google_protobuf_EnumValueDescriptorProto_serialize_ex(const google_protobuf_EnumValueDescriptorProto* msg, int options, |
| 6999 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7000 | char* ptr; |
| 7001 | (void)upb_Encode(msg, &google_protobuf_EnumValueDescriptorProto_msg_init, options, arena, &ptr, len); |
| 7002 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7003 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7004 | UPB_INLINE void google_protobuf_EnumValueDescriptorProto_clear_name(google_protobuf_EnumValueDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7005 | const upb_MiniTableField field = {1, UPB_SIZE(12, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7006 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7007 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7008 | UPB_INLINE upb_StringView google_protobuf_EnumValueDescriptorProto_name(const google_protobuf_EnumValueDescriptorProto* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7009 | upb_StringView default_val = upb_StringView_FromString(""); |
| 7010 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7011 | const upb_MiniTableField field = {1, UPB_SIZE(12, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7012 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7013 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7014 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7015 | UPB_INLINE bool google_protobuf_EnumValueDescriptorProto_has_name(const google_protobuf_EnumValueDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7016 | const upb_MiniTableField field = {1, UPB_SIZE(12, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7017 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7018 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7019 | UPB_INLINE void google_protobuf_EnumValueDescriptorProto_clear_number(google_protobuf_EnumValueDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7020 | const upb_MiniTableField field = {2, 4, 2, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7021 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7022 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7023 | UPB_INLINE int32_t google_protobuf_EnumValueDescriptorProto_number(const google_protobuf_EnumValueDescriptorProto* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7024 | int32_t default_val = (int32_t)0; |
| 7025 | int32_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7026 | const upb_MiniTableField field = {2, 4, 2, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7027 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7028 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7029 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7030 | UPB_INLINE bool google_protobuf_EnumValueDescriptorProto_has_number(const google_protobuf_EnumValueDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7031 | const upb_MiniTableField field = {2, 4, 2, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7032 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7033 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7034 | UPB_INLINE void google_protobuf_EnumValueDescriptorProto_clear_options(google_protobuf_EnumValueDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7035 | const upb_MiniTableField field = {3, UPB_SIZE(8, 24), 3, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7036 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7037 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7038 | UPB_INLINE const google_protobuf_EnumValueOptions* google_protobuf_EnumValueDescriptorProto_options(const google_protobuf_EnumValueDescriptorProto* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7039 | const google_protobuf_EnumValueOptions* default_val = NULL; |
| 7040 | const google_protobuf_EnumValueOptions* ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7041 | const upb_MiniTableField field = {3, UPB_SIZE(8, 24), 3, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7042 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7043 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7044 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7045 | UPB_INLINE bool google_protobuf_EnumValueDescriptorProto_has_options(const google_protobuf_EnumValueDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7046 | const upb_MiniTableField field = {3, UPB_SIZE(8, 24), 3, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7047 | return _upb_Message_HasNonExtensionField(msg, &field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7048 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7049 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7050 | UPB_INLINE void google_protobuf_EnumValueDescriptorProto_set_name(google_protobuf_EnumValueDescriptorProto *msg, upb_StringView value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7051 | const upb_MiniTableField field = {1, UPB_SIZE(12, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7052 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7053 | } |
| 7054 | UPB_INLINE void google_protobuf_EnumValueDescriptorProto_set_number(google_protobuf_EnumValueDescriptorProto *msg, int32_t value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7055 | const upb_MiniTableField field = {2, 4, 2, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7056 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7057 | } |
| 7058 | UPB_INLINE void google_protobuf_EnumValueDescriptorProto_set_options(google_protobuf_EnumValueDescriptorProto *msg, google_protobuf_EnumValueOptions* value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7059 | const upb_MiniTableField field = {3, UPB_SIZE(8, 24), 3, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7060 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7061 | } |
| 7062 | UPB_INLINE struct google_protobuf_EnumValueOptions* google_protobuf_EnumValueDescriptorProto_mutable_options(google_protobuf_EnumValueDescriptorProto* msg, upb_Arena* arena) { |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7063 | struct google_protobuf_EnumValueOptions* sub = (struct google_protobuf_EnumValueOptions*)google_protobuf_EnumValueDescriptorProto_options(msg); |
| 7064 | if (sub == NULL) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7065 | sub = (struct google_protobuf_EnumValueOptions*)_upb_Message_New(&google_protobuf_EnumValueOptions_msg_init, arena); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7066 | if (sub) google_protobuf_EnumValueDescriptorProto_set_options(msg, sub); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7067 | } |
| 7068 | return sub; |
| 7069 | } |
| 7070 | |
| 7071 | /* google.protobuf.ServiceDescriptorProto */ |
| 7072 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7073 | UPB_INLINE google_protobuf_ServiceDescriptorProto* google_protobuf_ServiceDescriptorProto_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7074 | return (google_protobuf_ServiceDescriptorProto*)_upb_Message_New(&google_protobuf_ServiceDescriptorProto_msg_init, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7075 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7076 | UPB_INLINE google_protobuf_ServiceDescriptorProto* google_protobuf_ServiceDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 7077 | google_protobuf_ServiceDescriptorProto* ret = google_protobuf_ServiceDescriptorProto_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 7078 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7079 | if (upb_Decode(buf, size, ret, &google_protobuf_ServiceDescriptorProto_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 7080 | return NULL; |
| 7081 | } |
| 7082 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7083 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7084 | UPB_INLINE google_protobuf_ServiceDescriptorProto* google_protobuf_ServiceDescriptorProto_parse_ex(const char* buf, size_t size, |
| 7085 | const upb_ExtensionRegistry* extreg, |
| 7086 | int options, upb_Arena* arena) { |
| 7087 | google_protobuf_ServiceDescriptorProto* ret = google_protobuf_ServiceDescriptorProto_new(arena); |
| 7088 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7089 | if (upb_Decode(buf, size, ret, &google_protobuf_ServiceDescriptorProto_msg_init, extreg, options, arena) != |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7090 | kUpb_DecodeStatus_Ok) { |
| 7091 | return NULL; |
| 7092 | } |
| 7093 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7094 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7095 | UPB_INLINE char* google_protobuf_ServiceDescriptorProto_serialize(const google_protobuf_ServiceDescriptorProto* msg, upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7096 | char* ptr; |
| 7097 | (void)upb_Encode(msg, &google_protobuf_ServiceDescriptorProto_msg_init, 0, arena, &ptr, len); |
| 7098 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7099 | } |
| 7100 | UPB_INLINE char* google_protobuf_ServiceDescriptorProto_serialize_ex(const google_protobuf_ServiceDescriptorProto* msg, int options, |
| 7101 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7102 | char* ptr; |
| 7103 | (void)upb_Encode(msg, &google_protobuf_ServiceDescriptorProto_msg_init, options, arena, &ptr, len); |
| 7104 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7105 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7106 | UPB_INLINE void google_protobuf_ServiceDescriptorProto_clear_name(google_protobuf_ServiceDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7107 | const upb_MiniTableField field = {1, UPB_SIZE(12, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7108 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7109 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7110 | UPB_INLINE upb_StringView google_protobuf_ServiceDescriptorProto_name(const google_protobuf_ServiceDescriptorProto* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7111 | upb_StringView default_val = upb_StringView_FromString(""); |
| 7112 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7113 | const upb_MiniTableField field = {1, UPB_SIZE(12, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7114 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7115 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7116 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7117 | UPB_INLINE bool google_protobuf_ServiceDescriptorProto_has_name(const google_protobuf_ServiceDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7118 | const upb_MiniTableField field = {1, UPB_SIZE(12, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7119 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7120 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7121 | UPB_INLINE void google_protobuf_ServiceDescriptorProto_clear_method(google_protobuf_ServiceDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7122 | const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7123 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7124 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 7125 | UPB_INLINE const google_protobuf_MethodDescriptorProto* const* google_protobuf_ServiceDescriptorProto_method(const google_protobuf_ServiceDescriptorProto* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7126 | const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 7127 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 7128 | if (arr) { |
| 7129 | if (size) *size = arr->size; |
| 7130 | return (const google_protobuf_MethodDescriptorProto* const*)_upb_array_constptr(arr); |
| 7131 | } else { |
| 7132 | if (size) *size = 0; |
| 7133 | return NULL; |
| 7134 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7135 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 7136 | UPB_INLINE const upb_Array* _google_protobuf_ServiceDescriptorProto_method_upb_array(const google_protobuf_ServiceDescriptorProto* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7137 | const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 7138 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 7139 | if (size) { |
| 7140 | *size = arr ? arr->size : 0; |
| 7141 | } |
| 7142 | return arr; |
| 7143 | } |
| 7144 | UPB_INLINE upb_Array* _google_protobuf_ServiceDescriptorProto_method_mutable_upb_array(const google_protobuf_ServiceDescriptorProto* msg, size_t* size, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7145 | const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 7146 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 7147 | (upb_Message*)msg, &field, arena); |
| 7148 | if (size) { |
| 7149 | *size = arr ? arr->size : 0; |
| 7150 | } |
| 7151 | return arr; |
| 7152 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7153 | UPB_INLINE bool google_protobuf_ServiceDescriptorProto_has_method(const google_protobuf_ServiceDescriptorProto* msg) { |
| 7154 | size_t size; |
| 7155 | google_protobuf_ServiceDescriptorProto_method(msg, &size); |
| 7156 | return size != 0; |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7157 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7158 | UPB_INLINE void google_protobuf_ServiceDescriptorProto_clear_options(google_protobuf_ServiceDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7159 | const upb_MiniTableField field = {3, UPB_SIZE(8, 32), 2, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7160 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7161 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7162 | UPB_INLINE const google_protobuf_ServiceOptions* google_protobuf_ServiceDescriptorProto_options(const google_protobuf_ServiceDescriptorProto* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7163 | const google_protobuf_ServiceOptions* default_val = NULL; |
| 7164 | const google_protobuf_ServiceOptions* ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7165 | const upb_MiniTableField field = {3, UPB_SIZE(8, 32), 2, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7166 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7167 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7168 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7169 | UPB_INLINE bool google_protobuf_ServiceDescriptorProto_has_options(const google_protobuf_ServiceDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7170 | const upb_MiniTableField field = {3, UPB_SIZE(8, 32), 2, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7171 | return _upb_Message_HasNonExtensionField(msg, &field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7172 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7173 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7174 | UPB_INLINE void google_protobuf_ServiceDescriptorProto_set_name(google_protobuf_ServiceDescriptorProto *msg, upb_StringView value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7175 | const upb_MiniTableField field = {1, UPB_SIZE(12, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7176 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7177 | } |
| 7178 | UPB_INLINE google_protobuf_MethodDescriptorProto** google_protobuf_ServiceDescriptorProto_mutable_method(google_protobuf_ServiceDescriptorProto* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7179 | upb_MiniTableField field = {2, UPB_SIZE(4, 24), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 7180 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 7181 | if (arr) { |
| 7182 | if (size) *size = arr->size; |
| 7183 | return (google_protobuf_MethodDescriptorProto**)_upb_array_ptr(arr); |
| 7184 | } else { |
| 7185 | if (size) *size = 0; |
| 7186 | return NULL; |
| 7187 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7188 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 7189 | UPB_INLINE google_protobuf_MethodDescriptorProto** google_protobuf_ServiceDescriptorProto_resize_method(google_protobuf_ServiceDescriptorProto* msg, size_t size, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7190 | upb_MiniTableField field = {2, UPB_SIZE(4, 24), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Jie Luo | f36a5c6 | 2023-05-23 17:56:18 -0700 | [diff] [blame] | 7191 | return (google_protobuf_MethodDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7192 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7193 | UPB_INLINE struct google_protobuf_MethodDescriptorProto* google_protobuf_ServiceDescriptorProto_add_method(google_protobuf_ServiceDescriptorProto* msg, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7194 | upb_MiniTableField field = {2, UPB_SIZE(4, 24), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 7195 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 7196 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 7197 | return NULL; |
| 7198 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7199 | struct google_protobuf_MethodDescriptorProto* sub = (struct google_protobuf_MethodDescriptorProto*)_upb_Message_New(&google_protobuf_MethodDescriptorProto_msg_init, arena); |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 7200 | if (!arr || !sub) return NULL; |
| 7201 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7202 | return sub; |
| 7203 | } |
| 7204 | UPB_INLINE void google_protobuf_ServiceDescriptorProto_set_options(google_protobuf_ServiceDescriptorProto *msg, google_protobuf_ServiceOptions* value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7205 | const upb_MiniTableField field = {3, UPB_SIZE(8, 32), 2, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7206 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7207 | } |
| 7208 | UPB_INLINE struct google_protobuf_ServiceOptions* google_protobuf_ServiceDescriptorProto_mutable_options(google_protobuf_ServiceDescriptorProto* msg, upb_Arena* arena) { |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7209 | struct google_protobuf_ServiceOptions* sub = (struct google_protobuf_ServiceOptions*)google_protobuf_ServiceDescriptorProto_options(msg); |
| 7210 | if (sub == NULL) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7211 | sub = (struct google_protobuf_ServiceOptions*)_upb_Message_New(&google_protobuf_ServiceOptions_msg_init, arena); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7212 | if (sub) google_protobuf_ServiceDescriptorProto_set_options(msg, sub); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7213 | } |
| 7214 | return sub; |
| 7215 | } |
| 7216 | |
| 7217 | /* google.protobuf.MethodDescriptorProto */ |
| 7218 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7219 | UPB_INLINE google_protobuf_MethodDescriptorProto* google_protobuf_MethodDescriptorProto_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7220 | return (google_protobuf_MethodDescriptorProto*)_upb_Message_New(&google_protobuf_MethodDescriptorProto_msg_init, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7221 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7222 | UPB_INLINE google_protobuf_MethodDescriptorProto* google_protobuf_MethodDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 7223 | google_protobuf_MethodDescriptorProto* ret = google_protobuf_MethodDescriptorProto_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 7224 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7225 | if (upb_Decode(buf, size, ret, &google_protobuf_MethodDescriptorProto_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 7226 | return NULL; |
| 7227 | } |
| 7228 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7229 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7230 | UPB_INLINE google_protobuf_MethodDescriptorProto* google_protobuf_MethodDescriptorProto_parse_ex(const char* buf, size_t size, |
| 7231 | const upb_ExtensionRegistry* extreg, |
| 7232 | int options, upb_Arena* arena) { |
| 7233 | google_protobuf_MethodDescriptorProto* ret = google_protobuf_MethodDescriptorProto_new(arena); |
| 7234 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7235 | if (upb_Decode(buf, size, ret, &google_protobuf_MethodDescriptorProto_msg_init, extreg, options, arena) != |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7236 | kUpb_DecodeStatus_Ok) { |
| 7237 | return NULL; |
| 7238 | } |
| 7239 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7240 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7241 | UPB_INLINE char* google_protobuf_MethodDescriptorProto_serialize(const google_protobuf_MethodDescriptorProto* msg, upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7242 | char* ptr; |
| 7243 | (void)upb_Encode(msg, &google_protobuf_MethodDescriptorProto_msg_init, 0, arena, &ptr, len); |
| 7244 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7245 | } |
| 7246 | UPB_INLINE char* google_protobuf_MethodDescriptorProto_serialize_ex(const google_protobuf_MethodDescriptorProto* msg, int options, |
| 7247 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7248 | char* ptr; |
| 7249 | (void)upb_Encode(msg, &google_protobuf_MethodDescriptorProto_msg_init, options, arena, &ptr, len); |
| 7250 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7251 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7252 | UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_name(google_protobuf_MethodDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7253 | const upb_MiniTableField field = {1, UPB_SIZE(12, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7254 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7255 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7256 | UPB_INLINE upb_StringView google_protobuf_MethodDescriptorProto_name(const google_protobuf_MethodDescriptorProto* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7257 | upb_StringView default_val = upb_StringView_FromString(""); |
| 7258 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7259 | const upb_MiniTableField field = {1, UPB_SIZE(12, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7260 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7261 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7262 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7263 | UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_name(const google_protobuf_MethodDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7264 | const upb_MiniTableField field = {1, UPB_SIZE(12, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7265 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7266 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7267 | UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_input_type(google_protobuf_MethodDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7268 | const upb_MiniTableField field = {2, UPB_SIZE(20, 24), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7269 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7270 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7271 | UPB_INLINE upb_StringView google_protobuf_MethodDescriptorProto_input_type(const google_protobuf_MethodDescriptorProto* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7272 | upb_StringView default_val = upb_StringView_FromString(""); |
| 7273 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7274 | const upb_MiniTableField field = {2, UPB_SIZE(20, 24), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7275 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7276 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7277 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7278 | UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_input_type(const google_protobuf_MethodDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7279 | const upb_MiniTableField field = {2, UPB_SIZE(20, 24), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7280 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7281 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7282 | UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_output_type(google_protobuf_MethodDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7283 | const upb_MiniTableField field = {3, UPB_SIZE(28, 40), 3, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7284 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7285 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7286 | UPB_INLINE upb_StringView google_protobuf_MethodDescriptorProto_output_type(const google_protobuf_MethodDescriptorProto* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7287 | upb_StringView default_val = upb_StringView_FromString(""); |
| 7288 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7289 | const upb_MiniTableField field = {3, UPB_SIZE(28, 40), 3, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7290 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7291 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7292 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7293 | UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_output_type(const google_protobuf_MethodDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7294 | const upb_MiniTableField field = {3, UPB_SIZE(28, 40), 3, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7295 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7296 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7297 | UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_options(google_protobuf_MethodDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7298 | const upb_MiniTableField field = {4, UPB_SIZE(4, 56), 4, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7299 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7300 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7301 | UPB_INLINE const google_protobuf_MethodOptions* google_protobuf_MethodDescriptorProto_options(const google_protobuf_MethodDescriptorProto* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7302 | const google_protobuf_MethodOptions* default_val = NULL; |
| 7303 | const google_protobuf_MethodOptions* ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7304 | const upb_MiniTableField field = {4, UPB_SIZE(4, 56), 4, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7305 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7306 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7307 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7308 | UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_options(const google_protobuf_MethodDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7309 | const upb_MiniTableField field = {4, UPB_SIZE(4, 56), 4, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7310 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7311 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7312 | UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_client_streaming(google_protobuf_MethodDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7313 | const upb_MiniTableField field = {5, UPB_SIZE(8, 1), 5, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7314 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7315 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7316 | UPB_INLINE bool google_protobuf_MethodDescriptorProto_client_streaming(const google_protobuf_MethodDescriptorProto* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7317 | bool default_val = false; |
| 7318 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7319 | const upb_MiniTableField field = {5, UPB_SIZE(8, 1), 5, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7320 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7321 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7322 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7323 | UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_client_streaming(const google_protobuf_MethodDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7324 | const upb_MiniTableField field = {5, UPB_SIZE(8, 1), 5, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7325 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7326 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7327 | UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_server_streaming(google_protobuf_MethodDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7328 | const upb_MiniTableField field = {6, UPB_SIZE(9, 2), 6, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7329 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7330 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7331 | UPB_INLINE bool google_protobuf_MethodDescriptorProto_server_streaming(const google_protobuf_MethodDescriptorProto* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7332 | bool default_val = false; |
| 7333 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7334 | const upb_MiniTableField field = {6, UPB_SIZE(9, 2), 6, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7335 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7336 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7337 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7338 | UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_server_streaming(const google_protobuf_MethodDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7339 | const upb_MiniTableField field = {6, UPB_SIZE(9, 2), 6, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7340 | return _upb_Message_HasNonExtensionField(msg, &field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7341 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7342 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7343 | UPB_INLINE void google_protobuf_MethodDescriptorProto_set_name(google_protobuf_MethodDescriptorProto *msg, upb_StringView value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7344 | const upb_MiniTableField field = {1, UPB_SIZE(12, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7345 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7346 | } |
| 7347 | UPB_INLINE void google_protobuf_MethodDescriptorProto_set_input_type(google_protobuf_MethodDescriptorProto *msg, upb_StringView value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7348 | const upb_MiniTableField field = {2, UPB_SIZE(20, 24), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7349 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7350 | } |
| 7351 | UPB_INLINE void google_protobuf_MethodDescriptorProto_set_output_type(google_protobuf_MethodDescriptorProto *msg, upb_StringView value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7352 | const upb_MiniTableField field = {3, UPB_SIZE(28, 40), 3, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7353 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7354 | } |
| 7355 | UPB_INLINE void google_protobuf_MethodDescriptorProto_set_options(google_protobuf_MethodDescriptorProto *msg, google_protobuf_MethodOptions* value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7356 | const upb_MiniTableField field = {4, UPB_SIZE(4, 56), 4, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7357 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7358 | } |
| 7359 | UPB_INLINE struct google_protobuf_MethodOptions* google_protobuf_MethodDescriptorProto_mutable_options(google_protobuf_MethodDescriptorProto* msg, upb_Arena* arena) { |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7360 | struct google_protobuf_MethodOptions* sub = (struct google_protobuf_MethodOptions*)google_protobuf_MethodDescriptorProto_options(msg); |
| 7361 | if (sub == NULL) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7362 | sub = (struct google_protobuf_MethodOptions*)_upb_Message_New(&google_protobuf_MethodOptions_msg_init, arena); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7363 | if (sub) google_protobuf_MethodDescriptorProto_set_options(msg, sub); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7364 | } |
| 7365 | return sub; |
| 7366 | } |
| 7367 | UPB_INLINE void google_protobuf_MethodDescriptorProto_set_client_streaming(google_protobuf_MethodDescriptorProto *msg, bool value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7368 | const upb_MiniTableField field = {5, UPB_SIZE(8, 1), 5, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7369 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7370 | } |
| 7371 | UPB_INLINE void google_protobuf_MethodDescriptorProto_set_server_streaming(google_protobuf_MethodDescriptorProto *msg, bool value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7372 | const upb_MiniTableField field = {6, UPB_SIZE(9, 2), 6, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7373 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7374 | } |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7375 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7376 | /* google.protobuf.FileOptions */ |
| 7377 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7378 | UPB_INLINE google_protobuf_FileOptions* google_protobuf_FileOptions_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7379 | return (google_protobuf_FileOptions*)_upb_Message_New(&google_protobuf_FileOptions_msg_init, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7380 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7381 | UPB_INLINE google_protobuf_FileOptions* google_protobuf_FileOptions_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 7382 | google_protobuf_FileOptions* ret = google_protobuf_FileOptions_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 7383 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7384 | if (upb_Decode(buf, size, ret, &google_protobuf_FileOptions_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 7385 | return NULL; |
| 7386 | } |
| 7387 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7388 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7389 | UPB_INLINE google_protobuf_FileOptions* google_protobuf_FileOptions_parse_ex(const char* buf, size_t size, |
| 7390 | const upb_ExtensionRegistry* extreg, |
| 7391 | int options, upb_Arena* arena) { |
| 7392 | google_protobuf_FileOptions* ret = google_protobuf_FileOptions_new(arena); |
| 7393 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7394 | if (upb_Decode(buf, size, ret, &google_protobuf_FileOptions_msg_init, extreg, options, arena) != |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7395 | kUpb_DecodeStatus_Ok) { |
| 7396 | return NULL; |
| 7397 | } |
| 7398 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7399 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7400 | UPB_INLINE char* google_protobuf_FileOptions_serialize(const google_protobuf_FileOptions* msg, upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7401 | char* ptr; |
| 7402 | (void)upb_Encode(msg, &google_protobuf_FileOptions_msg_init, 0, arena, &ptr, len); |
| 7403 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7404 | } |
| 7405 | UPB_INLINE char* google_protobuf_FileOptions_serialize_ex(const google_protobuf_FileOptions* msg, int options, |
| 7406 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7407 | char* ptr; |
| 7408 | (void)upb_Encode(msg, &google_protobuf_FileOptions_msg_init, options, arena, &ptr, len); |
| 7409 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7410 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7411 | UPB_INLINE void google_protobuf_FileOptions_clear_java_package(google_protobuf_FileOptions* msg) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7412 | const upb_MiniTableField field = {1, UPB_SIZE(28, 24), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7413 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7414 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7415 | UPB_INLINE upb_StringView google_protobuf_FileOptions_java_package(const google_protobuf_FileOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7416 | upb_StringView default_val = upb_StringView_FromString(""); |
| 7417 | upb_StringView ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7418 | const upb_MiniTableField field = {1, UPB_SIZE(28, 24), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7419 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7420 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7421 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7422 | UPB_INLINE bool google_protobuf_FileOptions_has_java_package(const google_protobuf_FileOptions* msg) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7423 | const upb_MiniTableField field = {1, UPB_SIZE(28, 24), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7424 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7425 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7426 | UPB_INLINE void google_protobuf_FileOptions_clear_java_outer_classname(google_protobuf_FileOptions* msg) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7427 | const upb_MiniTableField field = {8, UPB_SIZE(36, 40), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7428 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7429 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7430 | UPB_INLINE upb_StringView google_protobuf_FileOptions_java_outer_classname(const google_protobuf_FileOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7431 | upb_StringView default_val = upb_StringView_FromString(""); |
| 7432 | upb_StringView ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7433 | const upb_MiniTableField field = {8, UPB_SIZE(36, 40), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7434 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7435 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7436 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7437 | UPB_INLINE bool google_protobuf_FileOptions_has_java_outer_classname(const google_protobuf_FileOptions* msg) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7438 | const upb_MiniTableField field = {8, UPB_SIZE(36, 40), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7439 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7440 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7441 | UPB_INLINE void google_protobuf_FileOptions_clear_optimize_for(google_protobuf_FileOptions* msg) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7442 | const upb_MiniTableField field = {9, 4, 3, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7443 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7444 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7445 | UPB_INLINE int32_t google_protobuf_FileOptions_optimize_for(const google_protobuf_FileOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7446 | int32_t default_val = 1; |
| 7447 | int32_t ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7448 | const upb_MiniTableField field = {9, 4, 3, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7449 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7450 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7451 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7452 | UPB_INLINE bool google_protobuf_FileOptions_has_optimize_for(const google_protobuf_FileOptions* msg) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7453 | const upb_MiniTableField field = {9, 4, 3, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7454 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7455 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7456 | UPB_INLINE void google_protobuf_FileOptions_clear_java_multiple_files(google_protobuf_FileOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7457 | const upb_MiniTableField field = {10, 8, 4, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7458 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7459 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7460 | UPB_INLINE bool google_protobuf_FileOptions_java_multiple_files(const google_protobuf_FileOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7461 | bool default_val = false; |
| 7462 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7463 | const upb_MiniTableField field = {10, 8, 4, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7464 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7465 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7466 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7467 | UPB_INLINE bool google_protobuf_FileOptions_has_java_multiple_files(const google_protobuf_FileOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7468 | const upb_MiniTableField field = {10, 8, 4, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7469 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7470 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7471 | UPB_INLINE void google_protobuf_FileOptions_clear_go_package(google_protobuf_FileOptions* msg) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7472 | const upb_MiniTableField field = {11, UPB_SIZE(44, 56), 5, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7473 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7474 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7475 | UPB_INLINE upb_StringView google_protobuf_FileOptions_go_package(const google_protobuf_FileOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7476 | upb_StringView default_val = upb_StringView_FromString(""); |
| 7477 | upb_StringView ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7478 | const upb_MiniTableField field = {11, UPB_SIZE(44, 56), 5, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7479 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7480 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7481 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7482 | UPB_INLINE bool google_protobuf_FileOptions_has_go_package(const google_protobuf_FileOptions* msg) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7483 | const upb_MiniTableField field = {11, UPB_SIZE(44, 56), 5, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7484 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7485 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7486 | UPB_INLINE void google_protobuf_FileOptions_clear_cc_generic_services(google_protobuf_FileOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7487 | const upb_MiniTableField field = {16, 9, 6, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7488 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7489 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7490 | UPB_INLINE bool google_protobuf_FileOptions_cc_generic_services(const google_protobuf_FileOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7491 | bool default_val = false; |
| 7492 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7493 | const upb_MiniTableField field = {16, 9, 6, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7494 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7495 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7496 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7497 | UPB_INLINE bool google_protobuf_FileOptions_has_cc_generic_services(const google_protobuf_FileOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7498 | const upb_MiniTableField field = {16, 9, 6, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7499 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7500 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7501 | UPB_INLINE void google_protobuf_FileOptions_clear_java_generic_services(google_protobuf_FileOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7502 | const upb_MiniTableField field = {17, 10, 7, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7503 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7504 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7505 | UPB_INLINE bool google_protobuf_FileOptions_java_generic_services(const google_protobuf_FileOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7506 | bool default_val = false; |
| 7507 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7508 | const upb_MiniTableField field = {17, 10, 7, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7509 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7510 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7511 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7512 | UPB_INLINE bool google_protobuf_FileOptions_has_java_generic_services(const google_protobuf_FileOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7513 | const upb_MiniTableField field = {17, 10, 7, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7514 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7515 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7516 | UPB_INLINE void google_protobuf_FileOptions_clear_py_generic_services(google_protobuf_FileOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7517 | const upb_MiniTableField field = {18, 11, 8, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7518 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7519 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7520 | UPB_INLINE bool google_protobuf_FileOptions_py_generic_services(const google_protobuf_FileOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7521 | bool default_val = false; |
| 7522 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7523 | const upb_MiniTableField field = {18, 11, 8, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7524 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7525 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7526 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7527 | UPB_INLINE bool google_protobuf_FileOptions_has_py_generic_services(const google_protobuf_FileOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7528 | const upb_MiniTableField field = {18, 11, 8, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7529 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7530 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7531 | UPB_INLINE void google_protobuf_FileOptions_clear_java_generate_equals_and_hash(google_protobuf_FileOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7532 | const upb_MiniTableField field = {20, 12, 9, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7533 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7534 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7535 | UPB_INLINE bool google_protobuf_FileOptions_java_generate_equals_and_hash(const google_protobuf_FileOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7536 | bool default_val = false; |
| 7537 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7538 | const upb_MiniTableField field = {20, 12, 9, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7539 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7540 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7541 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7542 | UPB_INLINE bool google_protobuf_FileOptions_has_java_generate_equals_and_hash(const google_protobuf_FileOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7543 | const upb_MiniTableField field = {20, 12, 9, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7544 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7545 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7546 | UPB_INLINE void google_protobuf_FileOptions_clear_deprecated(google_protobuf_FileOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7547 | const upb_MiniTableField field = {23, 13, 10, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7548 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7549 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7550 | UPB_INLINE bool google_protobuf_FileOptions_deprecated(const google_protobuf_FileOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7551 | bool default_val = false; |
| 7552 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7553 | const upb_MiniTableField field = {23, 13, 10, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7554 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7555 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7556 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7557 | UPB_INLINE bool google_protobuf_FileOptions_has_deprecated(const google_protobuf_FileOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7558 | const upb_MiniTableField field = {23, 13, 10, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7559 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7560 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7561 | UPB_INLINE void google_protobuf_FileOptions_clear_java_string_check_utf8(google_protobuf_FileOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7562 | const upb_MiniTableField field = {27, 14, 11, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7563 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7564 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7565 | UPB_INLINE bool google_protobuf_FileOptions_java_string_check_utf8(const google_protobuf_FileOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7566 | bool default_val = false; |
| 7567 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7568 | const upb_MiniTableField field = {27, 14, 11, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7569 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7570 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7571 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7572 | UPB_INLINE bool google_protobuf_FileOptions_has_java_string_check_utf8(const google_protobuf_FileOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7573 | const upb_MiniTableField field = {27, 14, 11, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7574 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7575 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7576 | UPB_INLINE void google_protobuf_FileOptions_clear_cc_enable_arenas(google_protobuf_FileOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7577 | const upb_MiniTableField field = {31, 15, 12, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7578 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7579 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7580 | UPB_INLINE bool google_protobuf_FileOptions_cc_enable_arenas(const google_protobuf_FileOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7581 | bool default_val = true; |
| 7582 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7583 | const upb_MiniTableField field = {31, 15, 12, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7584 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7585 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7586 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7587 | UPB_INLINE bool google_protobuf_FileOptions_has_cc_enable_arenas(const google_protobuf_FileOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7588 | const upb_MiniTableField field = {31, 15, 12, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7589 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7590 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7591 | UPB_INLINE void google_protobuf_FileOptions_clear_objc_class_prefix(google_protobuf_FileOptions* msg) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7592 | const upb_MiniTableField field = {36, UPB_SIZE(52, 72), 13, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7593 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7594 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7595 | UPB_INLINE upb_StringView google_protobuf_FileOptions_objc_class_prefix(const google_protobuf_FileOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7596 | upb_StringView default_val = upb_StringView_FromString(""); |
| 7597 | upb_StringView ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7598 | const upb_MiniTableField field = {36, UPB_SIZE(52, 72), 13, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7599 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7600 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7601 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7602 | UPB_INLINE bool google_protobuf_FileOptions_has_objc_class_prefix(const google_protobuf_FileOptions* msg) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7603 | const upb_MiniTableField field = {36, UPB_SIZE(52, 72), 13, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7604 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7605 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7606 | UPB_INLINE void google_protobuf_FileOptions_clear_csharp_namespace(google_protobuf_FileOptions* msg) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7607 | const upb_MiniTableField field = {37, UPB_SIZE(60, 88), 14, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7608 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7609 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7610 | UPB_INLINE upb_StringView google_protobuf_FileOptions_csharp_namespace(const google_protobuf_FileOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7611 | upb_StringView default_val = upb_StringView_FromString(""); |
| 7612 | upb_StringView ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7613 | const upb_MiniTableField field = {37, UPB_SIZE(60, 88), 14, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7614 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7615 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7616 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7617 | UPB_INLINE bool google_protobuf_FileOptions_has_csharp_namespace(const google_protobuf_FileOptions* msg) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7618 | const upb_MiniTableField field = {37, UPB_SIZE(60, 88), 14, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7619 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7620 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7621 | UPB_INLINE void google_protobuf_FileOptions_clear_swift_prefix(google_protobuf_FileOptions* msg) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7622 | const upb_MiniTableField field = {39, UPB_SIZE(68, 104), 15, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7623 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7624 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7625 | UPB_INLINE upb_StringView google_protobuf_FileOptions_swift_prefix(const google_protobuf_FileOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7626 | upb_StringView default_val = upb_StringView_FromString(""); |
| 7627 | upb_StringView ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7628 | const upb_MiniTableField field = {39, UPB_SIZE(68, 104), 15, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7629 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7630 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7631 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7632 | UPB_INLINE bool google_protobuf_FileOptions_has_swift_prefix(const google_protobuf_FileOptions* msg) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7633 | const upb_MiniTableField field = {39, UPB_SIZE(68, 104), 15, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7634 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7635 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7636 | UPB_INLINE void google_protobuf_FileOptions_clear_php_class_prefix(google_protobuf_FileOptions* msg) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7637 | const upb_MiniTableField field = {40, UPB_SIZE(76, 120), 16, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7638 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7639 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7640 | UPB_INLINE upb_StringView google_protobuf_FileOptions_php_class_prefix(const google_protobuf_FileOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7641 | upb_StringView default_val = upb_StringView_FromString(""); |
| 7642 | upb_StringView ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7643 | const upb_MiniTableField field = {40, UPB_SIZE(76, 120), 16, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7644 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7645 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7646 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7647 | UPB_INLINE bool google_protobuf_FileOptions_has_php_class_prefix(const google_protobuf_FileOptions* msg) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7648 | const upb_MiniTableField field = {40, UPB_SIZE(76, 120), 16, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7649 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7650 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7651 | UPB_INLINE void google_protobuf_FileOptions_clear_php_namespace(google_protobuf_FileOptions* msg) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7652 | const upb_MiniTableField field = {41, UPB_SIZE(84, 136), 17, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7653 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7654 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7655 | UPB_INLINE upb_StringView google_protobuf_FileOptions_php_namespace(const google_protobuf_FileOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7656 | upb_StringView default_val = upb_StringView_FromString(""); |
| 7657 | upb_StringView ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7658 | const upb_MiniTableField field = {41, UPB_SIZE(84, 136), 17, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7659 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7660 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7661 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7662 | UPB_INLINE bool google_protobuf_FileOptions_has_php_namespace(const google_protobuf_FileOptions* msg) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7663 | const upb_MiniTableField field = {41, UPB_SIZE(84, 136), 17, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7664 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7665 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7666 | UPB_INLINE void google_protobuf_FileOptions_clear_php_generic_services(google_protobuf_FileOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7667 | const upb_MiniTableField field = {42, 16, 18, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7668 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7669 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7670 | UPB_INLINE bool google_protobuf_FileOptions_php_generic_services(const google_protobuf_FileOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7671 | bool default_val = false; |
| 7672 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7673 | const upb_MiniTableField field = {42, 16, 18, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7674 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7675 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7676 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7677 | UPB_INLINE bool google_protobuf_FileOptions_has_php_generic_services(const google_protobuf_FileOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7678 | const upb_MiniTableField field = {42, 16, 18, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7679 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7680 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7681 | UPB_INLINE void google_protobuf_FileOptions_clear_php_metadata_namespace(google_protobuf_FileOptions* msg) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7682 | const upb_MiniTableField field = {44, UPB_SIZE(92, 152), 19, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7683 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7684 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7685 | UPB_INLINE upb_StringView google_protobuf_FileOptions_php_metadata_namespace(const google_protobuf_FileOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7686 | upb_StringView default_val = upb_StringView_FromString(""); |
| 7687 | upb_StringView ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7688 | const upb_MiniTableField field = {44, UPB_SIZE(92, 152), 19, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7689 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7690 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7691 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7692 | UPB_INLINE bool google_protobuf_FileOptions_has_php_metadata_namespace(const google_protobuf_FileOptions* msg) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7693 | const upb_MiniTableField field = {44, UPB_SIZE(92, 152), 19, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7694 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7695 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7696 | UPB_INLINE void google_protobuf_FileOptions_clear_ruby_package(google_protobuf_FileOptions* msg) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7697 | const upb_MiniTableField field = {45, UPB_SIZE(100, 168), 20, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7698 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7699 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7700 | UPB_INLINE upb_StringView google_protobuf_FileOptions_ruby_package(const google_protobuf_FileOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7701 | upb_StringView default_val = upb_StringView_FromString(""); |
| 7702 | upb_StringView ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7703 | const upb_MiniTableField field = {45, UPB_SIZE(100, 168), 20, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7704 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7705 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7706 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7707 | UPB_INLINE bool google_protobuf_FileOptions_has_ruby_package(const google_protobuf_FileOptions* msg) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7708 | const upb_MiniTableField field = {45, UPB_SIZE(100, 168), 20, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
| 7709 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 7710 | } |
| 7711 | UPB_INLINE void google_protobuf_FileOptions_clear_features(google_protobuf_FileOptions* msg) { |
| 7712 | const upb_MiniTableField field = {50, UPB_SIZE(20, 184), 21, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
| 7713 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 7714 | } |
| 7715 | UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_FileOptions_features(const google_protobuf_FileOptions* msg) { |
| 7716 | const google_protobuf_FeatureSet* default_val = NULL; |
| 7717 | const google_protobuf_FeatureSet* ret; |
| 7718 | const upb_MiniTableField field = {50, UPB_SIZE(20, 184), 21, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
| 7719 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 7720 | return ret; |
| 7721 | } |
| 7722 | UPB_INLINE bool google_protobuf_FileOptions_has_features(const google_protobuf_FileOptions* msg) { |
| 7723 | const upb_MiniTableField field = {50, UPB_SIZE(20, 184), 21, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7724 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7725 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7726 | UPB_INLINE void google_protobuf_FileOptions_clear_uninterpreted_option(google_protobuf_FileOptions* msg) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7727 | const upb_MiniTableField field = {999, UPB_SIZE(24, 192), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7728 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7729 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 7730 | UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_FileOptions_uninterpreted_option(const google_protobuf_FileOptions* msg, size_t* size) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7731 | const upb_MiniTableField field = {999, UPB_SIZE(24, 192), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 7732 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 7733 | if (arr) { |
| 7734 | if (size) *size = arr->size; |
| 7735 | return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr); |
| 7736 | } else { |
| 7737 | if (size) *size = 0; |
| 7738 | return NULL; |
| 7739 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7740 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 7741 | UPB_INLINE const upb_Array* _google_protobuf_FileOptions_uninterpreted_option_upb_array(const google_protobuf_FileOptions* msg, size_t* size) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7742 | const upb_MiniTableField field = {999, UPB_SIZE(24, 192), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 7743 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 7744 | if (size) { |
| 7745 | *size = arr ? arr->size : 0; |
| 7746 | } |
| 7747 | return arr; |
| 7748 | } |
| 7749 | UPB_INLINE upb_Array* _google_protobuf_FileOptions_uninterpreted_option_mutable_upb_array(const google_protobuf_FileOptions* msg, size_t* size, upb_Arena* arena) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7750 | const upb_MiniTableField field = {999, UPB_SIZE(24, 192), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 7751 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 7752 | (upb_Message*)msg, &field, arena); |
| 7753 | if (size) { |
| 7754 | *size = arr ? arr->size : 0; |
| 7755 | } |
| 7756 | return arr; |
| 7757 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7758 | UPB_INLINE bool google_protobuf_FileOptions_has_uninterpreted_option(const google_protobuf_FileOptions* msg) { |
| 7759 | size_t size; |
| 7760 | google_protobuf_FileOptions_uninterpreted_option(msg, &size); |
| 7761 | return size != 0; |
| 7762 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7763 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7764 | UPB_INLINE void google_protobuf_FileOptions_set_java_package(google_protobuf_FileOptions *msg, upb_StringView value) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7765 | const upb_MiniTableField field = {1, UPB_SIZE(28, 24), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7766 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7767 | } |
| 7768 | UPB_INLINE void google_protobuf_FileOptions_set_java_outer_classname(google_protobuf_FileOptions *msg, upb_StringView value) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7769 | const upb_MiniTableField field = {8, UPB_SIZE(36, 40), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7770 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7771 | } |
| 7772 | UPB_INLINE void google_protobuf_FileOptions_set_optimize_for(google_protobuf_FileOptions *msg, int32_t value) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7773 | const upb_MiniTableField field = {9, 4, 3, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7774 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7775 | } |
| 7776 | UPB_INLINE void google_protobuf_FileOptions_set_java_multiple_files(google_protobuf_FileOptions *msg, bool value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7777 | const upb_MiniTableField field = {10, 8, 4, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7778 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7779 | } |
| 7780 | UPB_INLINE void google_protobuf_FileOptions_set_go_package(google_protobuf_FileOptions *msg, upb_StringView value) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7781 | const upb_MiniTableField field = {11, UPB_SIZE(44, 56), 5, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7782 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7783 | } |
| 7784 | UPB_INLINE void google_protobuf_FileOptions_set_cc_generic_services(google_protobuf_FileOptions *msg, bool value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7785 | const upb_MiniTableField field = {16, 9, 6, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7786 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7787 | } |
| 7788 | UPB_INLINE void google_protobuf_FileOptions_set_java_generic_services(google_protobuf_FileOptions *msg, bool value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7789 | const upb_MiniTableField field = {17, 10, 7, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7790 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7791 | } |
| 7792 | UPB_INLINE void google_protobuf_FileOptions_set_py_generic_services(google_protobuf_FileOptions *msg, bool value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7793 | const upb_MiniTableField field = {18, 11, 8, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7794 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7795 | } |
| 7796 | UPB_INLINE void google_protobuf_FileOptions_set_java_generate_equals_and_hash(google_protobuf_FileOptions *msg, bool value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7797 | const upb_MiniTableField field = {20, 12, 9, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7798 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7799 | } |
| 7800 | UPB_INLINE void google_protobuf_FileOptions_set_deprecated(google_protobuf_FileOptions *msg, bool value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7801 | const upb_MiniTableField field = {23, 13, 10, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7802 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7803 | } |
| 7804 | UPB_INLINE void google_protobuf_FileOptions_set_java_string_check_utf8(google_protobuf_FileOptions *msg, bool value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7805 | const upb_MiniTableField field = {27, 14, 11, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7806 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7807 | } |
| 7808 | UPB_INLINE void google_protobuf_FileOptions_set_cc_enable_arenas(google_protobuf_FileOptions *msg, bool value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7809 | const upb_MiniTableField field = {31, 15, 12, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7810 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7811 | } |
| 7812 | UPB_INLINE void google_protobuf_FileOptions_set_objc_class_prefix(google_protobuf_FileOptions *msg, upb_StringView value) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7813 | const upb_MiniTableField field = {36, UPB_SIZE(52, 72), 13, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7814 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7815 | } |
| 7816 | UPB_INLINE void google_protobuf_FileOptions_set_csharp_namespace(google_protobuf_FileOptions *msg, upb_StringView value) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7817 | const upb_MiniTableField field = {37, UPB_SIZE(60, 88), 14, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7818 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7819 | } |
| 7820 | UPB_INLINE void google_protobuf_FileOptions_set_swift_prefix(google_protobuf_FileOptions *msg, upb_StringView value) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7821 | const upb_MiniTableField field = {39, UPB_SIZE(68, 104), 15, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7822 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7823 | } |
| 7824 | UPB_INLINE void google_protobuf_FileOptions_set_php_class_prefix(google_protobuf_FileOptions *msg, upb_StringView value) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7825 | const upb_MiniTableField field = {40, UPB_SIZE(76, 120), 16, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7826 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7827 | } |
| 7828 | UPB_INLINE void google_protobuf_FileOptions_set_php_namespace(google_protobuf_FileOptions *msg, upb_StringView value) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7829 | const upb_MiniTableField field = {41, UPB_SIZE(84, 136), 17, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7830 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7831 | } |
| 7832 | UPB_INLINE void google_protobuf_FileOptions_set_php_generic_services(google_protobuf_FileOptions *msg, bool value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7833 | const upb_MiniTableField field = {42, 16, 18, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7834 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7835 | } |
| 7836 | UPB_INLINE void google_protobuf_FileOptions_set_php_metadata_namespace(google_protobuf_FileOptions *msg, upb_StringView value) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7837 | const upb_MiniTableField field = {44, UPB_SIZE(92, 152), 19, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7838 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7839 | } |
| 7840 | UPB_INLINE void google_protobuf_FileOptions_set_ruby_package(google_protobuf_FileOptions *msg, upb_StringView value) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7841 | const upb_MiniTableField field = {45, UPB_SIZE(100, 168), 20, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7842 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7843 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7844 | UPB_INLINE void google_protobuf_FileOptions_set_features(google_protobuf_FileOptions *msg, google_protobuf_FeatureSet* value) { |
| 7845 | const upb_MiniTableField field = {50, UPB_SIZE(20, 184), 21, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
| 7846 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 7847 | } |
| 7848 | UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_FileOptions_mutable_features(google_protobuf_FileOptions* msg, upb_Arena* arena) { |
| 7849 | struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_FileOptions_features(msg); |
| 7850 | if (sub == NULL) { |
| 7851 | sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google_protobuf_FeatureSet_msg_init, arena); |
| 7852 | if (sub) google_protobuf_FileOptions_set_features(msg, sub); |
| 7853 | } |
| 7854 | return sub; |
| 7855 | } |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7856 | UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FileOptions_mutable_uninterpreted_option(google_protobuf_FileOptions* msg, size_t* size) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7857 | upb_MiniTableField field = {999, UPB_SIZE(24, 192), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 7858 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 7859 | if (arr) { |
| 7860 | if (size) *size = arr->size; |
| 7861 | return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr); |
| 7862 | } else { |
| 7863 | if (size) *size = 0; |
| 7864 | return NULL; |
| 7865 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7866 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 7867 | UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FileOptions_resize_uninterpreted_option(google_protobuf_FileOptions* msg, size_t size, upb_Arena* arena) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7868 | upb_MiniTableField field = {999, UPB_SIZE(24, 192), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Jie Luo | f36a5c6 | 2023-05-23 17:56:18 -0700 | [diff] [blame] | 7869 | return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7870 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7871 | UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_FileOptions_add_uninterpreted_option(google_protobuf_FileOptions* msg, upb_Arena* arena) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7872 | upb_MiniTableField field = {999, UPB_SIZE(24, 192), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 7873 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 7874 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 7875 | return NULL; |
| 7876 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7877 | struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)_upb_Message_New(&google_protobuf_UninterpretedOption_msg_init, arena); |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 7878 | if (!arr || !sub) return NULL; |
| 7879 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7880 | return sub; |
| 7881 | } |
| 7882 | |
| 7883 | /* google.protobuf.MessageOptions */ |
| 7884 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7885 | UPB_INLINE google_protobuf_MessageOptions* google_protobuf_MessageOptions_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7886 | return (google_protobuf_MessageOptions*)_upb_Message_New(&google_protobuf_MessageOptions_msg_init, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7887 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7888 | UPB_INLINE google_protobuf_MessageOptions* google_protobuf_MessageOptions_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 7889 | google_protobuf_MessageOptions* ret = google_protobuf_MessageOptions_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 7890 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7891 | if (upb_Decode(buf, size, ret, &google_protobuf_MessageOptions_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 7892 | return NULL; |
| 7893 | } |
| 7894 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7895 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7896 | UPB_INLINE google_protobuf_MessageOptions* google_protobuf_MessageOptions_parse_ex(const char* buf, size_t size, |
| 7897 | const upb_ExtensionRegistry* extreg, |
| 7898 | int options, upb_Arena* arena) { |
| 7899 | google_protobuf_MessageOptions* ret = google_protobuf_MessageOptions_new(arena); |
| 7900 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7901 | if (upb_Decode(buf, size, ret, &google_protobuf_MessageOptions_msg_init, extreg, options, arena) != |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7902 | kUpb_DecodeStatus_Ok) { |
| 7903 | return NULL; |
| 7904 | } |
| 7905 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7906 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7907 | UPB_INLINE char* google_protobuf_MessageOptions_serialize(const google_protobuf_MessageOptions* msg, upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7908 | char* ptr; |
| 7909 | (void)upb_Encode(msg, &google_protobuf_MessageOptions_msg_init, 0, arena, &ptr, len); |
| 7910 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7911 | } |
| 7912 | UPB_INLINE char* google_protobuf_MessageOptions_serialize_ex(const google_protobuf_MessageOptions* msg, int options, |
| 7913 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7914 | char* ptr; |
| 7915 | (void)upb_Encode(msg, &google_protobuf_MessageOptions_msg_init, options, arena, &ptr, len); |
| 7916 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7917 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7918 | UPB_INLINE void google_protobuf_MessageOptions_clear_message_set_wire_format(google_protobuf_MessageOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7919 | const upb_MiniTableField field = {1, 1, 1, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7920 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7921 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7922 | UPB_INLINE bool google_protobuf_MessageOptions_message_set_wire_format(const google_protobuf_MessageOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7923 | bool default_val = false; |
| 7924 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7925 | const upb_MiniTableField field = {1, 1, 1, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7926 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7927 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7928 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7929 | UPB_INLINE bool google_protobuf_MessageOptions_has_message_set_wire_format(const google_protobuf_MessageOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7930 | const upb_MiniTableField field = {1, 1, 1, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7931 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7932 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7933 | UPB_INLINE void google_protobuf_MessageOptions_clear_no_standard_descriptor_accessor(google_protobuf_MessageOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7934 | const upb_MiniTableField field = {2, 2, 2, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7935 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7936 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7937 | UPB_INLINE bool google_protobuf_MessageOptions_no_standard_descriptor_accessor(const google_protobuf_MessageOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7938 | bool default_val = false; |
| 7939 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7940 | const upb_MiniTableField field = {2, 2, 2, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7941 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7942 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7943 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7944 | UPB_INLINE bool google_protobuf_MessageOptions_has_no_standard_descriptor_accessor(const google_protobuf_MessageOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7945 | const upb_MiniTableField field = {2, 2, 2, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7946 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7947 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7948 | UPB_INLINE void google_protobuf_MessageOptions_clear_deprecated(google_protobuf_MessageOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7949 | const upb_MiniTableField field = {3, 3, 3, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7950 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7951 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7952 | UPB_INLINE bool google_protobuf_MessageOptions_deprecated(const google_protobuf_MessageOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7953 | bool default_val = false; |
| 7954 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7955 | const upb_MiniTableField field = {3, 3, 3, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7956 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7957 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7958 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7959 | UPB_INLINE bool google_protobuf_MessageOptions_has_deprecated(const google_protobuf_MessageOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7960 | const upb_MiniTableField field = {3, 3, 3, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7961 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7962 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7963 | UPB_INLINE void google_protobuf_MessageOptions_clear_map_entry(google_protobuf_MessageOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7964 | const upb_MiniTableField field = {7, 4, 4, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7965 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7966 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7967 | UPB_INLINE bool google_protobuf_MessageOptions_map_entry(const google_protobuf_MessageOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7968 | bool default_val = false; |
| 7969 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7970 | const upb_MiniTableField field = {7, 4, 4, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7971 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7972 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7973 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7974 | UPB_INLINE bool google_protobuf_MessageOptions_has_map_entry(const google_protobuf_MessageOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7975 | const upb_MiniTableField field = {7, 4, 4, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7976 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7977 | } |
Mike Kruskal | 6b87d6f | 2022-12-14 10:36:53 -0800 | [diff] [blame] | 7978 | UPB_INLINE void google_protobuf_MessageOptions_clear_deprecated_legacy_json_field_conflicts(google_protobuf_MessageOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7979 | const upb_MiniTableField field = {11, 5, 5, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 6b87d6f | 2022-12-14 10:36:53 -0800 | [diff] [blame] | 7980 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 7981 | } |
| 7982 | UPB_INLINE bool google_protobuf_MessageOptions_deprecated_legacy_json_field_conflicts(const google_protobuf_MessageOptions* msg) { |
| 7983 | bool default_val = false; |
| 7984 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7985 | const upb_MiniTableField field = {11, 5, 5, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 6b87d6f | 2022-12-14 10:36:53 -0800 | [diff] [blame] | 7986 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 7987 | return ret; |
| 7988 | } |
| 7989 | UPB_INLINE bool google_protobuf_MessageOptions_has_deprecated_legacy_json_field_conflicts(const google_protobuf_MessageOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7990 | const upb_MiniTableField field = {11, 5, 5, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 6b87d6f | 2022-12-14 10:36:53 -0800 | [diff] [blame] | 7991 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 7992 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7993 | UPB_INLINE void google_protobuf_MessageOptions_clear_features(google_protobuf_MessageOptions* msg) { |
| 7994 | const upb_MiniTableField field = {12, 8, 6, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
| 7995 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 7996 | } |
| 7997 | UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_MessageOptions_features(const google_protobuf_MessageOptions* msg) { |
| 7998 | const google_protobuf_FeatureSet* default_val = NULL; |
| 7999 | const google_protobuf_FeatureSet* ret; |
| 8000 | const upb_MiniTableField field = {12, 8, 6, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
| 8001 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 8002 | return ret; |
| 8003 | } |
| 8004 | UPB_INLINE bool google_protobuf_MessageOptions_has_features(const google_protobuf_MessageOptions* msg) { |
| 8005 | const upb_MiniTableField field = {12, 8, 6, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
| 8006 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 8007 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8008 | UPB_INLINE void google_protobuf_MessageOptions_clear_uninterpreted_option(google_protobuf_MessageOptions* msg) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8009 | const upb_MiniTableField field = {999, UPB_SIZE(12, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 8010 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8011 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 8012 | UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_MessageOptions_uninterpreted_option(const google_protobuf_MessageOptions* msg, size_t* size) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8013 | const upb_MiniTableField field = {999, UPB_SIZE(12, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 8014 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 8015 | if (arr) { |
| 8016 | if (size) *size = arr->size; |
| 8017 | return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr); |
| 8018 | } else { |
| 8019 | if (size) *size = 0; |
| 8020 | return NULL; |
| 8021 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8022 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 8023 | UPB_INLINE const upb_Array* _google_protobuf_MessageOptions_uninterpreted_option_upb_array(const google_protobuf_MessageOptions* msg, size_t* size) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8024 | const upb_MiniTableField field = {999, UPB_SIZE(12, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 8025 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 8026 | if (size) { |
| 8027 | *size = arr ? arr->size : 0; |
| 8028 | } |
| 8029 | return arr; |
| 8030 | } |
| 8031 | UPB_INLINE upb_Array* _google_protobuf_MessageOptions_uninterpreted_option_mutable_upb_array(const google_protobuf_MessageOptions* msg, size_t* size, upb_Arena* arena) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8032 | const upb_MiniTableField field = {999, UPB_SIZE(12, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 8033 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 8034 | (upb_Message*)msg, &field, arena); |
| 8035 | if (size) { |
| 8036 | *size = arr ? arr->size : 0; |
| 8037 | } |
| 8038 | return arr; |
| 8039 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8040 | UPB_INLINE bool google_protobuf_MessageOptions_has_uninterpreted_option(const google_protobuf_MessageOptions* msg) { |
| 8041 | size_t size; |
| 8042 | google_protobuf_MessageOptions_uninterpreted_option(msg, &size); |
| 8043 | return size != 0; |
| 8044 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8045 | |
| 8046 | UPB_INLINE void google_protobuf_MessageOptions_set_message_set_wire_format(google_protobuf_MessageOptions *msg, bool value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8047 | const upb_MiniTableField field = {1, 1, 1, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 8048 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8049 | } |
| 8050 | UPB_INLINE void google_protobuf_MessageOptions_set_no_standard_descriptor_accessor(google_protobuf_MessageOptions *msg, bool value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8051 | const upb_MiniTableField field = {2, 2, 2, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 8052 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8053 | } |
| 8054 | UPB_INLINE void google_protobuf_MessageOptions_set_deprecated(google_protobuf_MessageOptions *msg, bool value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8055 | const upb_MiniTableField field = {3, 3, 3, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 8056 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8057 | } |
| 8058 | UPB_INLINE void google_protobuf_MessageOptions_set_map_entry(google_protobuf_MessageOptions *msg, bool value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8059 | const upb_MiniTableField field = {7, 4, 4, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 8060 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8061 | } |
| 8062 | UPB_INLINE void google_protobuf_MessageOptions_set_deprecated_legacy_json_field_conflicts(google_protobuf_MessageOptions *msg, bool value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8063 | const upb_MiniTableField field = {11, 5, 5, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 6b87d6f | 2022-12-14 10:36:53 -0800 | [diff] [blame] | 8064 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8065 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8066 | UPB_INLINE void google_protobuf_MessageOptions_set_features(google_protobuf_MessageOptions *msg, google_protobuf_FeatureSet* value) { |
| 8067 | const upb_MiniTableField field = {12, 8, 6, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
| 8068 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 8069 | } |
| 8070 | UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_MessageOptions_mutable_features(google_protobuf_MessageOptions* msg, upb_Arena* arena) { |
| 8071 | struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_MessageOptions_features(msg); |
| 8072 | if (sub == NULL) { |
| 8073 | sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google_protobuf_FeatureSet_msg_init, arena); |
| 8074 | if (sub) google_protobuf_MessageOptions_set_features(msg, sub); |
| 8075 | } |
| 8076 | return sub; |
| 8077 | } |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8078 | UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_MessageOptions_mutable_uninterpreted_option(google_protobuf_MessageOptions* msg, size_t* size) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8079 | upb_MiniTableField field = {999, UPB_SIZE(12, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 8080 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 8081 | if (arr) { |
| 8082 | if (size) *size = arr->size; |
| 8083 | return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr); |
| 8084 | } else { |
| 8085 | if (size) *size = 0; |
| 8086 | return NULL; |
| 8087 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8088 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 8089 | UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_MessageOptions_resize_uninterpreted_option(google_protobuf_MessageOptions* msg, size_t size, upb_Arena* arena) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8090 | upb_MiniTableField field = {999, UPB_SIZE(12, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Jie Luo | f36a5c6 | 2023-05-23 17:56:18 -0700 | [diff] [blame] | 8091 | return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8092 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8093 | UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_MessageOptions_add_uninterpreted_option(google_protobuf_MessageOptions* msg, upb_Arena* arena) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8094 | upb_MiniTableField field = {999, UPB_SIZE(12, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 8095 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 8096 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 8097 | return NULL; |
| 8098 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8099 | struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)_upb_Message_New(&google_protobuf_UninterpretedOption_msg_init, arena); |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 8100 | if (!arr || !sub) return NULL; |
| 8101 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8102 | return sub; |
| 8103 | } |
| 8104 | |
| 8105 | /* google.protobuf.FieldOptions */ |
| 8106 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8107 | UPB_INLINE google_protobuf_FieldOptions* google_protobuf_FieldOptions_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8108 | return (google_protobuf_FieldOptions*)_upb_Message_New(&google_protobuf_FieldOptions_msg_init, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8109 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8110 | UPB_INLINE google_protobuf_FieldOptions* google_protobuf_FieldOptions_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 8111 | google_protobuf_FieldOptions* ret = google_protobuf_FieldOptions_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 8112 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8113 | if (upb_Decode(buf, size, ret, &google_protobuf_FieldOptions_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 8114 | return NULL; |
| 8115 | } |
| 8116 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8117 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8118 | UPB_INLINE google_protobuf_FieldOptions* google_protobuf_FieldOptions_parse_ex(const char* buf, size_t size, |
| 8119 | const upb_ExtensionRegistry* extreg, |
| 8120 | int options, upb_Arena* arena) { |
| 8121 | google_protobuf_FieldOptions* ret = google_protobuf_FieldOptions_new(arena); |
| 8122 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8123 | if (upb_Decode(buf, size, ret, &google_protobuf_FieldOptions_msg_init, extreg, options, arena) != |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8124 | kUpb_DecodeStatus_Ok) { |
| 8125 | return NULL; |
| 8126 | } |
| 8127 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8128 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8129 | UPB_INLINE char* google_protobuf_FieldOptions_serialize(const google_protobuf_FieldOptions* msg, upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8130 | char* ptr; |
| 8131 | (void)upb_Encode(msg, &google_protobuf_FieldOptions_msg_init, 0, arena, &ptr, len); |
| 8132 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8133 | } |
| 8134 | UPB_INLINE char* google_protobuf_FieldOptions_serialize_ex(const google_protobuf_FieldOptions* msg, int options, |
| 8135 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8136 | char* ptr; |
| 8137 | (void)upb_Encode(msg, &google_protobuf_FieldOptions_msg_init, options, arena, &ptr, len); |
| 8138 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8139 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8140 | UPB_INLINE void google_protobuf_FieldOptions_clear_ctype(google_protobuf_FieldOptions* msg) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8141 | const upb_MiniTableField field = {1, 4, 1, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 8142 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8143 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8144 | UPB_INLINE int32_t google_protobuf_FieldOptions_ctype(const google_protobuf_FieldOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8145 | int32_t default_val = 0; |
| 8146 | int32_t ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8147 | const upb_MiniTableField field = {1, 4, 1, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 8148 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8149 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8150 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8151 | UPB_INLINE bool google_protobuf_FieldOptions_has_ctype(const google_protobuf_FieldOptions* msg) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8152 | const upb_MiniTableField field = {1, 4, 1, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 8153 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8154 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8155 | UPB_INLINE void google_protobuf_FieldOptions_clear_packed(google_protobuf_FieldOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8156 | const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 8157 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8158 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8159 | UPB_INLINE bool google_protobuf_FieldOptions_packed(const google_protobuf_FieldOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8160 | bool default_val = false; |
| 8161 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8162 | const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 8163 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8164 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8165 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8166 | UPB_INLINE bool google_protobuf_FieldOptions_has_packed(const google_protobuf_FieldOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8167 | const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 8168 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8169 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8170 | UPB_INLINE void google_protobuf_FieldOptions_clear_deprecated(google_protobuf_FieldOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8171 | const upb_MiniTableField field = {3, 9, 3, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 8172 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8173 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8174 | UPB_INLINE bool google_protobuf_FieldOptions_deprecated(const google_protobuf_FieldOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8175 | bool default_val = false; |
| 8176 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8177 | const upb_MiniTableField field = {3, 9, 3, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 8178 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8179 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8180 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8181 | UPB_INLINE bool google_protobuf_FieldOptions_has_deprecated(const google_protobuf_FieldOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8182 | const upb_MiniTableField field = {3, 9, 3, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 8183 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8184 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8185 | UPB_INLINE void google_protobuf_FieldOptions_clear_lazy(google_protobuf_FieldOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8186 | const upb_MiniTableField field = {5, 10, 4, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 8187 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8188 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8189 | UPB_INLINE bool google_protobuf_FieldOptions_lazy(const google_protobuf_FieldOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8190 | bool default_val = false; |
| 8191 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8192 | const upb_MiniTableField field = {5, 10, 4, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 8193 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8194 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8195 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8196 | UPB_INLINE bool google_protobuf_FieldOptions_has_lazy(const google_protobuf_FieldOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8197 | const upb_MiniTableField field = {5, 10, 4, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 8198 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8199 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8200 | UPB_INLINE void google_protobuf_FieldOptions_clear_jstype(google_protobuf_FieldOptions* msg) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8201 | const upb_MiniTableField field = {6, 12, 5, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 8202 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8203 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8204 | UPB_INLINE int32_t google_protobuf_FieldOptions_jstype(const google_protobuf_FieldOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8205 | int32_t default_val = 0; |
| 8206 | int32_t ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8207 | const upb_MiniTableField field = {6, 12, 5, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 8208 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8209 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8210 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8211 | UPB_INLINE bool google_protobuf_FieldOptions_has_jstype(const google_protobuf_FieldOptions* msg) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8212 | const upb_MiniTableField field = {6, 12, 5, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 8213 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8214 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8215 | UPB_INLINE void google_protobuf_FieldOptions_clear_weak(google_protobuf_FieldOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8216 | const upb_MiniTableField field = {10, 16, 6, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 8217 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8218 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8219 | UPB_INLINE bool google_protobuf_FieldOptions_weak(const google_protobuf_FieldOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8220 | bool default_val = false; |
| 8221 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8222 | const upb_MiniTableField field = {10, 16, 6, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 8223 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8224 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8225 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8226 | UPB_INLINE bool google_protobuf_FieldOptions_has_weak(const google_protobuf_FieldOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8227 | const upb_MiniTableField field = {10, 16, 6, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 8228 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8229 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8230 | UPB_INLINE void google_protobuf_FieldOptions_clear_unverified_lazy(google_protobuf_FieldOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8231 | const upb_MiniTableField field = {15, 17, 7, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 8232 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8233 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8234 | UPB_INLINE bool google_protobuf_FieldOptions_unverified_lazy(const google_protobuf_FieldOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8235 | bool default_val = false; |
| 8236 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8237 | const upb_MiniTableField field = {15, 17, 7, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 8238 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8239 | return ret; |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8240 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8241 | UPB_INLINE bool google_protobuf_FieldOptions_has_unverified_lazy(const google_protobuf_FieldOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8242 | const upb_MiniTableField field = {15, 17, 7, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 8243 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8244 | } |
Protobuf Team Bot | 9238c48 | 2022-12-16 20:01:55 -0800 | [diff] [blame] | 8245 | UPB_INLINE void google_protobuf_FieldOptions_clear_debug_redact(google_protobuf_FieldOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8246 | const upb_MiniTableField field = {16, 18, 8, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Protobuf Team Bot | 9238c48 | 2022-12-16 20:01:55 -0800 | [diff] [blame] | 8247 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 8248 | } |
| 8249 | UPB_INLINE bool google_protobuf_FieldOptions_debug_redact(const google_protobuf_FieldOptions* msg) { |
| 8250 | bool default_val = false; |
| 8251 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8252 | const upb_MiniTableField field = {16, 18, 8, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Protobuf Team Bot | 9238c48 | 2022-12-16 20:01:55 -0800 | [diff] [blame] | 8253 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 8254 | return ret; |
| 8255 | } |
| 8256 | UPB_INLINE bool google_protobuf_FieldOptions_has_debug_redact(const google_protobuf_FieldOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8257 | const upb_MiniTableField field = {16, 18, 8, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Protobuf Team Bot | 9238c48 | 2022-12-16 20:01:55 -0800 | [diff] [blame] | 8258 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 8259 | } |
Adam Cozzette | 5a56837 | 2023-01-24 20:35:59 -0800 | [diff] [blame] | 8260 | UPB_INLINE void google_protobuf_FieldOptions_clear_retention(google_protobuf_FieldOptions* msg) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8261 | const upb_MiniTableField field = {17, 20, 9, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Adam Cozzette | 5a56837 | 2023-01-24 20:35:59 -0800 | [diff] [blame] | 8262 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 8263 | } |
| 8264 | UPB_INLINE int32_t google_protobuf_FieldOptions_retention(const google_protobuf_FieldOptions* msg) { |
| 8265 | int32_t default_val = 0; |
| 8266 | int32_t ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8267 | const upb_MiniTableField field = {17, 20, 9, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Adam Cozzette | 5a56837 | 2023-01-24 20:35:59 -0800 | [diff] [blame] | 8268 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 8269 | return ret; |
| 8270 | } |
| 8271 | UPB_INLINE bool google_protobuf_FieldOptions_has_retention(const google_protobuf_FieldOptions* msg) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8272 | const upb_MiniTableField field = {17, 20, 9, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Adam Cozzette | 5a56837 | 2023-01-24 20:35:59 -0800 | [diff] [blame] | 8273 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 8274 | } |
Mike Kruskal | 0c12139 | 2023-03-18 00:05:41 -0700 | [diff] [blame] | 8275 | UPB_INLINE void google_protobuf_FieldOptions_clear_targets(google_protobuf_FieldOptions* msg) { |
Sandy Zhang | 96c601d | 2023-07-05 12:39:20 -0700 | [diff] [blame] | 8276 | const upb_MiniTableField field = {19, 24, 0, 6, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Adam Cozzette | 5a56837 | 2023-01-24 20:35:59 -0800 | [diff] [blame] | 8277 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 8278 | } |
Mike Kruskal | 0c12139 | 2023-03-18 00:05:41 -0700 | [diff] [blame] | 8279 | UPB_INLINE int32_t const* google_protobuf_FieldOptions_targets(const google_protobuf_FieldOptions* msg, size_t* size) { |
Sandy Zhang | 96c601d | 2023-07-05 12:39:20 -0700 | [diff] [blame] | 8280 | const upb_MiniTableField field = {19, 24, 0, 6, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 0c12139 | 2023-03-18 00:05:41 -0700 | [diff] [blame] | 8281 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 8282 | if (arr) { |
| 8283 | if (size) *size = arr->size; |
| 8284 | return (int32_t const*)_upb_array_constptr(arr); |
| 8285 | } else { |
| 8286 | if (size) *size = 0; |
| 8287 | return NULL; |
| 8288 | } |
Adam Cozzette | 5a56837 | 2023-01-24 20:35:59 -0800 | [diff] [blame] | 8289 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 8290 | UPB_INLINE const upb_Array* _google_protobuf_FieldOptions_targets_upb_array(const google_protobuf_FieldOptions* msg, size_t* size) { |
Sandy Zhang | 96c601d | 2023-07-05 12:39:20 -0700 | [diff] [blame] | 8291 | const upb_MiniTableField field = {19, 24, 0, 6, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 8292 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 8293 | if (size) { |
| 8294 | *size = arr ? arr->size : 0; |
| 8295 | } |
| 8296 | return arr; |
| 8297 | } |
| 8298 | UPB_INLINE upb_Array* _google_protobuf_FieldOptions_targets_mutable_upb_array(const google_protobuf_FieldOptions* msg, size_t* size, upb_Arena* arena) { |
Sandy Zhang | 96c601d | 2023-07-05 12:39:20 -0700 | [diff] [blame] | 8299 | const upb_MiniTableField field = {19, 24, 0, 6, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 8300 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 8301 | (upb_Message*)msg, &field, arena); |
| 8302 | if (size) { |
| 8303 | *size = arr ? arr->size : 0; |
| 8304 | } |
| 8305 | return arr; |
| 8306 | } |
Mike Kruskal | 0c12139 | 2023-03-18 00:05:41 -0700 | [diff] [blame] | 8307 | UPB_INLINE bool google_protobuf_FieldOptions_has_targets(const google_protobuf_FieldOptions* msg) { |
| 8308 | size_t size; |
| 8309 | google_protobuf_FieldOptions_targets(msg, &size); |
| 8310 | return size != 0; |
Adam Cozzette | 5a56837 | 2023-01-24 20:35:59 -0800 | [diff] [blame] | 8311 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8312 | UPB_INLINE void google_protobuf_FieldOptions_clear_edition_defaults(google_protobuf_FieldOptions* msg) { |
Sandy Zhang | 96c601d | 2023-07-05 12:39:20 -0700 | [diff] [blame] | 8313 | const upb_MiniTableField field = {20, UPB_SIZE(28, 32), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8314 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 8315 | } |
| 8316 | UPB_INLINE const google_protobuf_FieldOptions_EditionDefault* const* google_protobuf_FieldOptions_edition_defaults(const google_protobuf_FieldOptions* msg, size_t* size) { |
Sandy Zhang | 96c601d | 2023-07-05 12:39:20 -0700 | [diff] [blame] | 8317 | const upb_MiniTableField field = {20, UPB_SIZE(28, 32), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8318 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 8319 | if (arr) { |
| 8320 | if (size) *size = arr->size; |
| 8321 | return (const google_protobuf_FieldOptions_EditionDefault* const*)_upb_array_constptr(arr); |
| 8322 | } else { |
| 8323 | if (size) *size = 0; |
| 8324 | return NULL; |
| 8325 | } |
| 8326 | } |
| 8327 | UPB_INLINE const upb_Array* _google_protobuf_FieldOptions_edition_defaults_upb_array(const google_protobuf_FieldOptions* msg, size_t* size) { |
Sandy Zhang | 96c601d | 2023-07-05 12:39:20 -0700 | [diff] [blame] | 8328 | const upb_MiniTableField field = {20, UPB_SIZE(28, 32), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8329 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 8330 | if (size) { |
| 8331 | *size = arr ? arr->size : 0; |
| 8332 | } |
| 8333 | return arr; |
| 8334 | } |
| 8335 | UPB_INLINE upb_Array* _google_protobuf_FieldOptions_edition_defaults_mutable_upb_array(const google_protobuf_FieldOptions* msg, size_t* size, upb_Arena* arena) { |
Sandy Zhang | 96c601d | 2023-07-05 12:39:20 -0700 | [diff] [blame] | 8336 | const upb_MiniTableField field = {20, UPB_SIZE(28, 32), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8337 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 8338 | (upb_Message*)msg, &field, arena); |
| 8339 | if (size) { |
| 8340 | *size = arr ? arr->size : 0; |
| 8341 | } |
| 8342 | return arr; |
| 8343 | } |
| 8344 | UPB_INLINE bool google_protobuf_FieldOptions_has_edition_defaults(const google_protobuf_FieldOptions* msg) { |
| 8345 | size_t size; |
| 8346 | google_protobuf_FieldOptions_edition_defaults(msg, &size); |
| 8347 | return size != 0; |
| 8348 | } |
| 8349 | UPB_INLINE void google_protobuf_FieldOptions_clear_features(google_protobuf_FieldOptions* msg) { |
Sandy Zhang | 96c601d | 2023-07-05 12:39:20 -0700 | [diff] [blame] | 8350 | const upb_MiniTableField field = {21, UPB_SIZE(32, 40), 10, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8351 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 8352 | } |
| 8353 | UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_FieldOptions_features(const google_protobuf_FieldOptions* msg) { |
| 8354 | const google_protobuf_FeatureSet* default_val = NULL; |
| 8355 | const google_protobuf_FeatureSet* ret; |
Sandy Zhang | 96c601d | 2023-07-05 12:39:20 -0700 | [diff] [blame] | 8356 | const upb_MiniTableField field = {21, UPB_SIZE(32, 40), 10, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8357 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 8358 | return ret; |
| 8359 | } |
| 8360 | UPB_INLINE bool google_protobuf_FieldOptions_has_features(const google_protobuf_FieldOptions* msg) { |
Sandy Zhang | 96c601d | 2023-07-05 12:39:20 -0700 | [diff] [blame] | 8361 | const upb_MiniTableField field = {21, UPB_SIZE(32, 40), 10, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8362 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 8363 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8364 | UPB_INLINE void google_protobuf_FieldOptions_clear_uninterpreted_option(google_protobuf_FieldOptions* msg) { |
Sandy Zhang | 96c601d | 2023-07-05 12:39:20 -0700 | [diff] [blame] | 8365 | const upb_MiniTableField field = {999, UPB_SIZE(36, 48), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 8366 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8367 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 8368 | UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_FieldOptions_uninterpreted_option(const google_protobuf_FieldOptions* msg, size_t* size) { |
Sandy Zhang | 96c601d | 2023-07-05 12:39:20 -0700 | [diff] [blame] | 8369 | const upb_MiniTableField field = {999, UPB_SIZE(36, 48), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 8370 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 8371 | if (arr) { |
| 8372 | if (size) *size = arr->size; |
| 8373 | return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr); |
| 8374 | } else { |
| 8375 | if (size) *size = 0; |
| 8376 | return NULL; |
| 8377 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8378 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 8379 | UPB_INLINE const upb_Array* _google_protobuf_FieldOptions_uninterpreted_option_upb_array(const google_protobuf_FieldOptions* msg, size_t* size) { |
Sandy Zhang | 96c601d | 2023-07-05 12:39:20 -0700 | [diff] [blame] | 8380 | const upb_MiniTableField field = {999, UPB_SIZE(36, 48), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 8381 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 8382 | if (size) { |
| 8383 | *size = arr ? arr->size : 0; |
| 8384 | } |
| 8385 | return arr; |
| 8386 | } |
| 8387 | UPB_INLINE upb_Array* _google_protobuf_FieldOptions_uninterpreted_option_mutable_upb_array(const google_protobuf_FieldOptions* msg, size_t* size, upb_Arena* arena) { |
Sandy Zhang | 96c601d | 2023-07-05 12:39:20 -0700 | [diff] [blame] | 8388 | const upb_MiniTableField field = {999, UPB_SIZE(36, 48), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 8389 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 8390 | (upb_Message*)msg, &field, arena); |
| 8391 | if (size) { |
| 8392 | *size = arr ? arr->size : 0; |
| 8393 | } |
| 8394 | return arr; |
| 8395 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8396 | UPB_INLINE bool google_protobuf_FieldOptions_has_uninterpreted_option(const google_protobuf_FieldOptions* msg) { |
| 8397 | size_t size; |
| 8398 | google_protobuf_FieldOptions_uninterpreted_option(msg, &size); |
| 8399 | return size != 0; |
| 8400 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8401 | |
| 8402 | UPB_INLINE void google_protobuf_FieldOptions_set_ctype(google_protobuf_FieldOptions *msg, int32_t value) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8403 | const upb_MiniTableField field = {1, 4, 1, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 8404 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8405 | } |
| 8406 | UPB_INLINE void google_protobuf_FieldOptions_set_packed(google_protobuf_FieldOptions *msg, bool value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8407 | const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 8408 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8409 | } |
| 8410 | UPB_INLINE void google_protobuf_FieldOptions_set_deprecated(google_protobuf_FieldOptions *msg, bool value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8411 | const upb_MiniTableField field = {3, 9, 3, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 8412 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8413 | } |
| 8414 | UPB_INLINE void google_protobuf_FieldOptions_set_lazy(google_protobuf_FieldOptions *msg, bool value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8415 | const upb_MiniTableField field = {5, 10, 4, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 8416 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8417 | } |
| 8418 | UPB_INLINE void google_protobuf_FieldOptions_set_jstype(google_protobuf_FieldOptions *msg, int32_t value) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8419 | const upb_MiniTableField field = {6, 12, 5, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 8420 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8421 | } |
| 8422 | UPB_INLINE void google_protobuf_FieldOptions_set_weak(google_protobuf_FieldOptions *msg, bool value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8423 | const upb_MiniTableField field = {10, 16, 6, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 8424 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8425 | } |
| 8426 | UPB_INLINE void google_protobuf_FieldOptions_set_unverified_lazy(google_protobuf_FieldOptions *msg, bool value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8427 | const upb_MiniTableField field = {15, 17, 7, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 8428 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8429 | } |
| 8430 | UPB_INLINE void google_protobuf_FieldOptions_set_debug_redact(google_protobuf_FieldOptions *msg, bool value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8431 | const upb_MiniTableField field = {16, 18, 8, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Protobuf Team Bot | 9238c48 | 2022-12-16 20:01:55 -0800 | [diff] [blame] | 8432 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8433 | } |
Adam Cozzette | 5a56837 | 2023-01-24 20:35:59 -0800 | [diff] [blame] | 8434 | UPB_INLINE void google_protobuf_FieldOptions_set_retention(google_protobuf_FieldOptions *msg, int32_t value) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8435 | const upb_MiniTableField field = {17, 20, 9, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Adam Cozzette | 5a56837 | 2023-01-24 20:35:59 -0800 | [diff] [blame] | 8436 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 8437 | } |
Mike Kruskal | 0c12139 | 2023-03-18 00:05:41 -0700 | [diff] [blame] | 8438 | UPB_INLINE int32_t* google_protobuf_FieldOptions_mutable_targets(google_protobuf_FieldOptions* msg, size_t* size) { |
Sandy Zhang | 96c601d | 2023-07-05 12:39:20 -0700 | [diff] [blame] | 8439 | upb_MiniTableField field = {19, 24, 0, 6, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 0c12139 | 2023-03-18 00:05:41 -0700 | [diff] [blame] | 8440 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 8441 | if (arr) { |
| 8442 | if (size) *size = arr->size; |
| 8443 | return (int32_t*)_upb_array_ptr(arr); |
| 8444 | } else { |
| 8445 | if (size) *size = 0; |
| 8446 | return NULL; |
| 8447 | } |
| 8448 | } |
| 8449 | UPB_INLINE int32_t* google_protobuf_FieldOptions_resize_targets(google_protobuf_FieldOptions* msg, size_t size, upb_Arena* arena) { |
Sandy Zhang | 96c601d | 2023-07-05 12:39:20 -0700 | [diff] [blame] | 8450 | upb_MiniTableField field = {19, 24, 0, 6, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Jie Luo | f36a5c6 | 2023-05-23 17:56:18 -0700 | [diff] [blame] | 8451 | return (int32_t*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Mike Kruskal | 0c12139 | 2023-03-18 00:05:41 -0700 | [diff] [blame] | 8452 | } |
| 8453 | UPB_INLINE bool google_protobuf_FieldOptions_add_targets(google_protobuf_FieldOptions* msg, int32_t val, upb_Arena* arena) { |
Sandy Zhang | 96c601d | 2023-07-05 12:39:20 -0700 | [diff] [blame] | 8454 | upb_MiniTableField field = {19, 24, 0, 6, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 0c12139 | 2023-03-18 00:05:41 -0700 | [diff] [blame] | 8455 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 8456 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 8457 | return false; |
| 8458 | } |
| 8459 | _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val)); |
| 8460 | return true; |
Adam Cozzette | 5a56837 | 2023-01-24 20:35:59 -0800 | [diff] [blame] | 8461 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8462 | UPB_INLINE google_protobuf_FieldOptions_EditionDefault** google_protobuf_FieldOptions_mutable_edition_defaults(google_protobuf_FieldOptions* msg, size_t* size) { |
Sandy Zhang | 96c601d | 2023-07-05 12:39:20 -0700 | [diff] [blame] | 8463 | upb_MiniTableField field = {20, UPB_SIZE(28, 32), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8464 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 8465 | if (arr) { |
| 8466 | if (size) *size = arr->size; |
| 8467 | return (google_protobuf_FieldOptions_EditionDefault**)_upb_array_ptr(arr); |
| 8468 | } else { |
| 8469 | if (size) *size = 0; |
| 8470 | return NULL; |
| 8471 | } |
| 8472 | } |
| 8473 | UPB_INLINE google_protobuf_FieldOptions_EditionDefault** google_protobuf_FieldOptions_resize_edition_defaults(google_protobuf_FieldOptions* msg, size_t size, upb_Arena* arena) { |
Sandy Zhang | 96c601d | 2023-07-05 12:39:20 -0700 | [diff] [blame] | 8474 | upb_MiniTableField field = {20, UPB_SIZE(28, 32), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8475 | return (google_protobuf_FieldOptions_EditionDefault**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
| 8476 | } |
| 8477 | UPB_INLINE struct google_protobuf_FieldOptions_EditionDefault* google_protobuf_FieldOptions_add_edition_defaults(google_protobuf_FieldOptions* msg, upb_Arena* arena) { |
Sandy Zhang | 96c601d | 2023-07-05 12:39:20 -0700 | [diff] [blame] | 8478 | upb_MiniTableField field = {20, UPB_SIZE(28, 32), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8479 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 8480 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 8481 | return NULL; |
| 8482 | } |
| 8483 | struct google_protobuf_FieldOptions_EditionDefault* sub = (struct google_protobuf_FieldOptions_EditionDefault*)_upb_Message_New(&google_protobuf_FieldOptions_EditionDefault_msg_init, arena); |
| 8484 | if (!arr || !sub) return NULL; |
| 8485 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
| 8486 | return sub; |
| 8487 | } |
| 8488 | UPB_INLINE void google_protobuf_FieldOptions_set_features(google_protobuf_FieldOptions *msg, google_protobuf_FeatureSet* value) { |
Sandy Zhang | 96c601d | 2023-07-05 12:39:20 -0700 | [diff] [blame] | 8489 | const upb_MiniTableField field = {21, UPB_SIZE(32, 40), 10, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8490 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 8491 | } |
| 8492 | UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_FieldOptions_mutable_features(google_protobuf_FieldOptions* msg, upb_Arena* arena) { |
| 8493 | struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_FieldOptions_features(msg); |
| 8494 | if (sub == NULL) { |
| 8495 | sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google_protobuf_FeatureSet_msg_init, arena); |
| 8496 | if (sub) google_protobuf_FieldOptions_set_features(msg, sub); |
| 8497 | } |
| 8498 | return sub; |
| 8499 | } |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8500 | UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FieldOptions_mutable_uninterpreted_option(google_protobuf_FieldOptions* msg, size_t* size) { |
Sandy Zhang | 96c601d | 2023-07-05 12:39:20 -0700 | [diff] [blame] | 8501 | upb_MiniTableField field = {999, UPB_SIZE(36, 48), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 8502 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 8503 | if (arr) { |
| 8504 | if (size) *size = arr->size; |
| 8505 | return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr); |
| 8506 | } else { |
| 8507 | if (size) *size = 0; |
| 8508 | return NULL; |
| 8509 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8510 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 8511 | UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FieldOptions_resize_uninterpreted_option(google_protobuf_FieldOptions* msg, size_t size, upb_Arena* arena) { |
Sandy Zhang | 96c601d | 2023-07-05 12:39:20 -0700 | [diff] [blame] | 8512 | upb_MiniTableField field = {999, UPB_SIZE(36, 48), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Jie Luo | f36a5c6 | 2023-05-23 17:56:18 -0700 | [diff] [blame] | 8513 | return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8514 | } |
| 8515 | UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_FieldOptions_add_uninterpreted_option(google_protobuf_FieldOptions* msg, upb_Arena* arena) { |
Sandy Zhang | 96c601d | 2023-07-05 12:39:20 -0700 | [diff] [blame] | 8516 | upb_MiniTableField field = {999, UPB_SIZE(36, 48), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 8517 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 8518 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 8519 | return NULL; |
| 8520 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8521 | struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)_upb_Message_New(&google_protobuf_UninterpretedOption_msg_init, arena); |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 8522 | if (!arr || !sub) return NULL; |
| 8523 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8524 | return sub; |
| 8525 | } |
| 8526 | |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8527 | /* google.protobuf.FieldOptions.EditionDefault */ |
| 8528 | |
| 8529 | UPB_INLINE google_protobuf_FieldOptions_EditionDefault* google_protobuf_FieldOptions_EditionDefault_new(upb_Arena* arena) { |
| 8530 | return (google_protobuf_FieldOptions_EditionDefault*)_upb_Message_New(&google_protobuf_FieldOptions_EditionDefault_msg_init, arena); |
| 8531 | } |
| 8532 | UPB_INLINE google_protobuf_FieldOptions_EditionDefault* google_protobuf_FieldOptions_EditionDefault_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 8533 | google_protobuf_FieldOptions_EditionDefault* ret = google_protobuf_FieldOptions_EditionDefault_new(arena); |
| 8534 | if (!ret) return NULL; |
| 8535 | if (upb_Decode(buf, size, ret, &google_protobuf_FieldOptions_EditionDefault_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { |
| 8536 | return NULL; |
| 8537 | } |
| 8538 | return ret; |
| 8539 | } |
| 8540 | UPB_INLINE google_protobuf_FieldOptions_EditionDefault* google_protobuf_FieldOptions_EditionDefault_parse_ex(const char* buf, size_t size, |
| 8541 | const upb_ExtensionRegistry* extreg, |
| 8542 | int options, upb_Arena* arena) { |
| 8543 | google_protobuf_FieldOptions_EditionDefault* ret = google_protobuf_FieldOptions_EditionDefault_new(arena); |
| 8544 | if (!ret) return NULL; |
| 8545 | if (upb_Decode(buf, size, ret, &google_protobuf_FieldOptions_EditionDefault_msg_init, extreg, options, arena) != |
| 8546 | kUpb_DecodeStatus_Ok) { |
| 8547 | return NULL; |
| 8548 | } |
| 8549 | return ret; |
| 8550 | } |
| 8551 | UPB_INLINE char* google_protobuf_FieldOptions_EditionDefault_serialize(const google_protobuf_FieldOptions_EditionDefault* msg, upb_Arena* arena, size_t* len) { |
| 8552 | char* ptr; |
| 8553 | (void)upb_Encode(msg, &google_protobuf_FieldOptions_EditionDefault_msg_init, 0, arena, &ptr, len); |
| 8554 | return ptr; |
| 8555 | } |
| 8556 | UPB_INLINE char* google_protobuf_FieldOptions_EditionDefault_serialize_ex(const google_protobuf_FieldOptions_EditionDefault* msg, int options, |
| 8557 | upb_Arena* arena, size_t* len) { |
| 8558 | char* ptr; |
| 8559 | (void)upb_Encode(msg, &google_protobuf_FieldOptions_EditionDefault_msg_init, options, arena, &ptr, len); |
| 8560 | return ptr; |
| 8561 | } |
| 8562 | UPB_INLINE void google_protobuf_FieldOptions_EditionDefault_clear_edition(google_protobuf_FieldOptions_EditionDefault* msg) { |
Protobuf Team Bot | fa98bb3 | 2023-09-01 18:11:09 +0000 | [diff] [blame] | 8563 | const upb_MiniTableField field = {1, 8, 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8564 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 8565 | } |
| 8566 | UPB_INLINE upb_StringView google_protobuf_FieldOptions_EditionDefault_edition(const google_protobuf_FieldOptions_EditionDefault* msg) { |
| 8567 | upb_StringView default_val = upb_StringView_FromString(""); |
| 8568 | upb_StringView ret; |
Protobuf Team Bot | fa98bb3 | 2023-09-01 18:11:09 +0000 | [diff] [blame] | 8569 | const upb_MiniTableField field = {1, 8, 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8570 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 8571 | return ret; |
| 8572 | } |
| 8573 | UPB_INLINE bool google_protobuf_FieldOptions_EditionDefault_has_edition(const google_protobuf_FieldOptions_EditionDefault* msg) { |
Protobuf Team Bot | fa98bb3 | 2023-09-01 18:11:09 +0000 | [diff] [blame] | 8574 | const upb_MiniTableField field = {1, 8, 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8575 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 8576 | } |
| 8577 | UPB_INLINE void google_protobuf_FieldOptions_EditionDefault_clear_value(google_protobuf_FieldOptions_EditionDefault* msg) { |
Protobuf Team Bot | fa98bb3 | 2023-09-01 18:11:09 +0000 | [diff] [blame] | 8578 | const upb_MiniTableField field = {2, UPB_SIZE(16, 24), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8579 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 8580 | } |
| 8581 | UPB_INLINE upb_StringView google_protobuf_FieldOptions_EditionDefault_value(const google_protobuf_FieldOptions_EditionDefault* msg) { |
| 8582 | upb_StringView default_val = upb_StringView_FromString(""); |
| 8583 | upb_StringView ret; |
Protobuf Team Bot | fa98bb3 | 2023-09-01 18:11:09 +0000 | [diff] [blame] | 8584 | const upb_MiniTableField field = {2, UPB_SIZE(16, 24), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8585 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 8586 | return ret; |
| 8587 | } |
| 8588 | UPB_INLINE bool google_protobuf_FieldOptions_EditionDefault_has_value(const google_protobuf_FieldOptions_EditionDefault* msg) { |
Protobuf Team Bot | fa98bb3 | 2023-09-01 18:11:09 +0000 | [diff] [blame] | 8589 | const upb_MiniTableField field = {2, UPB_SIZE(16, 24), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
| 8590 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 8591 | } |
| 8592 | UPB_INLINE void google_protobuf_FieldOptions_EditionDefault_clear_edition_enum(google_protobuf_FieldOptions_EditionDefault* msg) { |
| 8593 | const upb_MiniTableField field = {3, 4, 3, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
| 8594 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 8595 | } |
| 8596 | UPB_INLINE int32_t google_protobuf_FieldOptions_EditionDefault_edition_enum(const google_protobuf_FieldOptions_EditionDefault* msg) { |
| 8597 | int32_t default_val = 0; |
| 8598 | int32_t ret; |
| 8599 | const upb_MiniTableField field = {3, 4, 3, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
| 8600 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 8601 | return ret; |
| 8602 | } |
| 8603 | UPB_INLINE bool google_protobuf_FieldOptions_EditionDefault_has_edition_enum(const google_protobuf_FieldOptions_EditionDefault* msg) { |
| 8604 | const upb_MiniTableField field = {3, 4, 3, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8605 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 8606 | } |
| 8607 | |
| 8608 | UPB_INLINE void google_protobuf_FieldOptions_EditionDefault_set_edition(google_protobuf_FieldOptions_EditionDefault *msg, upb_StringView value) { |
Protobuf Team Bot | fa98bb3 | 2023-09-01 18:11:09 +0000 | [diff] [blame] | 8609 | const upb_MiniTableField field = {1, 8, 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8610 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 8611 | } |
| 8612 | UPB_INLINE void google_protobuf_FieldOptions_EditionDefault_set_value(google_protobuf_FieldOptions_EditionDefault *msg, upb_StringView value) { |
Protobuf Team Bot | fa98bb3 | 2023-09-01 18:11:09 +0000 | [diff] [blame] | 8613 | const upb_MiniTableField field = {2, UPB_SIZE(16, 24), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
| 8614 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 8615 | } |
| 8616 | UPB_INLINE void google_protobuf_FieldOptions_EditionDefault_set_edition_enum(google_protobuf_FieldOptions_EditionDefault *msg, int32_t value) { |
| 8617 | const upb_MiniTableField field = {3, 4, 3, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8618 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 8619 | } |
| 8620 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8621 | /* google.protobuf.OneofOptions */ |
| 8622 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8623 | UPB_INLINE google_protobuf_OneofOptions* google_protobuf_OneofOptions_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8624 | return (google_protobuf_OneofOptions*)_upb_Message_New(&google_protobuf_OneofOptions_msg_init, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8625 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8626 | UPB_INLINE google_protobuf_OneofOptions* google_protobuf_OneofOptions_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 8627 | google_protobuf_OneofOptions* ret = google_protobuf_OneofOptions_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 8628 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8629 | if (upb_Decode(buf, size, ret, &google_protobuf_OneofOptions_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 8630 | return NULL; |
| 8631 | } |
| 8632 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8633 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8634 | UPB_INLINE google_protobuf_OneofOptions* google_protobuf_OneofOptions_parse_ex(const char* buf, size_t size, |
| 8635 | const upb_ExtensionRegistry* extreg, |
| 8636 | int options, upb_Arena* arena) { |
| 8637 | google_protobuf_OneofOptions* ret = google_protobuf_OneofOptions_new(arena); |
| 8638 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8639 | if (upb_Decode(buf, size, ret, &google_protobuf_OneofOptions_msg_init, extreg, options, arena) != |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8640 | kUpb_DecodeStatus_Ok) { |
| 8641 | return NULL; |
| 8642 | } |
| 8643 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8644 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8645 | UPB_INLINE char* google_protobuf_OneofOptions_serialize(const google_protobuf_OneofOptions* msg, upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8646 | char* ptr; |
| 8647 | (void)upb_Encode(msg, &google_protobuf_OneofOptions_msg_init, 0, arena, &ptr, len); |
| 8648 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8649 | } |
| 8650 | UPB_INLINE char* google_protobuf_OneofOptions_serialize_ex(const google_protobuf_OneofOptions* msg, int options, |
| 8651 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8652 | char* ptr; |
| 8653 | (void)upb_Encode(msg, &google_protobuf_OneofOptions_msg_init, options, arena, &ptr, len); |
| 8654 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8655 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8656 | UPB_INLINE void google_protobuf_OneofOptions_clear_features(google_protobuf_OneofOptions* msg) { |
| 8657 | const upb_MiniTableField field = {1, UPB_SIZE(4, 8), 1, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
| 8658 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 8659 | } |
| 8660 | UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_OneofOptions_features(const google_protobuf_OneofOptions* msg) { |
| 8661 | const google_protobuf_FeatureSet* default_val = NULL; |
| 8662 | const google_protobuf_FeatureSet* ret; |
| 8663 | const upb_MiniTableField field = {1, UPB_SIZE(4, 8), 1, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
| 8664 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 8665 | return ret; |
| 8666 | } |
| 8667 | UPB_INLINE bool google_protobuf_OneofOptions_has_features(const google_protobuf_OneofOptions* msg) { |
| 8668 | const upb_MiniTableField field = {1, UPB_SIZE(4, 8), 1, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
| 8669 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 8670 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8671 | UPB_INLINE void google_protobuf_OneofOptions_clear_uninterpreted_option(google_protobuf_OneofOptions* msg) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8672 | const upb_MiniTableField field = {999, UPB_SIZE(8, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 8673 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8674 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 8675 | UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_OneofOptions_uninterpreted_option(const google_protobuf_OneofOptions* msg, size_t* size) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8676 | const upb_MiniTableField field = {999, UPB_SIZE(8, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 8677 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 8678 | if (arr) { |
| 8679 | if (size) *size = arr->size; |
| 8680 | return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr); |
| 8681 | } else { |
| 8682 | if (size) *size = 0; |
| 8683 | return NULL; |
| 8684 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8685 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 8686 | UPB_INLINE const upb_Array* _google_protobuf_OneofOptions_uninterpreted_option_upb_array(const google_protobuf_OneofOptions* msg, size_t* size) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8687 | const upb_MiniTableField field = {999, UPB_SIZE(8, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 8688 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 8689 | if (size) { |
| 8690 | *size = arr ? arr->size : 0; |
| 8691 | } |
| 8692 | return arr; |
| 8693 | } |
| 8694 | UPB_INLINE upb_Array* _google_protobuf_OneofOptions_uninterpreted_option_mutable_upb_array(const google_protobuf_OneofOptions* msg, size_t* size, upb_Arena* arena) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8695 | const upb_MiniTableField field = {999, UPB_SIZE(8, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 8696 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 8697 | (upb_Message*)msg, &field, arena); |
| 8698 | if (size) { |
| 8699 | *size = arr ? arr->size : 0; |
| 8700 | } |
| 8701 | return arr; |
| 8702 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8703 | UPB_INLINE bool google_protobuf_OneofOptions_has_uninterpreted_option(const google_protobuf_OneofOptions* msg) { |
| 8704 | size_t size; |
| 8705 | google_protobuf_OneofOptions_uninterpreted_option(msg, &size); |
| 8706 | return size != 0; |
| 8707 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8708 | |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8709 | UPB_INLINE void google_protobuf_OneofOptions_set_features(google_protobuf_OneofOptions *msg, google_protobuf_FeatureSet* value) { |
| 8710 | const upb_MiniTableField field = {1, UPB_SIZE(4, 8), 1, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
| 8711 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 8712 | } |
| 8713 | UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_OneofOptions_mutable_features(google_protobuf_OneofOptions* msg, upb_Arena* arena) { |
| 8714 | struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_OneofOptions_features(msg); |
| 8715 | if (sub == NULL) { |
| 8716 | sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google_protobuf_FeatureSet_msg_init, arena); |
| 8717 | if (sub) google_protobuf_OneofOptions_set_features(msg, sub); |
| 8718 | } |
| 8719 | return sub; |
| 8720 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 8721 | UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_OneofOptions_mutable_uninterpreted_option(google_protobuf_OneofOptions* msg, size_t* size) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8722 | upb_MiniTableField field = {999, UPB_SIZE(8, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 8723 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 8724 | if (arr) { |
| 8725 | if (size) *size = arr->size; |
| 8726 | return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr); |
| 8727 | } else { |
| 8728 | if (size) *size = 0; |
| 8729 | return NULL; |
| 8730 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8731 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 8732 | UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_OneofOptions_resize_uninterpreted_option(google_protobuf_OneofOptions* msg, size_t size, upb_Arena* arena) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8733 | upb_MiniTableField field = {999, UPB_SIZE(8, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Jie Luo | f36a5c6 | 2023-05-23 17:56:18 -0700 | [diff] [blame] | 8734 | return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8735 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8736 | UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_OneofOptions_add_uninterpreted_option(google_protobuf_OneofOptions* msg, upb_Arena* arena) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8737 | upb_MiniTableField field = {999, UPB_SIZE(8, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 8738 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 8739 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 8740 | return NULL; |
| 8741 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8742 | struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)_upb_Message_New(&google_protobuf_UninterpretedOption_msg_init, arena); |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 8743 | if (!arr || !sub) return NULL; |
| 8744 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8745 | return sub; |
| 8746 | } |
| 8747 | |
| 8748 | /* google.protobuf.EnumOptions */ |
| 8749 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8750 | UPB_INLINE google_protobuf_EnumOptions* google_protobuf_EnumOptions_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8751 | return (google_protobuf_EnumOptions*)_upb_Message_New(&google_protobuf_EnumOptions_msg_init, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8752 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8753 | UPB_INLINE google_protobuf_EnumOptions* google_protobuf_EnumOptions_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 8754 | google_protobuf_EnumOptions* ret = google_protobuf_EnumOptions_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 8755 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8756 | if (upb_Decode(buf, size, ret, &google_protobuf_EnumOptions_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 8757 | return NULL; |
| 8758 | } |
| 8759 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8760 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8761 | UPB_INLINE google_protobuf_EnumOptions* google_protobuf_EnumOptions_parse_ex(const char* buf, size_t size, |
| 8762 | const upb_ExtensionRegistry* extreg, |
| 8763 | int options, upb_Arena* arena) { |
| 8764 | google_protobuf_EnumOptions* ret = google_protobuf_EnumOptions_new(arena); |
| 8765 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8766 | if (upb_Decode(buf, size, ret, &google_protobuf_EnumOptions_msg_init, extreg, options, arena) != |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8767 | kUpb_DecodeStatus_Ok) { |
| 8768 | return NULL; |
| 8769 | } |
| 8770 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8771 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8772 | UPB_INLINE char* google_protobuf_EnumOptions_serialize(const google_protobuf_EnumOptions* msg, upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8773 | char* ptr; |
| 8774 | (void)upb_Encode(msg, &google_protobuf_EnumOptions_msg_init, 0, arena, &ptr, len); |
| 8775 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8776 | } |
| 8777 | UPB_INLINE char* google_protobuf_EnumOptions_serialize_ex(const google_protobuf_EnumOptions* msg, int options, |
| 8778 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8779 | char* ptr; |
| 8780 | (void)upb_Encode(msg, &google_protobuf_EnumOptions_msg_init, options, arena, &ptr, len); |
| 8781 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8782 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8783 | UPB_INLINE void google_protobuf_EnumOptions_clear_allow_alias(google_protobuf_EnumOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8784 | const upb_MiniTableField field = {2, 1, 1, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 8785 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8786 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8787 | UPB_INLINE bool google_protobuf_EnumOptions_allow_alias(const google_protobuf_EnumOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8788 | bool default_val = false; |
| 8789 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8790 | const upb_MiniTableField field = {2, 1, 1, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 8791 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8792 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8793 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8794 | UPB_INLINE bool google_protobuf_EnumOptions_has_allow_alias(const google_protobuf_EnumOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8795 | const upb_MiniTableField field = {2, 1, 1, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 8796 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8797 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8798 | UPB_INLINE void google_protobuf_EnumOptions_clear_deprecated(google_protobuf_EnumOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8799 | const upb_MiniTableField field = {3, 2, 2, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 8800 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8801 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8802 | UPB_INLINE bool google_protobuf_EnumOptions_deprecated(const google_protobuf_EnumOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8803 | bool default_val = false; |
| 8804 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8805 | const upb_MiniTableField field = {3, 2, 2, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 8806 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8807 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8808 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8809 | UPB_INLINE bool google_protobuf_EnumOptions_has_deprecated(const google_protobuf_EnumOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8810 | const upb_MiniTableField field = {3, 2, 2, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 8811 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8812 | } |
Mike Kruskal | 6b87d6f | 2022-12-14 10:36:53 -0800 | [diff] [blame] | 8813 | UPB_INLINE void google_protobuf_EnumOptions_clear_deprecated_legacy_json_field_conflicts(google_protobuf_EnumOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8814 | const upb_MiniTableField field = {6, 3, 3, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 6b87d6f | 2022-12-14 10:36:53 -0800 | [diff] [blame] | 8815 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 8816 | } |
| 8817 | UPB_INLINE bool google_protobuf_EnumOptions_deprecated_legacy_json_field_conflicts(const google_protobuf_EnumOptions* msg) { |
| 8818 | bool default_val = false; |
| 8819 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8820 | const upb_MiniTableField field = {6, 3, 3, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 6b87d6f | 2022-12-14 10:36:53 -0800 | [diff] [blame] | 8821 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 8822 | return ret; |
| 8823 | } |
| 8824 | UPB_INLINE bool google_protobuf_EnumOptions_has_deprecated_legacy_json_field_conflicts(const google_protobuf_EnumOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8825 | const upb_MiniTableField field = {6, 3, 3, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 6b87d6f | 2022-12-14 10:36:53 -0800 | [diff] [blame] | 8826 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 8827 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8828 | UPB_INLINE void google_protobuf_EnumOptions_clear_features(google_protobuf_EnumOptions* msg) { |
| 8829 | const upb_MiniTableField field = {7, UPB_SIZE(4, 8), 4, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
| 8830 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 8831 | } |
| 8832 | UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_EnumOptions_features(const google_protobuf_EnumOptions* msg) { |
| 8833 | const google_protobuf_FeatureSet* default_val = NULL; |
| 8834 | const google_protobuf_FeatureSet* ret; |
| 8835 | const upb_MiniTableField field = {7, UPB_SIZE(4, 8), 4, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
| 8836 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 8837 | return ret; |
| 8838 | } |
| 8839 | UPB_INLINE bool google_protobuf_EnumOptions_has_features(const google_protobuf_EnumOptions* msg) { |
| 8840 | const upb_MiniTableField field = {7, UPB_SIZE(4, 8), 4, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
| 8841 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 8842 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8843 | UPB_INLINE void google_protobuf_EnumOptions_clear_uninterpreted_option(google_protobuf_EnumOptions* msg) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8844 | const upb_MiniTableField field = {999, UPB_SIZE(8, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 8845 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8846 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 8847 | UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_EnumOptions_uninterpreted_option(const google_protobuf_EnumOptions* msg, size_t* size) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8848 | const upb_MiniTableField field = {999, UPB_SIZE(8, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 8849 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 8850 | if (arr) { |
| 8851 | if (size) *size = arr->size; |
| 8852 | return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr); |
| 8853 | } else { |
| 8854 | if (size) *size = 0; |
| 8855 | return NULL; |
| 8856 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8857 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 8858 | UPB_INLINE const upb_Array* _google_protobuf_EnumOptions_uninterpreted_option_upb_array(const google_protobuf_EnumOptions* msg, size_t* size) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8859 | const upb_MiniTableField field = {999, UPB_SIZE(8, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 8860 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 8861 | if (size) { |
| 8862 | *size = arr ? arr->size : 0; |
| 8863 | } |
| 8864 | return arr; |
| 8865 | } |
| 8866 | UPB_INLINE upb_Array* _google_protobuf_EnumOptions_uninterpreted_option_mutable_upb_array(const google_protobuf_EnumOptions* msg, size_t* size, upb_Arena* arena) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8867 | const upb_MiniTableField field = {999, UPB_SIZE(8, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 8868 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 8869 | (upb_Message*)msg, &field, arena); |
| 8870 | if (size) { |
| 8871 | *size = arr ? arr->size : 0; |
| 8872 | } |
| 8873 | return arr; |
| 8874 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8875 | UPB_INLINE bool google_protobuf_EnumOptions_has_uninterpreted_option(const google_protobuf_EnumOptions* msg) { |
| 8876 | size_t size; |
| 8877 | google_protobuf_EnumOptions_uninterpreted_option(msg, &size); |
| 8878 | return size != 0; |
| 8879 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8880 | |
| 8881 | UPB_INLINE void google_protobuf_EnumOptions_set_allow_alias(google_protobuf_EnumOptions *msg, bool value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8882 | const upb_MiniTableField field = {2, 1, 1, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 8883 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8884 | } |
| 8885 | UPB_INLINE void google_protobuf_EnumOptions_set_deprecated(google_protobuf_EnumOptions *msg, bool value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8886 | const upb_MiniTableField field = {3, 2, 2, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 8887 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8888 | } |
| 8889 | UPB_INLINE void google_protobuf_EnumOptions_set_deprecated_legacy_json_field_conflicts(google_protobuf_EnumOptions *msg, bool value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8890 | const upb_MiniTableField field = {6, 3, 3, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 6b87d6f | 2022-12-14 10:36:53 -0800 | [diff] [blame] | 8891 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8892 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8893 | UPB_INLINE void google_protobuf_EnumOptions_set_features(google_protobuf_EnumOptions *msg, google_protobuf_FeatureSet* value) { |
| 8894 | const upb_MiniTableField field = {7, UPB_SIZE(4, 8), 4, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
| 8895 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 8896 | } |
| 8897 | UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_EnumOptions_mutable_features(google_protobuf_EnumOptions* msg, upb_Arena* arena) { |
| 8898 | struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_EnumOptions_features(msg); |
| 8899 | if (sub == NULL) { |
| 8900 | sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google_protobuf_FeatureSet_msg_init, arena); |
| 8901 | if (sub) google_protobuf_EnumOptions_set_features(msg, sub); |
| 8902 | } |
| 8903 | return sub; |
| 8904 | } |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8905 | UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_EnumOptions_mutable_uninterpreted_option(google_protobuf_EnumOptions* msg, size_t* size) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8906 | upb_MiniTableField field = {999, UPB_SIZE(8, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 8907 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 8908 | if (arr) { |
| 8909 | if (size) *size = arr->size; |
| 8910 | return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr); |
| 8911 | } else { |
| 8912 | if (size) *size = 0; |
| 8913 | return NULL; |
| 8914 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8915 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 8916 | UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_EnumOptions_resize_uninterpreted_option(google_protobuf_EnumOptions* msg, size_t size, upb_Arena* arena) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8917 | upb_MiniTableField field = {999, UPB_SIZE(8, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Jie Luo | f36a5c6 | 2023-05-23 17:56:18 -0700 | [diff] [blame] | 8918 | return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8919 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8920 | UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_EnumOptions_add_uninterpreted_option(google_protobuf_EnumOptions* msg, upb_Arena* arena) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8921 | upb_MiniTableField field = {999, UPB_SIZE(8, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 8922 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 8923 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 8924 | return NULL; |
| 8925 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8926 | struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)_upb_Message_New(&google_protobuf_UninterpretedOption_msg_init, arena); |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 8927 | if (!arr || !sub) return NULL; |
| 8928 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8929 | return sub; |
| 8930 | } |
| 8931 | |
| 8932 | /* google.protobuf.EnumValueOptions */ |
| 8933 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8934 | UPB_INLINE google_protobuf_EnumValueOptions* google_protobuf_EnumValueOptions_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8935 | return (google_protobuf_EnumValueOptions*)_upb_Message_New(&google_protobuf_EnumValueOptions_msg_init, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8936 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8937 | UPB_INLINE google_protobuf_EnumValueOptions* google_protobuf_EnumValueOptions_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 8938 | google_protobuf_EnumValueOptions* ret = google_protobuf_EnumValueOptions_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 8939 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8940 | if (upb_Decode(buf, size, ret, &google_protobuf_EnumValueOptions_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 8941 | return NULL; |
| 8942 | } |
| 8943 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8944 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8945 | UPB_INLINE google_protobuf_EnumValueOptions* google_protobuf_EnumValueOptions_parse_ex(const char* buf, size_t size, |
| 8946 | const upb_ExtensionRegistry* extreg, |
| 8947 | int options, upb_Arena* arena) { |
| 8948 | google_protobuf_EnumValueOptions* ret = google_protobuf_EnumValueOptions_new(arena); |
| 8949 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8950 | if (upb_Decode(buf, size, ret, &google_protobuf_EnumValueOptions_msg_init, extreg, options, arena) != |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8951 | kUpb_DecodeStatus_Ok) { |
| 8952 | return NULL; |
| 8953 | } |
| 8954 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8955 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8956 | UPB_INLINE char* google_protobuf_EnumValueOptions_serialize(const google_protobuf_EnumValueOptions* msg, upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8957 | char* ptr; |
| 8958 | (void)upb_Encode(msg, &google_protobuf_EnumValueOptions_msg_init, 0, arena, &ptr, len); |
| 8959 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8960 | } |
| 8961 | UPB_INLINE char* google_protobuf_EnumValueOptions_serialize_ex(const google_protobuf_EnumValueOptions* msg, int options, |
| 8962 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8963 | char* ptr; |
| 8964 | (void)upb_Encode(msg, &google_protobuf_EnumValueOptions_msg_init, options, arena, &ptr, len); |
| 8965 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8966 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8967 | UPB_INLINE void google_protobuf_EnumValueOptions_clear_deprecated(google_protobuf_EnumValueOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8968 | const upb_MiniTableField field = {1, 1, 1, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 8969 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8970 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8971 | UPB_INLINE bool google_protobuf_EnumValueOptions_deprecated(const google_protobuf_EnumValueOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8972 | bool default_val = false; |
| 8973 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8974 | const upb_MiniTableField field = {1, 1, 1, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 8975 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8976 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8977 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8978 | UPB_INLINE bool google_protobuf_EnumValueOptions_has_deprecated(const google_protobuf_EnumValueOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8979 | const upb_MiniTableField field = {1, 1, 1, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 8980 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8981 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8982 | UPB_INLINE void google_protobuf_EnumValueOptions_clear_features(google_protobuf_EnumValueOptions* msg) { |
| 8983 | const upb_MiniTableField field = {2, UPB_SIZE(4, 8), 2, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
| 8984 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 8985 | } |
| 8986 | UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_EnumValueOptions_features(const google_protobuf_EnumValueOptions* msg) { |
| 8987 | const google_protobuf_FeatureSet* default_val = NULL; |
| 8988 | const google_protobuf_FeatureSet* ret; |
| 8989 | const upb_MiniTableField field = {2, UPB_SIZE(4, 8), 2, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
| 8990 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 8991 | return ret; |
| 8992 | } |
| 8993 | UPB_INLINE bool google_protobuf_EnumValueOptions_has_features(const google_protobuf_EnumValueOptions* msg) { |
| 8994 | const upb_MiniTableField field = {2, UPB_SIZE(4, 8), 2, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
| 8995 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 8996 | } |
Mike Kruskal | 12e0f1d | 2023-05-31 15:40:54 -0700 | [diff] [blame] | 8997 | UPB_INLINE void google_protobuf_EnumValueOptions_clear_debug_redact(google_protobuf_EnumValueOptions* msg) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8998 | const upb_MiniTableField field = {3, UPB_SIZE(8, 2), 3, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 12e0f1d | 2023-05-31 15:40:54 -0700 | [diff] [blame] | 8999 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 9000 | } |
| 9001 | UPB_INLINE bool google_protobuf_EnumValueOptions_debug_redact(const google_protobuf_EnumValueOptions* msg) { |
| 9002 | bool default_val = false; |
| 9003 | bool ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9004 | const upb_MiniTableField field = {3, UPB_SIZE(8, 2), 3, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 12e0f1d | 2023-05-31 15:40:54 -0700 | [diff] [blame] | 9005 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 9006 | return ret; |
| 9007 | } |
| 9008 | UPB_INLINE bool google_protobuf_EnumValueOptions_has_debug_redact(const google_protobuf_EnumValueOptions* msg) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9009 | const upb_MiniTableField field = {3, UPB_SIZE(8, 2), 3, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 12e0f1d | 2023-05-31 15:40:54 -0700 | [diff] [blame] | 9010 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 9011 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9012 | UPB_INLINE void google_protobuf_EnumValueOptions_clear_uninterpreted_option(google_protobuf_EnumValueOptions* msg) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9013 | const upb_MiniTableField field = {999, UPB_SIZE(12, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 9014 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9015 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9016 | UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_EnumValueOptions_uninterpreted_option(const google_protobuf_EnumValueOptions* msg, size_t* size) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9017 | const upb_MiniTableField field = {999, UPB_SIZE(12, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9018 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 9019 | if (arr) { |
| 9020 | if (size) *size = arr->size; |
| 9021 | return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr); |
| 9022 | } else { |
| 9023 | if (size) *size = 0; |
| 9024 | return NULL; |
| 9025 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9026 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 9027 | UPB_INLINE const upb_Array* _google_protobuf_EnumValueOptions_uninterpreted_option_upb_array(const google_protobuf_EnumValueOptions* msg, size_t* size) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9028 | const upb_MiniTableField field = {999, UPB_SIZE(12, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 9029 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 9030 | if (size) { |
| 9031 | *size = arr ? arr->size : 0; |
| 9032 | } |
| 9033 | return arr; |
| 9034 | } |
| 9035 | UPB_INLINE upb_Array* _google_protobuf_EnumValueOptions_uninterpreted_option_mutable_upb_array(const google_protobuf_EnumValueOptions* msg, size_t* size, upb_Arena* arena) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9036 | const upb_MiniTableField field = {999, UPB_SIZE(12, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 9037 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 9038 | (upb_Message*)msg, &field, arena); |
| 9039 | if (size) { |
| 9040 | *size = arr ? arr->size : 0; |
| 9041 | } |
| 9042 | return arr; |
| 9043 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9044 | UPB_INLINE bool google_protobuf_EnumValueOptions_has_uninterpreted_option(const google_protobuf_EnumValueOptions* msg) { |
| 9045 | size_t size; |
| 9046 | google_protobuf_EnumValueOptions_uninterpreted_option(msg, &size); |
| 9047 | return size != 0; |
| 9048 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9049 | |
| 9050 | UPB_INLINE void google_protobuf_EnumValueOptions_set_deprecated(google_protobuf_EnumValueOptions *msg, bool value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9051 | const upb_MiniTableField field = {1, 1, 1, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 9052 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 9053 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9054 | UPB_INLINE void google_protobuf_EnumValueOptions_set_features(google_protobuf_EnumValueOptions *msg, google_protobuf_FeatureSet* value) { |
| 9055 | const upb_MiniTableField field = {2, UPB_SIZE(4, 8), 2, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
| 9056 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 9057 | } |
| 9058 | UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_EnumValueOptions_mutable_features(google_protobuf_EnumValueOptions* msg, upb_Arena* arena) { |
| 9059 | struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_EnumValueOptions_features(msg); |
| 9060 | if (sub == NULL) { |
| 9061 | sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google_protobuf_FeatureSet_msg_init, arena); |
| 9062 | if (sub) google_protobuf_EnumValueOptions_set_features(msg, sub); |
| 9063 | } |
| 9064 | return sub; |
| 9065 | } |
Mike Kruskal | 12e0f1d | 2023-05-31 15:40:54 -0700 | [diff] [blame] | 9066 | UPB_INLINE void google_protobuf_EnumValueOptions_set_debug_redact(google_protobuf_EnumValueOptions *msg, bool value) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9067 | const upb_MiniTableField field = {3, UPB_SIZE(8, 2), 3, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 12e0f1d | 2023-05-31 15:40:54 -0700 | [diff] [blame] | 9068 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 9069 | } |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 9070 | UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_EnumValueOptions_mutable_uninterpreted_option(google_protobuf_EnumValueOptions* msg, size_t* size) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9071 | upb_MiniTableField field = {999, UPB_SIZE(12, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9072 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 9073 | if (arr) { |
| 9074 | if (size) *size = arr->size; |
| 9075 | return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr); |
| 9076 | } else { |
| 9077 | if (size) *size = 0; |
| 9078 | return NULL; |
| 9079 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9080 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9081 | UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_EnumValueOptions_resize_uninterpreted_option(google_protobuf_EnumValueOptions* msg, size_t size, upb_Arena* arena) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9082 | upb_MiniTableField field = {999, UPB_SIZE(12, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Jie Luo | f36a5c6 | 2023-05-23 17:56:18 -0700 | [diff] [blame] | 9083 | return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9084 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9085 | UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_EnumValueOptions_add_uninterpreted_option(google_protobuf_EnumValueOptions* msg, upb_Arena* arena) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9086 | upb_MiniTableField field = {999, UPB_SIZE(12, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9087 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 9088 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 9089 | return NULL; |
| 9090 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9091 | struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)_upb_Message_New(&google_protobuf_UninterpretedOption_msg_init, arena); |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9092 | if (!arr || !sub) return NULL; |
| 9093 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9094 | return sub; |
| 9095 | } |
| 9096 | |
| 9097 | /* google.protobuf.ServiceOptions */ |
| 9098 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9099 | UPB_INLINE google_protobuf_ServiceOptions* google_protobuf_ServiceOptions_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9100 | return (google_protobuf_ServiceOptions*)_upb_Message_New(&google_protobuf_ServiceOptions_msg_init, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9101 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9102 | UPB_INLINE google_protobuf_ServiceOptions* google_protobuf_ServiceOptions_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 9103 | google_protobuf_ServiceOptions* ret = google_protobuf_ServiceOptions_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 9104 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9105 | if (upb_Decode(buf, size, ret, &google_protobuf_ServiceOptions_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 9106 | return NULL; |
| 9107 | } |
| 9108 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9109 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9110 | UPB_INLINE google_protobuf_ServiceOptions* google_protobuf_ServiceOptions_parse_ex(const char* buf, size_t size, |
| 9111 | const upb_ExtensionRegistry* extreg, |
| 9112 | int options, upb_Arena* arena) { |
| 9113 | google_protobuf_ServiceOptions* ret = google_protobuf_ServiceOptions_new(arena); |
| 9114 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9115 | if (upb_Decode(buf, size, ret, &google_protobuf_ServiceOptions_msg_init, extreg, options, arena) != |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9116 | kUpb_DecodeStatus_Ok) { |
| 9117 | return NULL; |
| 9118 | } |
| 9119 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9120 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9121 | UPB_INLINE char* google_protobuf_ServiceOptions_serialize(const google_protobuf_ServiceOptions* msg, upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9122 | char* ptr; |
| 9123 | (void)upb_Encode(msg, &google_protobuf_ServiceOptions_msg_init, 0, arena, &ptr, len); |
| 9124 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9125 | } |
| 9126 | UPB_INLINE char* google_protobuf_ServiceOptions_serialize_ex(const google_protobuf_ServiceOptions* msg, int options, |
| 9127 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9128 | char* ptr; |
| 9129 | (void)upb_Encode(msg, &google_protobuf_ServiceOptions_msg_init, options, arena, &ptr, len); |
| 9130 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9131 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9132 | UPB_INLINE void google_protobuf_ServiceOptions_clear_deprecated(google_protobuf_ServiceOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9133 | const upb_MiniTableField field = {33, 1, 1, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 9134 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9135 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9136 | UPB_INLINE bool google_protobuf_ServiceOptions_deprecated(const google_protobuf_ServiceOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 9137 | bool default_val = false; |
| 9138 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9139 | const upb_MiniTableField field = {33, 1, 1, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 9140 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 9141 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9142 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9143 | UPB_INLINE bool google_protobuf_ServiceOptions_has_deprecated(const google_protobuf_ServiceOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9144 | const upb_MiniTableField field = {33, 1, 1, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 9145 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9146 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9147 | UPB_INLINE void google_protobuf_ServiceOptions_clear_features(google_protobuf_ServiceOptions* msg) { |
| 9148 | const upb_MiniTableField field = {34, UPB_SIZE(4, 8), 2, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
| 9149 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 9150 | } |
| 9151 | UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_ServiceOptions_features(const google_protobuf_ServiceOptions* msg) { |
| 9152 | const google_protobuf_FeatureSet* default_val = NULL; |
| 9153 | const google_protobuf_FeatureSet* ret; |
| 9154 | const upb_MiniTableField field = {34, UPB_SIZE(4, 8), 2, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
| 9155 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 9156 | return ret; |
| 9157 | } |
| 9158 | UPB_INLINE bool google_protobuf_ServiceOptions_has_features(const google_protobuf_ServiceOptions* msg) { |
| 9159 | const upb_MiniTableField field = {34, UPB_SIZE(4, 8), 2, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
| 9160 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 9161 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9162 | UPB_INLINE void google_protobuf_ServiceOptions_clear_uninterpreted_option(google_protobuf_ServiceOptions* msg) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9163 | const upb_MiniTableField field = {999, UPB_SIZE(8, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 9164 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9165 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9166 | UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_ServiceOptions_uninterpreted_option(const google_protobuf_ServiceOptions* msg, size_t* size) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9167 | const upb_MiniTableField field = {999, UPB_SIZE(8, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9168 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 9169 | if (arr) { |
| 9170 | if (size) *size = arr->size; |
| 9171 | return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr); |
| 9172 | } else { |
| 9173 | if (size) *size = 0; |
| 9174 | return NULL; |
| 9175 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9176 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 9177 | UPB_INLINE const upb_Array* _google_protobuf_ServiceOptions_uninterpreted_option_upb_array(const google_protobuf_ServiceOptions* msg, size_t* size) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9178 | const upb_MiniTableField field = {999, UPB_SIZE(8, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 9179 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 9180 | if (size) { |
| 9181 | *size = arr ? arr->size : 0; |
| 9182 | } |
| 9183 | return arr; |
| 9184 | } |
| 9185 | UPB_INLINE upb_Array* _google_protobuf_ServiceOptions_uninterpreted_option_mutable_upb_array(const google_protobuf_ServiceOptions* msg, size_t* size, upb_Arena* arena) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9186 | const upb_MiniTableField field = {999, UPB_SIZE(8, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 9187 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 9188 | (upb_Message*)msg, &field, arena); |
| 9189 | if (size) { |
| 9190 | *size = arr ? arr->size : 0; |
| 9191 | } |
| 9192 | return arr; |
| 9193 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9194 | UPB_INLINE bool google_protobuf_ServiceOptions_has_uninterpreted_option(const google_protobuf_ServiceOptions* msg) { |
| 9195 | size_t size; |
| 9196 | google_protobuf_ServiceOptions_uninterpreted_option(msg, &size); |
| 9197 | return size != 0; |
| 9198 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9199 | |
| 9200 | UPB_INLINE void google_protobuf_ServiceOptions_set_deprecated(google_protobuf_ServiceOptions *msg, bool value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9201 | const upb_MiniTableField field = {33, 1, 1, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 9202 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 9203 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9204 | UPB_INLINE void google_protobuf_ServiceOptions_set_features(google_protobuf_ServiceOptions *msg, google_protobuf_FeatureSet* value) { |
| 9205 | const upb_MiniTableField field = {34, UPB_SIZE(4, 8), 2, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
| 9206 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 9207 | } |
| 9208 | UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_ServiceOptions_mutable_features(google_protobuf_ServiceOptions* msg, upb_Arena* arena) { |
| 9209 | struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_ServiceOptions_features(msg); |
| 9210 | if (sub == NULL) { |
| 9211 | sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google_protobuf_FeatureSet_msg_init, arena); |
| 9212 | if (sub) google_protobuf_ServiceOptions_set_features(msg, sub); |
| 9213 | } |
| 9214 | return sub; |
| 9215 | } |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 9216 | UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_ServiceOptions_mutable_uninterpreted_option(google_protobuf_ServiceOptions* msg, size_t* size) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9217 | upb_MiniTableField field = {999, UPB_SIZE(8, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9218 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 9219 | if (arr) { |
| 9220 | if (size) *size = arr->size; |
| 9221 | return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr); |
| 9222 | } else { |
| 9223 | if (size) *size = 0; |
| 9224 | return NULL; |
| 9225 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9226 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9227 | UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_ServiceOptions_resize_uninterpreted_option(google_protobuf_ServiceOptions* msg, size_t size, upb_Arena* arena) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9228 | upb_MiniTableField field = {999, UPB_SIZE(8, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Jie Luo | f36a5c6 | 2023-05-23 17:56:18 -0700 | [diff] [blame] | 9229 | return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9230 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9231 | UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_ServiceOptions_add_uninterpreted_option(google_protobuf_ServiceOptions* msg, upb_Arena* arena) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9232 | upb_MiniTableField field = {999, UPB_SIZE(8, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9233 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 9234 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 9235 | return NULL; |
| 9236 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9237 | struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)_upb_Message_New(&google_protobuf_UninterpretedOption_msg_init, arena); |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9238 | if (!arr || !sub) return NULL; |
| 9239 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9240 | return sub; |
| 9241 | } |
| 9242 | |
| 9243 | /* google.protobuf.MethodOptions */ |
| 9244 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9245 | UPB_INLINE google_protobuf_MethodOptions* google_protobuf_MethodOptions_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9246 | return (google_protobuf_MethodOptions*)_upb_Message_New(&google_protobuf_MethodOptions_msg_init, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9247 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9248 | UPB_INLINE google_protobuf_MethodOptions* google_protobuf_MethodOptions_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 9249 | google_protobuf_MethodOptions* ret = google_protobuf_MethodOptions_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 9250 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9251 | if (upb_Decode(buf, size, ret, &google_protobuf_MethodOptions_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 9252 | return NULL; |
| 9253 | } |
| 9254 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9255 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9256 | UPB_INLINE google_protobuf_MethodOptions* google_protobuf_MethodOptions_parse_ex(const char* buf, size_t size, |
| 9257 | const upb_ExtensionRegistry* extreg, |
| 9258 | int options, upb_Arena* arena) { |
| 9259 | google_protobuf_MethodOptions* ret = google_protobuf_MethodOptions_new(arena); |
| 9260 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9261 | if (upb_Decode(buf, size, ret, &google_protobuf_MethodOptions_msg_init, extreg, options, arena) != |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9262 | kUpb_DecodeStatus_Ok) { |
| 9263 | return NULL; |
| 9264 | } |
| 9265 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9266 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9267 | UPB_INLINE char* google_protobuf_MethodOptions_serialize(const google_protobuf_MethodOptions* msg, upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9268 | char* ptr; |
| 9269 | (void)upb_Encode(msg, &google_protobuf_MethodOptions_msg_init, 0, arena, &ptr, len); |
| 9270 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9271 | } |
| 9272 | UPB_INLINE char* google_protobuf_MethodOptions_serialize_ex(const google_protobuf_MethodOptions* msg, int options, |
| 9273 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9274 | char* ptr; |
| 9275 | (void)upb_Encode(msg, &google_protobuf_MethodOptions_msg_init, options, arena, &ptr, len); |
| 9276 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9277 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9278 | UPB_INLINE void google_protobuf_MethodOptions_clear_deprecated(google_protobuf_MethodOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9279 | const upb_MiniTableField field = {33, 1, 1, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 9280 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9281 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9282 | UPB_INLINE bool google_protobuf_MethodOptions_deprecated(const google_protobuf_MethodOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 9283 | bool default_val = false; |
| 9284 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9285 | const upb_MiniTableField field = {33, 1, 1, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 9286 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 9287 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9288 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9289 | UPB_INLINE bool google_protobuf_MethodOptions_has_deprecated(const google_protobuf_MethodOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9290 | const upb_MiniTableField field = {33, 1, 1, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 9291 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9292 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9293 | UPB_INLINE void google_protobuf_MethodOptions_clear_idempotency_level(google_protobuf_MethodOptions* msg) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9294 | const upb_MiniTableField field = {34, 4, 2, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 9295 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9296 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9297 | UPB_INLINE int32_t google_protobuf_MethodOptions_idempotency_level(const google_protobuf_MethodOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 9298 | int32_t default_val = 0; |
| 9299 | int32_t ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9300 | const upb_MiniTableField field = {34, 4, 2, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 9301 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 9302 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9303 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9304 | UPB_INLINE bool google_protobuf_MethodOptions_has_idempotency_level(const google_protobuf_MethodOptions* msg) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9305 | const upb_MiniTableField field = {34, 4, 2, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
| 9306 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 9307 | } |
| 9308 | UPB_INLINE void google_protobuf_MethodOptions_clear_features(google_protobuf_MethodOptions* msg) { |
| 9309 | const upb_MiniTableField field = {35, 8, 3, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
| 9310 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 9311 | } |
| 9312 | UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_MethodOptions_features(const google_protobuf_MethodOptions* msg) { |
| 9313 | const google_protobuf_FeatureSet* default_val = NULL; |
| 9314 | const google_protobuf_FeatureSet* ret; |
| 9315 | const upb_MiniTableField field = {35, 8, 3, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
| 9316 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 9317 | return ret; |
| 9318 | } |
| 9319 | UPB_INLINE bool google_protobuf_MethodOptions_has_features(const google_protobuf_MethodOptions* msg) { |
| 9320 | const upb_MiniTableField field = {35, 8, 3, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 9321 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9322 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9323 | UPB_INLINE void google_protobuf_MethodOptions_clear_uninterpreted_option(google_protobuf_MethodOptions* msg) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9324 | const upb_MiniTableField field = {999, UPB_SIZE(12, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 9325 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9326 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9327 | UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_MethodOptions_uninterpreted_option(const google_protobuf_MethodOptions* msg, size_t* size) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9328 | const upb_MiniTableField field = {999, UPB_SIZE(12, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9329 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 9330 | if (arr) { |
| 9331 | if (size) *size = arr->size; |
| 9332 | return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr); |
| 9333 | } else { |
| 9334 | if (size) *size = 0; |
| 9335 | return NULL; |
| 9336 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9337 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 9338 | UPB_INLINE const upb_Array* _google_protobuf_MethodOptions_uninterpreted_option_upb_array(const google_protobuf_MethodOptions* msg, size_t* size) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9339 | const upb_MiniTableField field = {999, UPB_SIZE(12, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 9340 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 9341 | if (size) { |
| 9342 | *size = arr ? arr->size : 0; |
| 9343 | } |
| 9344 | return arr; |
| 9345 | } |
| 9346 | UPB_INLINE upb_Array* _google_protobuf_MethodOptions_uninterpreted_option_mutable_upb_array(const google_protobuf_MethodOptions* msg, size_t* size, upb_Arena* arena) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9347 | const upb_MiniTableField field = {999, UPB_SIZE(12, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 9348 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 9349 | (upb_Message*)msg, &field, arena); |
| 9350 | if (size) { |
| 9351 | *size = arr ? arr->size : 0; |
| 9352 | } |
| 9353 | return arr; |
| 9354 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9355 | UPB_INLINE bool google_protobuf_MethodOptions_has_uninterpreted_option(const google_protobuf_MethodOptions* msg) { |
| 9356 | size_t size; |
| 9357 | google_protobuf_MethodOptions_uninterpreted_option(msg, &size); |
| 9358 | return size != 0; |
| 9359 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9360 | |
| 9361 | UPB_INLINE void google_protobuf_MethodOptions_set_deprecated(google_protobuf_MethodOptions *msg, bool value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9362 | const upb_MiniTableField field = {33, 1, 1, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 9363 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 9364 | } |
| 9365 | UPB_INLINE void google_protobuf_MethodOptions_set_idempotency_level(google_protobuf_MethodOptions *msg, int32_t value) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9366 | const upb_MiniTableField field = {34, 4, 2, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 9367 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 9368 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9369 | UPB_INLINE void google_protobuf_MethodOptions_set_features(google_protobuf_MethodOptions *msg, google_protobuf_FeatureSet* value) { |
| 9370 | const upb_MiniTableField field = {35, 8, 3, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
| 9371 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 9372 | } |
| 9373 | UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_MethodOptions_mutable_features(google_protobuf_MethodOptions* msg, upb_Arena* arena) { |
| 9374 | struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_MethodOptions_features(msg); |
| 9375 | if (sub == NULL) { |
| 9376 | sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google_protobuf_FeatureSet_msg_init, arena); |
| 9377 | if (sub) google_protobuf_MethodOptions_set_features(msg, sub); |
| 9378 | } |
| 9379 | return sub; |
| 9380 | } |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 9381 | UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_MethodOptions_mutable_uninterpreted_option(google_protobuf_MethodOptions* msg, size_t* size) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9382 | upb_MiniTableField field = {999, UPB_SIZE(12, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9383 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 9384 | if (arr) { |
| 9385 | if (size) *size = arr->size; |
| 9386 | return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr); |
| 9387 | } else { |
| 9388 | if (size) *size = 0; |
| 9389 | return NULL; |
| 9390 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9391 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9392 | UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_MethodOptions_resize_uninterpreted_option(google_protobuf_MethodOptions* msg, size_t size, upb_Arena* arena) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9393 | upb_MiniTableField field = {999, UPB_SIZE(12, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Jie Luo | f36a5c6 | 2023-05-23 17:56:18 -0700 | [diff] [blame] | 9394 | return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9395 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9396 | UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_MethodOptions_add_uninterpreted_option(google_protobuf_MethodOptions* msg, upb_Arena* arena) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9397 | upb_MiniTableField field = {999, UPB_SIZE(12, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9398 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 9399 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 9400 | return NULL; |
| 9401 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9402 | struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)_upb_Message_New(&google_protobuf_UninterpretedOption_msg_init, arena); |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9403 | if (!arr || !sub) return NULL; |
| 9404 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9405 | return sub; |
| 9406 | } |
| 9407 | |
| 9408 | /* google.protobuf.UninterpretedOption */ |
| 9409 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9410 | UPB_INLINE google_protobuf_UninterpretedOption* google_protobuf_UninterpretedOption_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9411 | return (google_protobuf_UninterpretedOption*)_upb_Message_New(&google_protobuf_UninterpretedOption_msg_init, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9412 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9413 | UPB_INLINE google_protobuf_UninterpretedOption* google_protobuf_UninterpretedOption_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 9414 | google_protobuf_UninterpretedOption* ret = google_protobuf_UninterpretedOption_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 9415 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9416 | if (upb_Decode(buf, size, ret, &google_protobuf_UninterpretedOption_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 9417 | return NULL; |
| 9418 | } |
| 9419 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9420 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9421 | UPB_INLINE google_protobuf_UninterpretedOption* google_protobuf_UninterpretedOption_parse_ex(const char* buf, size_t size, |
| 9422 | const upb_ExtensionRegistry* extreg, |
| 9423 | int options, upb_Arena* arena) { |
| 9424 | google_protobuf_UninterpretedOption* ret = google_protobuf_UninterpretedOption_new(arena); |
| 9425 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9426 | if (upb_Decode(buf, size, ret, &google_protobuf_UninterpretedOption_msg_init, extreg, options, arena) != |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9427 | kUpb_DecodeStatus_Ok) { |
| 9428 | return NULL; |
| 9429 | } |
| 9430 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9431 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9432 | UPB_INLINE char* google_protobuf_UninterpretedOption_serialize(const google_protobuf_UninterpretedOption* msg, upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9433 | char* ptr; |
| 9434 | (void)upb_Encode(msg, &google_protobuf_UninterpretedOption_msg_init, 0, arena, &ptr, len); |
| 9435 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9436 | } |
| 9437 | UPB_INLINE char* google_protobuf_UninterpretedOption_serialize_ex(const google_protobuf_UninterpretedOption* msg, int options, |
| 9438 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9439 | char* ptr; |
| 9440 | (void)upb_Encode(msg, &google_protobuf_UninterpretedOption_msg_init, options, arena, &ptr, len); |
| 9441 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9442 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9443 | UPB_INLINE void google_protobuf_UninterpretedOption_clear_name(google_protobuf_UninterpretedOption* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9444 | const upb_MiniTableField field = {2, UPB_SIZE(4, 8), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 9445 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9446 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9447 | UPB_INLINE const google_protobuf_UninterpretedOption_NamePart* const* google_protobuf_UninterpretedOption_name(const google_protobuf_UninterpretedOption* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9448 | const upb_MiniTableField field = {2, UPB_SIZE(4, 8), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9449 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 9450 | if (arr) { |
| 9451 | if (size) *size = arr->size; |
| 9452 | return (const google_protobuf_UninterpretedOption_NamePart* const*)_upb_array_constptr(arr); |
| 9453 | } else { |
| 9454 | if (size) *size = 0; |
| 9455 | return NULL; |
| 9456 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9457 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 9458 | UPB_INLINE const upb_Array* _google_protobuf_UninterpretedOption_name_upb_array(const google_protobuf_UninterpretedOption* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9459 | const upb_MiniTableField field = {2, UPB_SIZE(4, 8), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 9460 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 9461 | if (size) { |
| 9462 | *size = arr ? arr->size : 0; |
| 9463 | } |
| 9464 | return arr; |
| 9465 | } |
| 9466 | UPB_INLINE upb_Array* _google_protobuf_UninterpretedOption_name_mutable_upb_array(const google_protobuf_UninterpretedOption* msg, size_t* size, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9467 | const upb_MiniTableField field = {2, UPB_SIZE(4, 8), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 9468 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 9469 | (upb_Message*)msg, &field, arena); |
| 9470 | if (size) { |
| 9471 | *size = arr ? arr->size : 0; |
| 9472 | } |
| 9473 | return arr; |
| 9474 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9475 | UPB_INLINE bool google_protobuf_UninterpretedOption_has_name(const google_protobuf_UninterpretedOption* msg) { |
| 9476 | size_t size; |
| 9477 | google_protobuf_UninterpretedOption_name(msg, &size); |
| 9478 | return size != 0; |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9479 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9480 | UPB_INLINE void google_protobuf_UninterpretedOption_clear_identifier_value(google_protobuf_UninterpretedOption* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9481 | const upb_MiniTableField field = {3, UPB_SIZE(8, 16), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 9482 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9483 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9484 | UPB_INLINE upb_StringView google_protobuf_UninterpretedOption_identifier_value(const google_protobuf_UninterpretedOption* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 9485 | upb_StringView default_val = upb_StringView_FromString(""); |
| 9486 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9487 | const upb_MiniTableField field = {3, UPB_SIZE(8, 16), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 9488 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 9489 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9490 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9491 | UPB_INLINE bool google_protobuf_UninterpretedOption_has_identifier_value(const google_protobuf_UninterpretedOption* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9492 | const upb_MiniTableField field = {3, UPB_SIZE(8, 16), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 9493 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9494 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9495 | UPB_INLINE void google_protobuf_UninterpretedOption_clear_positive_int_value(google_protobuf_UninterpretedOption* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9496 | const upb_MiniTableField field = {4, UPB_SIZE(16, 32), 2, kUpb_NoSub, 4, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 9497 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9498 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9499 | UPB_INLINE uint64_t google_protobuf_UninterpretedOption_positive_int_value(const google_protobuf_UninterpretedOption* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 9500 | uint64_t default_val = (uint64_t)0ull; |
| 9501 | uint64_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9502 | const upb_MiniTableField field = {4, UPB_SIZE(16, 32), 2, kUpb_NoSub, 4, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 9503 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 9504 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9505 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9506 | UPB_INLINE bool google_protobuf_UninterpretedOption_has_positive_int_value(const google_protobuf_UninterpretedOption* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9507 | const upb_MiniTableField field = {4, UPB_SIZE(16, 32), 2, kUpb_NoSub, 4, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 9508 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9509 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9510 | UPB_INLINE void google_protobuf_UninterpretedOption_clear_negative_int_value(google_protobuf_UninterpretedOption* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9511 | const upb_MiniTableField field = {5, UPB_SIZE(24, 40), 3, kUpb_NoSub, 3, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 9512 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9513 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9514 | UPB_INLINE int64_t google_protobuf_UninterpretedOption_negative_int_value(const google_protobuf_UninterpretedOption* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 9515 | int64_t default_val = (int64_t)0ll; |
| 9516 | int64_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9517 | const upb_MiniTableField field = {5, UPB_SIZE(24, 40), 3, kUpb_NoSub, 3, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 9518 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 9519 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9520 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9521 | UPB_INLINE bool google_protobuf_UninterpretedOption_has_negative_int_value(const google_protobuf_UninterpretedOption* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9522 | const upb_MiniTableField field = {5, UPB_SIZE(24, 40), 3, kUpb_NoSub, 3, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 9523 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9524 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9525 | UPB_INLINE void google_protobuf_UninterpretedOption_clear_double_value(google_protobuf_UninterpretedOption* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9526 | const upb_MiniTableField field = {6, UPB_SIZE(32, 48), 4, kUpb_NoSub, 1, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 9527 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9528 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9529 | UPB_INLINE double google_protobuf_UninterpretedOption_double_value(const google_protobuf_UninterpretedOption* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 9530 | double default_val = 0; |
| 9531 | double ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9532 | const upb_MiniTableField field = {6, UPB_SIZE(32, 48), 4, kUpb_NoSub, 1, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 9533 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 9534 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9535 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9536 | UPB_INLINE bool google_protobuf_UninterpretedOption_has_double_value(const google_protobuf_UninterpretedOption* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9537 | const upb_MiniTableField field = {6, UPB_SIZE(32, 48), 4, kUpb_NoSub, 1, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 9538 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9539 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9540 | UPB_INLINE void google_protobuf_UninterpretedOption_clear_string_value(google_protobuf_UninterpretedOption* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9541 | const upb_MiniTableField field = {7, UPB_SIZE(40, 56), 5, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 9542 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9543 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9544 | UPB_INLINE upb_StringView google_protobuf_UninterpretedOption_string_value(const google_protobuf_UninterpretedOption* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 9545 | upb_StringView default_val = upb_StringView_FromString(""); |
| 9546 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9547 | const upb_MiniTableField field = {7, UPB_SIZE(40, 56), 5, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 9548 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 9549 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9550 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9551 | UPB_INLINE bool google_protobuf_UninterpretedOption_has_string_value(const google_protobuf_UninterpretedOption* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9552 | const upb_MiniTableField field = {7, UPB_SIZE(40, 56), 5, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 9553 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9554 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9555 | UPB_INLINE void google_protobuf_UninterpretedOption_clear_aggregate_value(google_protobuf_UninterpretedOption* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9556 | const upb_MiniTableField field = {8, UPB_SIZE(48, 72), 6, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 9557 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9558 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9559 | UPB_INLINE upb_StringView google_protobuf_UninterpretedOption_aggregate_value(const google_protobuf_UninterpretedOption* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 9560 | upb_StringView default_val = upb_StringView_FromString(""); |
| 9561 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9562 | const upb_MiniTableField field = {8, UPB_SIZE(48, 72), 6, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 9563 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 9564 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9565 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9566 | UPB_INLINE bool google_protobuf_UninterpretedOption_has_aggregate_value(const google_protobuf_UninterpretedOption* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9567 | const upb_MiniTableField field = {8, UPB_SIZE(48, 72), 6, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 9568 | return _upb_Message_HasNonExtensionField(msg, &field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9569 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9570 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9571 | UPB_INLINE google_protobuf_UninterpretedOption_NamePart** google_protobuf_UninterpretedOption_mutable_name(google_protobuf_UninterpretedOption* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9572 | upb_MiniTableField field = {2, UPB_SIZE(4, 8), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9573 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 9574 | if (arr) { |
| 9575 | if (size) *size = arr->size; |
| 9576 | return (google_protobuf_UninterpretedOption_NamePart**)_upb_array_ptr(arr); |
| 9577 | } else { |
| 9578 | if (size) *size = 0; |
| 9579 | return NULL; |
| 9580 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9581 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9582 | UPB_INLINE google_protobuf_UninterpretedOption_NamePart** google_protobuf_UninterpretedOption_resize_name(google_protobuf_UninterpretedOption* msg, size_t size, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9583 | upb_MiniTableField field = {2, UPB_SIZE(4, 8), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Jie Luo | f36a5c6 | 2023-05-23 17:56:18 -0700 | [diff] [blame] | 9584 | return (google_protobuf_UninterpretedOption_NamePart**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9585 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9586 | UPB_INLINE struct google_protobuf_UninterpretedOption_NamePart* google_protobuf_UninterpretedOption_add_name(google_protobuf_UninterpretedOption* msg, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9587 | upb_MiniTableField field = {2, UPB_SIZE(4, 8), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9588 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 9589 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 9590 | return NULL; |
| 9591 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9592 | struct google_protobuf_UninterpretedOption_NamePart* sub = (struct google_protobuf_UninterpretedOption_NamePart*)_upb_Message_New(&google_protobuf_UninterpretedOption_NamePart_msg_init, arena); |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9593 | if (!arr || !sub) return NULL; |
| 9594 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9595 | return sub; |
| 9596 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9597 | UPB_INLINE void google_protobuf_UninterpretedOption_set_identifier_value(google_protobuf_UninterpretedOption *msg, upb_StringView value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9598 | const upb_MiniTableField field = {3, UPB_SIZE(8, 16), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 9599 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 9600 | } |
| 9601 | UPB_INLINE void google_protobuf_UninterpretedOption_set_positive_int_value(google_protobuf_UninterpretedOption *msg, uint64_t value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9602 | const upb_MiniTableField field = {4, UPB_SIZE(16, 32), 2, kUpb_NoSub, 4, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 9603 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 9604 | } |
| 9605 | UPB_INLINE void google_protobuf_UninterpretedOption_set_negative_int_value(google_protobuf_UninterpretedOption *msg, int64_t value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9606 | const upb_MiniTableField field = {5, UPB_SIZE(24, 40), 3, kUpb_NoSub, 3, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 9607 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 9608 | } |
| 9609 | UPB_INLINE void google_protobuf_UninterpretedOption_set_double_value(google_protobuf_UninterpretedOption *msg, double value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9610 | const upb_MiniTableField field = {6, UPB_SIZE(32, 48), 4, kUpb_NoSub, 1, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 9611 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 9612 | } |
| 9613 | UPB_INLINE void google_protobuf_UninterpretedOption_set_string_value(google_protobuf_UninterpretedOption *msg, upb_StringView value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9614 | const upb_MiniTableField field = {7, UPB_SIZE(40, 56), 5, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 9615 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 9616 | } |
| 9617 | UPB_INLINE void google_protobuf_UninterpretedOption_set_aggregate_value(google_protobuf_UninterpretedOption *msg, upb_StringView value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9618 | const upb_MiniTableField field = {8, UPB_SIZE(48, 72), 6, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 9619 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9620 | } |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 9621 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9622 | /* google.protobuf.UninterpretedOption.NamePart */ |
| 9623 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9624 | UPB_INLINE google_protobuf_UninterpretedOption_NamePart* google_protobuf_UninterpretedOption_NamePart_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9625 | return (google_protobuf_UninterpretedOption_NamePart*)_upb_Message_New(&google_protobuf_UninterpretedOption_NamePart_msg_init, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9626 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9627 | UPB_INLINE google_protobuf_UninterpretedOption_NamePart* google_protobuf_UninterpretedOption_NamePart_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 9628 | google_protobuf_UninterpretedOption_NamePart* ret = google_protobuf_UninterpretedOption_NamePart_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 9629 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9630 | if (upb_Decode(buf, size, ret, &google_protobuf_UninterpretedOption_NamePart_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 9631 | return NULL; |
| 9632 | } |
| 9633 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9634 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9635 | UPB_INLINE google_protobuf_UninterpretedOption_NamePart* google_protobuf_UninterpretedOption_NamePart_parse_ex(const char* buf, size_t size, |
| 9636 | const upb_ExtensionRegistry* extreg, |
| 9637 | int options, upb_Arena* arena) { |
| 9638 | google_protobuf_UninterpretedOption_NamePart* ret = google_protobuf_UninterpretedOption_NamePart_new(arena); |
| 9639 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9640 | if (upb_Decode(buf, size, ret, &google_protobuf_UninterpretedOption_NamePart_msg_init, extreg, options, arena) != |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9641 | kUpb_DecodeStatus_Ok) { |
| 9642 | return NULL; |
| 9643 | } |
| 9644 | return ret; |
| 9645 | } |
| 9646 | UPB_INLINE char* google_protobuf_UninterpretedOption_NamePart_serialize(const google_protobuf_UninterpretedOption_NamePart* msg, upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9647 | char* ptr; |
| 9648 | (void)upb_Encode(msg, &google_protobuf_UninterpretedOption_NamePart_msg_init, 0, arena, &ptr, len); |
| 9649 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9650 | } |
| 9651 | UPB_INLINE char* google_protobuf_UninterpretedOption_NamePart_serialize_ex(const google_protobuf_UninterpretedOption_NamePart* msg, int options, |
| 9652 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9653 | char* ptr; |
| 9654 | (void)upb_Encode(msg, &google_protobuf_UninterpretedOption_NamePart_msg_init, options, arena, &ptr, len); |
| 9655 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9656 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9657 | UPB_INLINE void google_protobuf_UninterpretedOption_NamePart_clear_name_part(google_protobuf_UninterpretedOption_NamePart* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9658 | const upb_MiniTableField field = {1, UPB_SIZE(4, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 9659 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9660 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9661 | UPB_INLINE upb_StringView google_protobuf_UninterpretedOption_NamePart_name_part(const google_protobuf_UninterpretedOption_NamePart* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 9662 | upb_StringView default_val = upb_StringView_FromString(""); |
| 9663 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9664 | const upb_MiniTableField field = {1, UPB_SIZE(4, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 9665 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 9666 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9667 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9668 | UPB_INLINE bool google_protobuf_UninterpretedOption_NamePart_has_name_part(const google_protobuf_UninterpretedOption_NamePart* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9669 | const upb_MiniTableField field = {1, UPB_SIZE(4, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 9670 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9671 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9672 | UPB_INLINE void google_protobuf_UninterpretedOption_NamePart_clear_is_extension(google_protobuf_UninterpretedOption_NamePart* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9673 | const upb_MiniTableField field = {2, 1, 2, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 9674 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9675 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9676 | UPB_INLINE bool google_protobuf_UninterpretedOption_NamePart_is_extension(const google_protobuf_UninterpretedOption_NamePart* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 9677 | bool default_val = false; |
| 9678 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9679 | const upb_MiniTableField field = {2, 1, 2, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 9680 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 9681 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9682 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9683 | UPB_INLINE bool google_protobuf_UninterpretedOption_NamePart_has_is_extension(const google_protobuf_UninterpretedOption_NamePart* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9684 | const upb_MiniTableField field = {2, 1, 2, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 9685 | return _upb_Message_HasNonExtensionField(msg, &field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9686 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9687 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9688 | UPB_INLINE void google_protobuf_UninterpretedOption_NamePart_set_name_part(google_protobuf_UninterpretedOption_NamePart *msg, upb_StringView value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9689 | const upb_MiniTableField field = {1, UPB_SIZE(4, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 9690 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 9691 | } |
| 9692 | UPB_INLINE void google_protobuf_UninterpretedOption_NamePart_set_is_extension(google_protobuf_UninterpretedOption_NamePart *msg, bool value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9693 | const upb_MiniTableField field = {2, 1, 2, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 9694 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9695 | } |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 9696 | |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9697 | /* google.protobuf.FeatureSet */ |
| 9698 | |
| 9699 | UPB_INLINE google_protobuf_FeatureSet* google_protobuf_FeatureSet_new(upb_Arena* arena) { |
| 9700 | return (google_protobuf_FeatureSet*)_upb_Message_New(&google_protobuf_FeatureSet_msg_init, arena); |
| 9701 | } |
| 9702 | UPB_INLINE google_protobuf_FeatureSet* google_protobuf_FeatureSet_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 9703 | google_protobuf_FeatureSet* ret = google_protobuf_FeatureSet_new(arena); |
| 9704 | if (!ret) return NULL; |
| 9705 | if (upb_Decode(buf, size, ret, &google_protobuf_FeatureSet_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { |
| 9706 | return NULL; |
| 9707 | } |
| 9708 | return ret; |
| 9709 | } |
| 9710 | UPB_INLINE google_protobuf_FeatureSet* google_protobuf_FeatureSet_parse_ex(const char* buf, size_t size, |
| 9711 | const upb_ExtensionRegistry* extreg, |
| 9712 | int options, upb_Arena* arena) { |
| 9713 | google_protobuf_FeatureSet* ret = google_protobuf_FeatureSet_new(arena); |
| 9714 | if (!ret) return NULL; |
| 9715 | if (upb_Decode(buf, size, ret, &google_protobuf_FeatureSet_msg_init, extreg, options, arena) != |
| 9716 | kUpb_DecodeStatus_Ok) { |
| 9717 | return NULL; |
| 9718 | } |
| 9719 | return ret; |
| 9720 | } |
| 9721 | UPB_INLINE char* google_protobuf_FeatureSet_serialize(const google_protobuf_FeatureSet* msg, upb_Arena* arena, size_t* len) { |
| 9722 | char* ptr; |
| 9723 | (void)upb_Encode(msg, &google_protobuf_FeatureSet_msg_init, 0, arena, &ptr, len); |
| 9724 | return ptr; |
| 9725 | } |
| 9726 | UPB_INLINE char* google_protobuf_FeatureSet_serialize_ex(const google_protobuf_FeatureSet* msg, int options, |
| 9727 | upb_Arena* arena, size_t* len) { |
| 9728 | char* ptr; |
| 9729 | (void)upb_Encode(msg, &google_protobuf_FeatureSet_msg_init, options, arena, &ptr, len); |
| 9730 | return ptr; |
| 9731 | } |
| 9732 | UPB_INLINE void google_protobuf_FeatureSet_clear_field_presence(google_protobuf_FeatureSet* msg) { |
Mike Kruskal | 60ec7bf | 2023-08-17 16:44:12 -0700 | [diff] [blame] | 9733 | const upb_MiniTableField field = {1, 4, 1, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9734 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 9735 | } |
| 9736 | UPB_INLINE int32_t google_protobuf_FeatureSet_field_presence(const google_protobuf_FeatureSet* msg) { |
| 9737 | int32_t default_val = 0; |
| 9738 | int32_t ret; |
Mike Kruskal | 60ec7bf | 2023-08-17 16:44:12 -0700 | [diff] [blame] | 9739 | const upb_MiniTableField field = {1, 4, 1, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9740 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 9741 | return ret; |
| 9742 | } |
| 9743 | UPB_INLINE bool google_protobuf_FeatureSet_has_field_presence(const google_protobuf_FeatureSet* msg) { |
Mike Kruskal | 60ec7bf | 2023-08-17 16:44:12 -0700 | [diff] [blame] | 9744 | const upb_MiniTableField field = {1, 4, 1, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9745 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 9746 | } |
| 9747 | UPB_INLINE void google_protobuf_FeatureSet_clear_enum_type(google_protobuf_FeatureSet* msg) { |
Mike Kruskal | 60ec7bf | 2023-08-17 16:44:12 -0700 | [diff] [blame] | 9748 | const upb_MiniTableField field = {2, 8, 2, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9749 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 9750 | } |
| 9751 | UPB_INLINE int32_t google_protobuf_FeatureSet_enum_type(const google_protobuf_FeatureSet* msg) { |
| 9752 | int32_t default_val = 0; |
| 9753 | int32_t ret; |
Mike Kruskal | 60ec7bf | 2023-08-17 16:44:12 -0700 | [diff] [blame] | 9754 | const upb_MiniTableField field = {2, 8, 2, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9755 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 9756 | return ret; |
| 9757 | } |
| 9758 | UPB_INLINE bool google_protobuf_FeatureSet_has_enum_type(const google_protobuf_FeatureSet* msg) { |
Mike Kruskal | 60ec7bf | 2023-08-17 16:44:12 -0700 | [diff] [blame] | 9759 | const upb_MiniTableField field = {2, 8, 2, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9760 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 9761 | } |
| 9762 | UPB_INLINE void google_protobuf_FeatureSet_clear_repeated_field_encoding(google_protobuf_FeatureSet* msg) { |
Mike Kruskal | 60ec7bf | 2023-08-17 16:44:12 -0700 | [diff] [blame] | 9763 | const upb_MiniTableField field = {3, 12, 3, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9764 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 9765 | } |
| 9766 | UPB_INLINE int32_t google_protobuf_FeatureSet_repeated_field_encoding(const google_protobuf_FeatureSet* msg) { |
| 9767 | int32_t default_val = 0; |
| 9768 | int32_t ret; |
Mike Kruskal | 60ec7bf | 2023-08-17 16:44:12 -0700 | [diff] [blame] | 9769 | const upb_MiniTableField field = {3, 12, 3, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9770 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 9771 | return ret; |
| 9772 | } |
| 9773 | UPB_INLINE bool google_protobuf_FeatureSet_has_repeated_field_encoding(const google_protobuf_FeatureSet* msg) { |
Mike Kruskal | 60ec7bf | 2023-08-17 16:44:12 -0700 | [diff] [blame] | 9774 | const upb_MiniTableField field = {3, 12, 3, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9775 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 9776 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9777 | UPB_INLINE void google_protobuf_FeatureSet_clear_message_encoding(google_protobuf_FeatureSet* msg) { |
Mike Kruskal | 60ec7bf | 2023-08-17 16:44:12 -0700 | [diff] [blame] | 9778 | const upb_MiniTableField field = {5, 16, 4, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9779 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 9780 | } |
| 9781 | UPB_INLINE int32_t google_protobuf_FeatureSet_message_encoding(const google_protobuf_FeatureSet* msg) { |
| 9782 | int32_t default_val = 0; |
| 9783 | int32_t ret; |
Mike Kruskal | 60ec7bf | 2023-08-17 16:44:12 -0700 | [diff] [blame] | 9784 | const upb_MiniTableField field = {5, 16, 4, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9785 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 9786 | return ret; |
| 9787 | } |
| 9788 | UPB_INLINE bool google_protobuf_FeatureSet_has_message_encoding(const google_protobuf_FeatureSet* msg) { |
Mike Kruskal | 60ec7bf | 2023-08-17 16:44:12 -0700 | [diff] [blame] | 9789 | const upb_MiniTableField field = {5, 16, 4, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9790 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 9791 | } |
| 9792 | UPB_INLINE void google_protobuf_FeatureSet_clear_json_format(google_protobuf_FeatureSet* msg) { |
Mike Kruskal | 60ec7bf | 2023-08-17 16:44:12 -0700 | [diff] [blame] | 9793 | const upb_MiniTableField field = {6, 20, 5, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9794 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 9795 | } |
| 9796 | UPB_INLINE int32_t google_protobuf_FeatureSet_json_format(const google_protobuf_FeatureSet* msg) { |
| 9797 | int32_t default_val = 0; |
| 9798 | int32_t ret; |
Mike Kruskal | 60ec7bf | 2023-08-17 16:44:12 -0700 | [diff] [blame] | 9799 | const upb_MiniTableField field = {6, 20, 5, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9800 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 9801 | return ret; |
| 9802 | } |
| 9803 | UPB_INLINE bool google_protobuf_FeatureSet_has_json_format(const google_protobuf_FeatureSet* msg) { |
Mike Kruskal | 60ec7bf | 2023-08-17 16:44:12 -0700 | [diff] [blame] | 9804 | const upb_MiniTableField field = {6, 20, 5, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9805 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 9806 | } |
| 9807 | |
| 9808 | UPB_INLINE void google_protobuf_FeatureSet_set_field_presence(google_protobuf_FeatureSet *msg, int32_t value) { |
Mike Kruskal | 60ec7bf | 2023-08-17 16:44:12 -0700 | [diff] [blame] | 9809 | const upb_MiniTableField field = {1, 4, 1, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9810 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 9811 | } |
| 9812 | UPB_INLINE void google_protobuf_FeatureSet_set_enum_type(google_protobuf_FeatureSet *msg, int32_t value) { |
Mike Kruskal | 60ec7bf | 2023-08-17 16:44:12 -0700 | [diff] [blame] | 9813 | const upb_MiniTableField field = {2, 8, 2, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9814 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 9815 | } |
| 9816 | UPB_INLINE void google_protobuf_FeatureSet_set_repeated_field_encoding(google_protobuf_FeatureSet *msg, int32_t value) { |
Mike Kruskal | 60ec7bf | 2023-08-17 16:44:12 -0700 | [diff] [blame] | 9817 | const upb_MiniTableField field = {3, 12, 3, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9818 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 9819 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9820 | UPB_INLINE void google_protobuf_FeatureSet_set_message_encoding(google_protobuf_FeatureSet *msg, int32_t value) { |
Mike Kruskal | 60ec7bf | 2023-08-17 16:44:12 -0700 | [diff] [blame] | 9821 | const upb_MiniTableField field = {5, 16, 4, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9822 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 9823 | } |
| 9824 | UPB_INLINE void google_protobuf_FeatureSet_set_json_format(google_protobuf_FeatureSet *msg, int32_t value) { |
Mike Kruskal | 60ec7bf | 2023-08-17 16:44:12 -0700 | [diff] [blame] | 9825 | const upb_MiniTableField field = {6, 20, 5, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9826 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 9827 | } |
| 9828 | |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9829 | /* google.protobuf.FeatureSetDefaults */ |
| 9830 | |
| 9831 | UPB_INLINE google_protobuf_FeatureSetDefaults* google_protobuf_FeatureSetDefaults_new(upb_Arena* arena) { |
| 9832 | return (google_protobuf_FeatureSetDefaults*)_upb_Message_New(&google_protobuf_FeatureSetDefaults_msg_init, arena); |
| 9833 | } |
| 9834 | UPB_INLINE google_protobuf_FeatureSetDefaults* google_protobuf_FeatureSetDefaults_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 9835 | google_protobuf_FeatureSetDefaults* ret = google_protobuf_FeatureSetDefaults_new(arena); |
| 9836 | if (!ret) return NULL; |
| 9837 | if (upb_Decode(buf, size, ret, &google_protobuf_FeatureSetDefaults_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { |
| 9838 | return NULL; |
| 9839 | } |
| 9840 | return ret; |
| 9841 | } |
| 9842 | UPB_INLINE google_protobuf_FeatureSetDefaults* google_protobuf_FeatureSetDefaults_parse_ex(const char* buf, size_t size, |
| 9843 | const upb_ExtensionRegistry* extreg, |
| 9844 | int options, upb_Arena* arena) { |
| 9845 | google_protobuf_FeatureSetDefaults* ret = google_protobuf_FeatureSetDefaults_new(arena); |
| 9846 | if (!ret) return NULL; |
| 9847 | if (upb_Decode(buf, size, ret, &google_protobuf_FeatureSetDefaults_msg_init, extreg, options, arena) != |
| 9848 | kUpb_DecodeStatus_Ok) { |
| 9849 | return NULL; |
| 9850 | } |
| 9851 | return ret; |
| 9852 | } |
| 9853 | UPB_INLINE char* google_protobuf_FeatureSetDefaults_serialize(const google_protobuf_FeatureSetDefaults* msg, upb_Arena* arena, size_t* len) { |
| 9854 | char* ptr; |
| 9855 | (void)upb_Encode(msg, &google_protobuf_FeatureSetDefaults_msg_init, 0, arena, &ptr, len); |
| 9856 | return ptr; |
| 9857 | } |
| 9858 | UPB_INLINE char* google_protobuf_FeatureSetDefaults_serialize_ex(const google_protobuf_FeatureSetDefaults* msg, int options, |
| 9859 | upb_Arena* arena, size_t* len) { |
| 9860 | char* ptr; |
| 9861 | (void)upb_Encode(msg, &google_protobuf_FeatureSetDefaults_msg_init, options, arena, &ptr, len); |
| 9862 | return ptr; |
| 9863 | } |
| 9864 | UPB_INLINE void google_protobuf_FeatureSetDefaults_clear_defaults(google_protobuf_FeatureSetDefaults* msg) { |
Protobuf Team Bot | fa98bb3 | 2023-09-01 18:11:09 +0000 | [diff] [blame] | 9865 | const upb_MiniTableField field = {1, UPB_SIZE(4, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9866 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 9867 | } |
| 9868 | UPB_INLINE const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* const* google_protobuf_FeatureSetDefaults_defaults(const google_protobuf_FeatureSetDefaults* msg, size_t* size) { |
Protobuf Team Bot | fa98bb3 | 2023-09-01 18:11:09 +0000 | [diff] [blame] | 9869 | const upb_MiniTableField field = {1, UPB_SIZE(4, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9870 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 9871 | if (arr) { |
| 9872 | if (size) *size = arr->size; |
| 9873 | return (const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* const*)_upb_array_constptr(arr); |
| 9874 | } else { |
| 9875 | if (size) *size = 0; |
| 9876 | return NULL; |
| 9877 | } |
| 9878 | } |
| 9879 | UPB_INLINE const upb_Array* _google_protobuf_FeatureSetDefaults_defaults_upb_array(const google_protobuf_FeatureSetDefaults* msg, size_t* size) { |
Protobuf Team Bot | fa98bb3 | 2023-09-01 18:11:09 +0000 | [diff] [blame] | 9880 | const upb_MiniTableField field = {1, UPB_SIZE(4, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9881 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 9882 | if (size) { |
| 9883 | *size = arr ? arr->size : 0; |
| 9884 | } |
| 9885 | return arr; |
| 9886 | } |
| 9887 | UPB_INLINE upb_Array* _google_protobuf_FeatureSetDefaults_defaults_mutable_upb_array(const google_protobuf_FeatureSetDefaults* msg, size_t* size, upb_Arena* arena) { |
Protobuf Team Bot | fa98bb3 | 2023-09-01 18:11:09 +0000 | [diff] [blame] | 9888 | const upb_MiniTableField field = {1, UPB_SIZE(4, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9889 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 9890 | (upb_Message*)msg, &field, arena); |
| 9891 | if (size) { |
| 9892 | *size = arr ? arr->size : 0; |
| 9893 | } |
| 9894 | return arr; |
| 9895 | } |
| 9896 | UPB_INLINE bool google_protobuf_FeatureSetDefaults_has_defaults(const google_protobuf_FeatureSetDefaults* msg) { |
| 9897 | size_t size; |
| 9898 | google_protobuf_FeatureSetDefaults_defaults(msg, &size); |
| 9899 | return size != 0; |
| 9900 | } |
| 9901 | UPB_INLINE void google_protobuf_FeatureSetDefaults_clear_minimum_edition(google_protobuf_FeatureSetDefaults* msg) { |
Protobuf Team Bot | fa98bb3 | 2023-09-01 18:11:09 +0000 | [diff] [blame] | 9902 | const upb_MiniTableField field = {2, UPB_SIZE(16, 24), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9903 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 9904 | } |
| 9905 | UPB_INLINE upb_StringView google_protobuf_FeatureSetDefaults_minimum_edition(const google_protobuf_FeatureSetDefaults* msg) { |
| 9906 | upb_StringView default_val = upb_StringView_FromString(""); |
| 9907 | upb_StringView ret; |
Protobuf Team Bot | fa98bb3 | 2023-09-01 18:11:09 +0000 | [diff] [blame] | 9908 | const upb_MiniTableField field = {2, UPB_SIZE(16, 24), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9909 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 9910 | return ret; |
| 9911 | } |
| 9912 | UPB_INLINE bool google_protobuf_FeatureSetDefaults_has_minimum_edition(const google_protobuf_FeatureSetDefaults* msg) { |
Protobuf Team Bot | fa98bb3 | 2023-09-01 18:11:09 +0000 | [diff] [blame] | 9913 | const upb_MiniTableField field = {2, UPB_SIZE(16, 24), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9914 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 9915 | } |
| 9916 | UPB_INLINE void google_protobuf_FeatureSetDefaults_clear_maximum_edition(google_protobuf_FeatureSetDefaults* msg) { |
Protobuf Team Bot | fa98bb3 | 2023-09-01 18:11:09 +0000 | [diff] [blame] | 9917 | const upb_MiniTableField field = {3, UPB_SIZE(24, 40), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9918 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 9919 | } |
| 9920 | UPB_INLINE upb_StringView google_protobuf_FeatureSetDefaults_maximum_edition(const google_protobuf_FeatureSetDefaults* msg) { |
| 9921 | upb_StringView default_val = upb_StringView_FromString(""); |
| 9922 | upb_StringView ret; |
Protobuf Team Bot | fa98bb3 | 2023-09-01 18:11:09 +0000 | [diff] [blame] | 9923 | const upb_MiniTableField field = {3, UPB_SIZE(24, 40), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9924 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 9925 | return ret; |
| 9926 | } |
| 9927 | UPB_INLINE bool google_protobuf_FeatureSetDefaults_has_maximum_edition(const google_protobuf_FeatureSetDefaults* msg) { |
Protobuf Team Bot | fa98bb3 | 2023-09-01 18:11:09 +0000 | [diff] [blame] | 9928 | const upb_MiniTableField field = {3, UPB_SIZE(24, 40), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
| 9929 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 9930 | } |
| 9931 | UPB_INLINE void google_protobuf_FeatureSetDefaults_clear_minimum_edition_enum(google_protobuf_FeatureSetDefaults* msg) { |
| 9932 | const upb_MiniTableField field = {4, UPB_SIZE(8, 4), 3, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
| 9933 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 9934 | } |
| 9935 | UPB_INLINE int32_t google_protobuf_FeatureSetDefaults_minimum_edition_enum(const google_protobuf_FeatureSetDefaults* msg) { |
| 9936 | int32_t default_val = 0; |
| 9937 | int32_t ret; |
| 9938 | const upb_MiniTableField field = {4, UPB_SIZE(8, 4), 3, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
| 9939 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 9940 | return ret; |
| 9941 | } |
| 9942 | UPB_INLINE bool google_protobuf_FeatureSetDefaults_has_minimum_edition_enum(const google_protobuf_FeatureSetDefaults* msg) { |
| 9943 | const upb_MiniTableField field = {4, UPB_SIZE(8, 4), 3, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
| 9944 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 9945 | } |
| 9946 | UPB_INLINE void google_protobuf_FeatureSetDefaults_clear_maximum_edition_enum(google_protobuf_FeatureSetDefaults* msg) { |
| 9947 | const upb_MiniTableField field = {5, UPB_SIZE(12, 8), 4, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
| 9948 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 9949 | } |
| 9950 | UPB_INLINE int32_t google_protobuf_FeatureSetDefaults_maximum_edition_enum(const google_protobuf_FeatureSetDefaults* msg) { |
| 9951 | int32_t default_val = 0; |
| 9952 | int32_t ret; |
| 9953 | const upb_MiniTableField field = {5, UPB_SIZE(12, 8), 4, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
| 9954 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 9955 | return ret; |
| 9956 | } |
| 9957 | UPB_INLINE bool google_protobuf_FeatureSetDefaults_has_maximum_edition_enum(const google_protobuf_FeatureSetDefaults* msg) { |
| 9958 | const upb_MiniTableField field = {5, UPB_SIZE(12, 8), 4, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9959 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 9960 | } |
| 9961 | |
| 9962 | UPB_INLINE google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault** google_protobuf_FeatureSetDefaults_mutable_defaults(google_protobuf_FeatureSetDefaults* msg, size_t* size) { |
Protobuf Team Bot | fa98bb3 | 2023-09-01 18:11:09 +0000 | [diff] [blame] | 9963 | upb_MiniTableField field = {1, UPB_SIZE(4, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9964 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 9965 | if (arr) { |
| 9966 | if (size) *size = arr->size; |
| 9967 | return (google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault**)_upb_array_ptr(arr); |
| 9968 | } else { |
| 9969 | if (size) *size = 0; |
| 9970 | return NULL; |
| 9971 | } |
| 9972 | } |
| 9973 | UPB_INLINE google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault** google_protobuf_FeatureSetDefaults_resize_defaults(google_protobuf_FeatureSetDefaults* msg, size_t size, upb_Arena* arena) { |
Protobuf Team Bot | fa98bb3 | 2023-09-01 18:11:09 +0000 | [diff] [blame] | 9974 | upb_MiniTableField field = {1, UPB_SIZE(4, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9975 | return (google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
| 9976 | } |
| 9977 | UPB_INLINE struct google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* google_protobuf_FeatureSetDefaults_add_defaults(google_protobuf_FeatureSetDefaults* msg, upb_Arena* arena) { |
Protobuf Team Bot | fa98bb3 | 2023-09-01 18:11:09 +0000 | [diff] [blame] | 9978 | upb_MiniTableField field = {1, UPB_SIZE(4, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9979 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 9980 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 9981 | return NULL; |
| 9982 | } |
| 9983 | struct google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* sub = (struct google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault*)_upb_Message_New(&google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_msg_init, arena); |
| 9984 | if (!arr || !sub) return NULL; |
| 9985 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
| 9986 | return sub; |
| 9987 | } |
| 9988 | UPB_INLINE void google_protobuf_FeatureSetDefaults_set_minimum_edition(google_protobuf_FeatureSetDefaults *msg, upb_StringView value) { |
Protobuf Team Bot | fa98bb3 | 2023-09-01 18:11:09 +0000 | [diff] [blame] | 9989 | const upb_MiniTableField field = {2, UPB_SIZE(16, 24), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9990 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 9991 | } |
| 9992 | UPB_INLINE void google_protobuf_FeatureSetDefaults_set_maximum_edition(google_protobuf_FeatureSetDefaults *msg, upb_StringView value) { |
Protobuf Team Bot | fa98bb3 | 2023-09-01 18:11:09 +0000 | [diff] [blame] | 9993 | const upb_MiniTableField field = {3, UPB_SIZE(24, 40), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
| 9994 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 9995 | } |
| 9996 | UPB_INLINE void google_protobuf_FeatureSetDefaults_set_minimum_edition_enum(google_protobuf_FeatureSetDefaults *msg, int32_t value) { |
| 9997 | const upb_MiniTableField field = {4, UPB_SIZE(8, 4), 3, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
| 9998 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 9999 | } |
| 10000 | UPB_INLINE void google_protobuf_FeatureSetDefaults_set_maximum_edition_enum(google_protobuf_FeatureSetDefaults *msg, int32_t value) { |
| 10001 | const upb_MiniTableField field = {5, UPB_SIZE(12, 8), 4, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 10002 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 10003 | } |
| 10004 | |
| 10005 | /* google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault */ |
| 10006 | |
| 10007 | UPB_INLINE google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_new(upb_Arena* arena) { |
| 10008 | return (google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault*)_upb_Message_New(&google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_msg_init, arena); |
| 10009 | } |
| 10010 | UPB_INLINE google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 10011 | google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* ret = google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_new(arena); |
| 10012 | if (!ret) return NULL; |
| 10013 | if (upb_Decode(buf, size, ret, &google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { |
| 10014 | return NULL; |
| 10015 | } |
| 10016 | return ret; |
| 10017 | } |
| 10018 | UPB_INLINE google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_parse_ex(const char* buf, size_t size, |
| 10019 | const upb_ExtensionRegistry* extreg, |
| 10020 | int options, upb_Arena* arena) { |
| 10021 | google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* ret = google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_new(arena); |
| 10022 | if (!ret) return NULL; |
| 10023 | if (upb_Decode(buf, size, ret, &google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_msg_init, extreg, options, arena) != |
| 10024 | kUpb_DecodeStatus_Ok) { |
| 10025 | return NULL; |
| 10026 | } |
| 10027 | return ret; |
| 10028 | } |
| 10029 | UPB_INLINE char* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_serialize(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg, upb_Arena* arena, size_t* len) { |
| 10030 | char* ptr; |
| 10031 | (void)upb_Encode(msg, &google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_msg_init, 0, arena, &ptr, len); |
| 10032 | return ptr; |
| 10033 | } |
| 10034 | UPB_INLINE char* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_serialize_ex(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg, int options, |
| 10035 | upb_Arena* arena, size_t* len) { |
| 10036 | char* ptr; |
| 10037 | (void)upb_Encode(msg, &google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_msg_init, options, arena, &ptr, len); |
| 10038 | return ptr; |
| 10039 | } |
| 10040 | UPB_INLINE void google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_clear_edition(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) { |
Protobuf Team Bot | fa98bb3 | 2023-09-01 18:11:09 +0000 | [diff] [blame] | 10041 | const upb_MiniTableField field = {1, UPB_SIZE(12, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 10042 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 10043 | } |
| 10044 | UPB_INLINE upb_StringView google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_edition(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) { |
| 10045 | upb_StringView default_val = upb_StringView_FromString(""); |
| 10046 | upb_StringView ret; |
Protobuf Team Bot | fa98bb3 | 2023-09-01 18:11:09 +0000 | [diff] [blame] | 10047 | const upb_MiniTableField field = {1, UPB_SIZE(12, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 10048 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 10049 | return ret; |
| 10050 | } |
| 10051 | UPB_INLINE bool google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_has_edition(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) { |
Protobuf Team Bot | fa98bb3 | 2023-09-01 18:11:09 +0000 | [diff] [blame] | 10052 | const upb_MiniTableField field = {1, UPB_SIZE(12, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 10053 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 10054 | } |
| 10055 | UPB_INLINE void google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_clear_features(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) { |
| 10056 | const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 2, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
| 10057 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 10058 | } |
| 10059 | UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_features(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) { |
| 10060 | const google_protobuf_FeatureSet* default_val = NULL; |
| 10061 | const google_protobuf_FeatureSet* ret; |
| 10062 | const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 2, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
| 10063 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 10064 | return ret; |
| 10065 | } |
| 10066 | UPB_INLINE bool google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_has_features(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) { |
| 10067 | const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 2, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
| 10068 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 10069 | } |
Protobuf Team Bot | fa98bb3 | 2023-09-01 18:11:09 +0000 | [diff] [blame] | 10070 | UPB_INLINE void google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_clear_edition_enum(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) { |
| 10071 | const upb_MiniTableField field = {3, UPB_SIZE(8, 4), 3, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
| 10072 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 10073 | } |
| 10074 | UPB_INLINE int32_t google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_edition_enum(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) { |
| 10075 | int32_t default_val = 0; |
| 10076 | int32_t ret; |
| 10077 | const upb_MiniTableField field = {3, UPB_SIZE(8, 4), 3, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
| 10078 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 10079 | return ret; |
| 10080 | } |
| 10081 | UPB_INLINE bool google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_has_edition_enum(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) { |
| 10082 | const upb_MiniTableField field = {3, UPB_SIZE(8, 4), 3, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
| 10083 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 10084 | } |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 10085 | |
| 10086 | UPB_INLINE void google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_set_edition(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault *msg, upb_StringView value) { |
Protobuf Team Bot | fa98bb3 | 2023-09-01 18:11:09 +0000 | [diff] [blame] | 10087 | const upb_MiniTableField field = {1, UPB_SIZE(12, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 10088 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 10089 | } |
| 10090 | UPB_INLINE void google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_set_features(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault *msg, google_protobuf_FeatureSet* value) { |
| 10091 | const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 2, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
| 10092 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 10093 | } |
| 10094 | UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_mutable_features(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg, upb_Arena* arena) { |
| 10095 | struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_features(msg); |
| 10096 | if (sub == NULL) { |
| 10097 | sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google_protobuf_FeatureSet_msg_init, arena); |
| 10098 | if (sub) google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_set_features(msg, sub); |
| 10099 | } |
| 10100 | return sub; |
| 10101 | } |
Protobuf Team Bot | fa98bb3 | 2023-09-01 18:11:09 +0000 | [diff] [blame] | 10102 | UPB_INLINE void google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_set_edition_enum(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault *msg, int32_t value) { |
| 10103 | const upb_MiniTableField field = {3, UPB_SIZE(8, 4), 3, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
| 10104 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 10105 | } |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 10106 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10107 | /* google.protobuf.SourceCodeInfo */ |
| 10108 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10109 | UPB_INLINE google_protobuf_SourceCodeInfo* google_protobuf_SourceCodeInfo_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10110 | return (google_protobuf_SourceCodeInfo*)_upb_Message_New(&google_protobuf_SourceCodeInfo_msg_init, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10111 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10112 | UPB_INLINE google_protobuf_SourceCodeInfo* google_protobuf_SourceCodeInfo_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 10113 | google_protobuf_SourceCodeInfo* ret = google_protobuf_SourceCodeInfo_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 10114 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10115 | if (upb_Decode(buf, size, ret, &google_protobuf_SourceCodeInfo_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 10116 | return NULL; |
| 10117 | } |
| 10118 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10119 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10120 | UPB_INLINE google_protobuf_SourceCodeInfo* google_protobuf_SourceCodeInfo_parse_ex(const char* buf, size_t size, |
| 10121 | const upb_ExtensionRegistry* extreg, |
| 10122 | int options, upb_Arena* arena) { |
| 10123 | google_protobuf_SourceCodeInfo* ret = google_protobuf_SourceCodeInfo_new(arena); |
| 10124 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10125 | if (upb_Decode(buf, size, ret, &google_protobuf_SourceCodeInfo_msg_init, extreg, options, arena) != |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10126 | kUpb_DecodeStatus_Ok) { |
| 10127 | return NULL; |
| 10128 | } |
| 10129 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10130 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10131 | UPB_INLINE char* google_protobuf_SourceCodeInfo_serialize(const google_protobuf_SourceCodeInfo* msg, upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10132 | char* ptr; |
| 10133 | (void)upb_Encode(msg, &google_protobuf_SourceCodeInfo_msg_init, 0, arena, &ptr, len); |
| 10134 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10135 | } |
| 10136 | UPB_INLINE char* google_protobuf_SourceCodeInfo_serialize_ex(const google_protobuf_SourceCodeInfo* msg, int options, |
| 10137 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10138 | char* ptr; |
| 10139 | (void)upb_Encode(msg, &google_protobuf_SourceCodeInfo_msg_init, options, arena, &ptr, len); |
| 10140 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10141 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10142 | UPB_INLINE void google_protobuf_SourceCodeInfo_clear_location(google_protobuf_SourceCodeInfo* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10143 | const upb_MiniTableField field = {1, 0, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 10144 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10145 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10146 | UPB_INLINE const google_protobuf_SourceCodeInfo_Location* const* google_protobuf_SourceCodeInfo_location(const google_protobuf_SourceCodeInfo* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10147 | const upb_MiniTableField field = {1, 0, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10148 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 10149 | if (arr) { |
| 10150 | if (size) *size = arr->size; |
| 10151 | return (const google_protobuf_SourceCodeInfo_Location* const*)_upb_array_constptr(arr); |
| 10152 | } else { |
| 10153 | if (size) *size = 0; |
| 10154 | return NULL; |
| 10155 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 10156 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 10157 | UPB_INLINE const upb_Array* _google_protobuf_SourceCodeInfo_location_upb_array(const google_protobuf_SourceCodeInfo* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10158 | const upb_MiniTableField field = {1, 0, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 10159 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 10160 | if (size) { |
| 10161 | *size = arr ? arr->size : 0; |
| 10162 | } |
| 10163 | return arr; |
| 10164 | } |
| 10165 | UPB_INLINE upb_Array* _google_protobuf_SourceCodeInfo_location_mutable_upb_array(const google_protobuf_SourceCodeInfo* msg, size_t* size, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10166 | const upb_MiniTableField field = {1, 0, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 10167 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 10168 | (upb_Message*)msg, &field, arena); |
| 10169 | if (size) { |
| 10170 | *size = arr ? arr->size : 0; |
| 10171 | } |
| 10172 | return arr; |
| 10173 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10174 | UPB_INLINE bool google_protobuf_SourceCodeInfo_has_location(const google_protobuf_SourceCodeInfo* msg) { |
| 10175 | size_t size; |
| 10176 | google_protobuf_SourceCodeInfo_location(msg, &size); |
| 10177 | return size != 0; |
| 10178 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10179 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10180 | UPB_INLINE google_protobuf_SourceCodeInfo_Location** google_protobuf_SourceCodeInfo_mutable_location(google_protobuf_SourceCodeInfo* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10181 | upb_MiniTableField field = {1, 0, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10182 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 10183 | if (arr) { |
| 10184 | if (size) *size = arr->size; |
| 10185 | return (google_protobuf_SourceCodeInfo_Location**)_upb_array_ptr(arr); |
| 10186 | } else { |
| 10187 | if (size) *size = 0; |
| 10188 | return NULL; |
| 10189 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10190 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10191 | UPB_INLINE google_protobuf_SourceCodeInfo_Location** google_protobuf_SourceCodeInfo_resize_location(google_protobuf_SourceCodeInfo* msg, size_t size, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10192 | upb_MiniTableField field = {1, 0, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Jie Luo | f36a5c6 | 2023-05-23 17:56:18 -0700 | [diff] [blame] | 10193 | return (google_protobuf_SourceCodeInfo_Location**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10194 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 10195 | UPB_INLINE struct google_protobuf_SourceCodeInfo_Location* google_protobuf_SourceCodeInfo_add_location(google_protobuf_SourceCodeInfo* msg, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10196 | upb_MiniTableField field = {1, 0, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10197 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 10198 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 10199 | return NULL; |
| 10200 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10201 | struct google_protobuf_SourceCodeInfo_Location* sub = (struct google_protobuf_SourceCodeInfo_Location*)_upb_Message_New(&google_protobuf_SourceCodeInfo_Location_msg_init, arena); |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10202 | if (!arr || !sub) return NULL; |
| 10203 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10204 | return sub; |
| 10205 | } |
| 10206 | |
| 10207 | /* google.protobuf.SourceCodeInfo.Location */ |
| 10208 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10209 | UPB_INLINE google_protobuf_SourceCodeInfo_Location* google_protobuf_SourceCodeInfo_Location_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10210 | return (google_protobuf_SourceCodeInfo_Location*)_upb_Message_New(&google_protobuf_SourceCodeInfo_Location_msg_init, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10211 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10212 | UPB_INLINE google_protobuf_SourceCodeInfo_Location* google_protobuf_SourceCodeInfo_Location_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 10213 | google_protobuf_SourceCodeInfo_Location* ret = google_protobuf_SourceCodeInfo_Location_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 10214 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10215 | if (upb_Decode(buf, size, ret, &google_protobuf_SourceCodeInfo_Location_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 10216 | return NULL; |
| 10217 | } |
| 10218 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10219 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10220 | UPB_INLINE google_protobuf_SourceCodeInfo_Location* google_protobuf_SourceCodeInfo_Location_parse_ex(const char* buf, size_t size, |
| 10221 | const upb_ExtensionRegistry* extreg, |
| 10222 | int options, upb_Arena* arena) { |
| 10223 | google_protobuf_SourceCodeInfo_Location* ret = google_protobuf_SourceCodeInfo_Location_new(arena); |
| 10224 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10225 | if (upb_Decode(buf, size, ret, &google_protobuf_SourceCodeInfo_Location_msg_init, extreg, options, arena) != |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10226 | kUpb_DecodeStatus_Ok) { |
| 10227 | return NULL; |
| 10228 | } |
| 10229 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10230 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10231 | UPB_INLINE char* google_protobuf_SourceCodeInfo_Location_serialize(const google_protobuf_SourceCodeInfo_Location* msg, upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10232 | char* ptr; |
| 10233 | (void)upb_Encode(msg, &google_protobuf_SourceCodeInfo_Location_msg_init, 0, arena, &ptr, len); |
| 10234 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10235 | } |
| 10236 | UPB_INLINE char* google_protobuf_SourceCodeInfo_Location_serialize_ex(const google_protobuf_SourceCodeInfo_Location* msg, int options, |
| 10237 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10238 | char* ptr; |
| 10239 | (void)upb_Encode(msg, &google_protobuf_SourceCodeInfo_Location_msg_init, options, arena, &ptr, len); |
| 10240 | return ptr; |
| 10241 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10242 | UPB_INLINE void google_protobuf_SourceCodeInfo_Location_clear_path(google_protobuf_SourceCodeInfo_Location* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10243 | const upb_MiniTableField field = {1, UPB_SIZE(4, 8), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 10244 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10245 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10246 | UPB_INLINE int32_t const* google_protobuf_SourceCodeInfo_Location_path(const google_protobuf_SourceCodeInfo_Location* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10247 | const upb_MiniTableField field = {1, UPB_SIZE(4, 8), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10248 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 10249 | if (arr) { |
| 10250 | if (size) *size = arr->size; |
| 10251 | return (int32_t const*)_upb_array_constptr(arr); |
| 10252 | } else { |
| 10253 | if (size) *size = 0; |
| 10254 | return NULL; |
| 10255 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10256 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 10257 | UPB_INLINE const upb_Array* _google_protobuf_SourceCodeInfo_Location_path_upb_array(const google_protobuf_SourceCodeInfo_Location* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10258 | const upb_MiniTableField field = {1, UPB_SIZE(4, 8), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 10259 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 10260 | if (size) { |
| 10261 | *size = arr ? arr->size : 0; |
| 10262 | } |
| 10263 | return arr; |
| 10264 | } |
| 10265 | UPB_INLINE upb_Array* _google_protobuf_SourceCodeInfo_Location_path_mutable_upb_array(const google_protobuf_SourceCodeInfo_Location* msg, size_t* size, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10266 | const upb_MiniTableField field = {1, UPB_SIZE(4, 8), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 10267 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 10268 | (upb_Message*)msg, &field, arena); |
| 10269 | if (size) { |
| 10270 | *size = arr ? arr->size : 0; |
| 10271 | } |
| 10272 | return arr; |
| 10273 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10274 | UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_has_path(const google_protobuf_SourceCodeInfo_Location* msg) { |
| 10275 | size_t size; |
| 10276 | google_protobuf_SourceCodeInfo_Location_path(msg, &size); |
| 10277 | return size != 0; |
| 10278 | } |
| 10279 | UPB_INLINE void google_protobuf_SourceCodeInfo_Location_clear_span(google_protobuf_SourceCodeInfo_Location* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10280 | const upb_MiniTableField field = {2, UPB_SIZE(8, 16), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 10281 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 10282 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10283 | UPB_INLINE int32_t const* google_protobuf_SourceCodeInfo_Location_span(const google_protobuf_SourceCodeInfo_Location* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10284 | const upb_MiniTableField field = {2, UPB_SIZE(8, 16), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10285 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 10286 | if (arr) { |
| 10287 | if (size) *size = arr->size; |
| 10288 | return (int32_t const*)_upb_array_constptr(arr); |
| 10289 | } else { |
| 10290 | if (size) *size = 0; |
| 10291 | return NULL; |
| 10292 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 10293 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 10294 | UPB_INLINE const upb_Array* _google_protobuf_SourceCodeInfo_Location_span_upb_array(const google_protobuf_SourceCodeInfo_Location* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10295 | const upb_MiniTableField field = {2, UPB_SIZE(8, 16), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 10296 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 10297 | if (size) { |
| 10298 | *size = arr ? arr->size : 0; |
| 10299 | } |
| 10300 | return arr; |
| 10301 | } |
| 10302 | UPB_INLINE upb_Array* _google_protobuf_SourceCodeInfo_Location_span_mutable_upb_array(const google_protobuf_SourceCodeInfo_Location* msg, size_t* size, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10303 | const upb_MiniTableField field = {2, UPB_SIZE(8, 16), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 10304 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 10305 | (upb_Message*)msg, &field, arena); |
| 10306 | if (size) { |
| 10307 | *size = arr ? arr->size : 0; |
| 10308 | } |
| 10309 | return arr; |
| 10310 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10311 | UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_has_span(const google_protobuf_SourceCodeInfo_Location* msg) { |
| 10312 | size_t size; |
| 10313 | google_protobuf_SourceCodeInfo_Location_span(msg, &size); |
| 10314 | return size != 0; |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 10315 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10316 | UPB_INLINE void google_protobuf_SourceCodeInfo_Location_clear_leading_comments(google_protobuf_SourceCodeInfo_Location* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10317 | const upb_MiniTableField field = {3, UPB_SIZE(16, 24), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 10318 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10319 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10320 | UPB_INLINE upb_StringView google_protobuf_SourceCodeInfo_Location_leading_comments(const google_protobuf_SourceCodeInfo_Location* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10321 | upb_StringView default_val = upb_StringView_FromString(""); |
| 10322 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10323 | const upb_MiniTableField field = {3, UPB_SIZE(16, 24), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 10324 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10325 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10326 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10327 | UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_has_leading_comments(const google_protobuf_SourceCodeInfo_Location* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10328 | const upb_MiniTableField field = {3, UPB_SIZE(16, 24), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 10329 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 10330 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10331 | UPB_INLINE void google_protobuf_SourceCodeInfo_Location_clear_trailing_comments(google_protobuf_SourceCodeInfo_Location* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10332 | const upb_MiniTableField field = {4, UPB_SIZE(24, 40), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 10333 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10334 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10335 | UPB_INLINE upb_StringView google_protobuf_SourceCodeInfo_Location_trailing_comments(const google_protobuf_SourceCodeInfo_Location* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10336 | upb_StringView default_val = upb_StringView_FromString(""); |
| 10337 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10338 | const upb_MiniTableField field = {4, UPB_SIZE(24, 40), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 10339 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10340 | return ret; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10341 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10342 | UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_has_trailing_comments(const google_protobuf_SourceCodeInfo_Location* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10343 | const upb_MiniTableField field = {4, UPB_SIZE(24, 40), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 10344 | return _upb_Message_HasNonExtensionField(msg, &field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10345 | } |
| 10346 | UPB_INLINE void google_protobuf_SourceCodeInfo_Location_clear_leading_detached_comments(google_protobuf_SourceCodeInfo_Location* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10347 | const upb_MiniTableField field = {6, UPB_SIZE(12, 56), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 10348 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10349 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10350 | UPB_INLINE upb_StringView const* google_protobuf_SourceCodeInfo_Location_leading_detached_comments(const google_protobuf_SourceCodeInfo_Location* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10351 | const upb_MiniTableField field = {6, UPB_SIZE(12, 56), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10352 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 10353 | if (arr) { |
| 10354 | if (size) *size = arr->size; |
| 10355 | return (upb_StringView const*)_upb_array_constptr(arr); |
| 10356 | } else { |
| 10357 | if (size) *size = 0; |
| 10358 | return NULL; |
| 10359 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 10360 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 10361 | UPB_INLINE const upb_Array* _google_protobuf_SourceCodeInfo_Location_leading_detached_comments_upb_array(const google_protobuf_SourceCodeInfo_Location* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10362 | const upb_MiniTableField field = {6, UPB_SIZE(12, 56), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 10363 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 10364 | if (size) { |
| 10365 | *size = arr ? arr->size : 0; |
| 10366 | } |
| 10367 | return arr; |
| 10368 | } |
| 10369 | UPB_INLINE upb_Array* _google_protobuf_SourceCodeInfo_Location_leading_detached_comments_mutable_upb_array(const google_protobuf_SourceCodeInfo_Location* msg, size_t* size, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10370 | const upb_MiniTableField field = {6, UPB_SIZE(12, 56), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 10371 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 10372 | (upb_Message*)msg, &field, arena); |
| 10373 | if (size) { |
| 10374 | *size = arr ? arr->size : 0; |
| 10375 | } |
| 10376 | return arr; |
| 10377 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10378 | UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_has_leading_detached_comments(const google_protobuf_SourceCodeInfo_Location* msg) { |
| 10379 | size_t size; |
| 10380 | google_protobuf_SourceCodeInfo_Location_leading_detached_comments(msg, &size); |
| 10381 | return size != 0; |
| 10382 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10383 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10384 | UPB_INLINE int32_t* google_protobuf_SourceCodeInfo_Location_mutable_path(google_protobuf_SourceCodeInfo_Location* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10385 | upb_MiniTableField field = {1, UPB_SIZE(4, 8), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10386 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 10387 | if (arr) { |
| 10388 | if (size) *size = arr->size; |
| 10389 | return (int32_t*)_upb_array_ptr(arr); |
| 10390 | } else { |
| 10391 | if (size) *size = 0; |
| 10392 | return NULL; |
| 10393 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10394 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10395 | UPB_INLINE int32_t* google_protobuf_SourceCodeInfo_Location_resize_path(google_protobuf_SourceCodeInfo_Location* msg, size_t size, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10396 | upb_MiniTableField field = {1, UPB_SIZE(4, 8), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Jie Luo | f36a5c6 | 2023-05-23 17:56:18 -0700 | [diff] [blame] | 10397 | return (int32_t*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10398 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 10399 | UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_add_path(google_protobuf_SourceCodeInfo_Location* msg, int32_t val, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10400 | upb_MiniTableField field = {1, UPB_SIZE(4, 8), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10401 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 10402 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 10403 | return false; |
| 10404 | } |
| 10405 | _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val)); |
| 10406 | return true; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10407 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10408 | UPB_INLINE int32_t* google_protobuf_SourceCodeInfo_Location_mutable_span(google_protobuf_SourceCodeInfo_Location* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10409 | upb_MiniTableField field = {2, UPB_SIZE(8, 16), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10410 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 10411 | if (arr) { |
| 10412 | if (size) *size = arr->size; |
| 10413 | return (int32_t*)_upb_array_ptr(arr); |
| 10414 | } else { |
| 10415 | if (size) *size = 0; |
| 10416 | return NULL; |
| 10417 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10418 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10419 | UPB_INLINE int32_t* google_protobuf_SourceCodeInfo_Location_resize_span(google_protobuf_SourceCodeInfo_Location* msg, size_t size, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10420 | upb_MiniTableField field = {2, UPB_SIZE(8, 16), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Jie Luo | f36a5c6 | 2023-05-23 17:56:18 -0700 | [diff] [blame] | 10421 | return (int32_t*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10422 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 10423 | UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_add_span(google_protobuf_SourceCodeInfo_Location* msg, int32_t val, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10424 | upb_MiniTableField field = {2, UPB_SIZE(8, 16), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10425 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 10426 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 10427 | return false; |
| 10428 | } |
| 10429 | _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val)); |
| 10430 | return true; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10431 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10432 | UPB_INLINE void google_protobuf_SourceCodeInfo_Location_set_leading_comments(google_protobuf_SourceCodeInfo_Location *msg, upb_StringView value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10433 | const upb_MiniTableField field = {3, UPB_SIZE(16, 24), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 10434 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 10435 | } |
| 10436 | UPB_INLINE void google_protobuf_SourceCodeInfo_Location_set_trailing_comments(google_protobuf_SourceCodeInfo_Location *msg, upb_StringView value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10437 | const upb_MiniTableField field = {4, UPB_SIZE(24, 40), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 10438 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 10439 | } |
| 10440 | UPB_INLINE upb_StringView* google_protobuf_SourceCodeInfo_Location_mutable_leading_detached_comments(google_protobuf_SourceCodeInfo_Location* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10441 | upb_MiniTableField field = {6, UPB_SIZE(12, 56), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10442 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 10443 | if (arr) { |
| 10444 | if (size) *size = arr->size; |
| 10445 | return (upb_StringView*)_upb_array_ptr(arr); |
| 10446 | } else { |
| 10447 | if (size) *size = 0; |
| 10448 | return NULL; |
| 10449 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10450 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10451 | UPB_INLINE upb_StringView* google_protobuf_SourceCodeInfo_Location_resize_leading_detached_comments(google_protobuf_SourceCodeInfo_Location* msg, size_t size, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10452 | upb_MiniTableField field = {6, UPB_SIZE(12, 56), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Jie Luo | f36a5c6 | 2023-05-23 17:56:18 -0700 | [diff] [blame] | 10453 | return (upb_StringView*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10454 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 10455 | UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_add_leading_detached_comments(google_protobuf_SourceCodeInfo_Location* msg, upb_StringView val, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10456 | upb_MiniTableField field = {6, UPB_SIZE(12, 56), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10457 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 10458 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 10459 | return false; |
| 10460 | } |
| 10461 | _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val)); |
| 10462 | return true; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10463 | } |
| 10464 | |
| 10465 | /* google.protobuf.GeneratedCodeInfo */ |
| 10466 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10467 | UPB_INLINE google_protobuf_GeneratedCodeInfo* google_protobuf_GeneratedCodeInfo_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10468 | return (google_protobuf_GeneratedCodeInfo*)_upb_Message_New(&google_protobuf_GeneratedCodeInfo_msg_init, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10469 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10470 | UPB_INLINE google_protobuf_GeneratedCodeInfo* google_protobuf_GeneratedCodeInfo_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 10471 | google_protobuf_GeneratedCodeInfo* ret = google_protobuf_GeneratedCodeInfo_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 10472 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10473 | if (upb_Decode(buf, size, ret, &google_protobuf_GeneratedCodeInfo_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 10474 | return NULL; |
| 10475 | } |
| 10476 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10477 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10478 | UPB_INLINE google_protobuf_GeneratedCodeInfo* google_protobuf_GeneratedCodeInfo_parse_ex(const char* buf, size_t size, |
| 10479 | const upb_ExtensionRegistry* extreg, |
| 10480 | int options, upb_Arena* arena) { |
| 10481 | google_protobuf_GeneratedCodeInfo* ret = google_protobuf_GeneratedCodeInfo_new(arena); |
| 10482 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10483 | if (upb_Decode(buf, size, ret, &google_protobuf_GeneratedCodeInfo_msg_init, extreg, options, arena) != |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10484 | kUpb_DecodeStatus_Ok) { |
| 10485 | return NULL; |
| 10486 | } |
| 10487 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10488 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10489 | UPB_INLINE char* google_protobuf_GeneratedCodeInfo_serialize(const google_protobuf_GeneratedCodeInfo* msg, upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10490 | char* ptr; |
| 10491 | (void)upb_Encode(msg, &google_protobuf_GeneratedCodeInfo_msg_init, 0, arena, &ptr, len); |
| 10492 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10493 | } |
| 10494 | UPB_INLINE char* google_protobuf_GeneratedCodeInfo_serialize_ex(const google_protobuf_GeneratedCodeInfo* msg, int options, |
| 10495 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10496 | char* ptr; |
| 10497 | (void)upb_Encode(msg, &google_protobuf_GeneratedCodeInfo_msg_init, options, arena, &ptr, len); |
| 10498 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10499 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10500 | UPB_INLINE void google_protobuf_GeneratedCodeInfo_clear_annotation(google_protobuf_GeneratedCodeInfo* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10501 | const upb_MiniTableField field = {1, 0, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 10502 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10503 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10504 | UPB_INLINE const google_protobuf_GeneratedCodeInfo_Annotation* const* google_protobuf_GeneratedCodeInfo_annotation(const google_protobuf_GeneratedCodeInfo* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10505 | const upb_MiniTableField field = {1, 0, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10506 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 10507 | if (arr) { |
| 10508 | if (size) *size = arr->size; |
| 10509 | return (const google_protobuf_GeneratedCodeInfo_Annotation* const*)_upb_array_constptr(arr); |
| 10510 | } else { |
| 10511 | if (size) *size = 0; |
| 10512 | return NULL; |
| 10513 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 10514 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 10515 | UPB_INLINE const upb_Array* _google_protobuf_GeneratedCodeInfo_annotation_upb_array(const google_protobuf_GeneratedCodeInfo* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10516 | const upb_MiniTableField field = {1, 0, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 10517 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 10518 | if (size) { |
| 10519 | *size = arr ? arr->size : 0; |
| 10520 | } |
| 10521 | return arr; |
| 10522 | } |
| 10523 | UPB_INLINE upb_Array* _google_protobuf_GeneratedCodeInfo_annotation_mutable_upb_array(const google_protobuf_GeneratedCodeInfo* msg, size_t* size, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10524 | const upb_MiniTableField field = {1, 0, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 10525 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 10526 | (upb_Message*)msg, &field, arena); |
| 10527 | if (size) { |
| 10528 | *size = arr ? arr->size : 0; |
| 10529 | } |
| 10530 | return arr; |
| 10531 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10532 | UPB_INLINE bool google_protobuf_GeneratedCodeInfo_has_annotation(const google_protobuf_GeneratedCodeInfo* msg) { |
| 10533 | size_t size; |
| 10534 | google_protobuf_GeneratedCodeInfo_annotation(msg, &size); |
| 10535 | return size != 0; |
| 10536 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10537 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10538 | UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation** google_protobuf_GeneratedCodeInfo_mutable_annotation(google_protobuf_GeneratedCodeInfo* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10539 | upb_MiniTableField field = {1, 0, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10540 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 10541 | if (arr) { |
| 10542 | if (size) *size = arr->size; |
| 10543 | return (google_protobuf_GeneratedCodeInfo_Annotation**)_upb_array_ptr(arr); |
| 10544 | } else { |
| 10545 | if (size) *size = 0; |
| 10546 | return NULL; |
| 10547 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10548 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10549 | UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation** google_protobuf_GeneratedCodeInfo_resize_annotation(google_protobuf_GeneratedCodeInfo* msg, size_t size, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10550 | upb_MiniTableField field = {1, 0, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Jie Luo | f36a5c6 | 2023-05-23 17:56:18 -0700 | [diff] [blame] | 10551 | return (google_protobuf_GeneratedCodeInfo_Annotation**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10552 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 10553 | UPB_INLINE struct google_protobuf_GeneratedCodeInfo_Annotation* google_protobuf_GeneratedCodeInfo_add_annotation(google_protobuf_GeneratedCodeInfo* msg, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10554 | upb_MiniTableField field = {1, 0, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10555 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 10556 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 10557 | return NULL; |
| 10558 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10559 | struct google_protobuf_GeneratedCodeInfo_Annotation* sub = (struct google_protobuf_GeneratedCodeInfo_Annotation*)_upb_Message_New(&google_protobuf_GeneratedCodeInfo_Annotation_msg_init, arena); |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10560 | if (!arr || !sub) return NULL; |
| 10561 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10562 | return sub; |
| 10563 | } |
| 10564 | |
| 10565 | /* google.protobuf.GeneratedCodeInfo.Annotation */ |
| 10566 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10567 | UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation* google_protobuf_GeneratedCodeInfo_Annotation_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10568 | return (google_protobuf_GeneratedCodeInfo_Annotation*)_upb_Message_New(&google_protobuf_GeneratedCodeInfo_Annotation_msg_init, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10569 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10570 | UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation* google_protobuf_GeneratedCodeInfo_Annotation_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 10571 | google_protobuf_GeneratedCodeInfo_Annotation* ret = google_protobuf_GeneratedCodeInfo_Annotation_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 10572 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10573 | if (upb_Decode(buf, size, ret, &google_protobuf_GeneratedCodeInfo_Annotation_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 10574 | return NULL; |
| 10575 | } |
| 10576 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10577 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10578 | UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation* google_protobuf_GeneratedCodeInfo_Annotation_parse_ex(const char* buf, size_t size, |
| 10579 | const upb_ExtensionRegistry* extreg, |
| 10580 | int options, upb_Arena* arena) { |
| 10581 | google_protobuf_GeneratedCodeInfo_Annotation* ret = google_protobuf_GeneratedCodeInfo_Annotation_new(arena); |
| 10582 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10583 | if (upb_Decode(buf, size, ret, &google_protobuf_GeneratedCodeInfo_Annotation_msg_init, extreg, options, arena) != |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10584 | kUpb_DecodeStatus_Ok) { |
| 10585 | return NULL; |
| 10586 | } |
| 10587 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10588 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10589 | UPB_INLINE char* google_protobuf_GeneratedCodeInfo_Annotation_serialize(const google_protobuf_GeneratedCodeInfo_Annotation* msg, upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10590 | char* ptr; |
| 10591 | (void)upb_Encode(msg, &google_protobuf_GeneratedCodeInfo_Annotation_msg_init, 0, arena, &ptr, len); |
| 10592 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10593 | } |
| 10594 | UPB_INLINE char* google_protobuf_GeneratedCodeInfo_Annotation_serialize_ex(const google_protobuf_GeneratedCodeInfo_Annotation* msg, int options, |
| 10595 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10596 | char* ptr; |
| 10597 | (void)upb_Encode(msg, &google_protobuf_GeneratedCodeInfo_Annotation_msg_init, options, arena, &ptr, len); |
| 10598 | return ptr; |
| 10599 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10600 | UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_clear_path(google_protobuf_GeneratedCodeInfo_Annotation* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10601 | const upb_MiniTableField field = {1, UPB_SIZE(4, 16), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 10602 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10603 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10604 | UPB_INLINE int32_t const* google_protobuf_GeneratedCodeInfo_Annotation_path(const google_protobuf_GeneratedCodeInfo_Annotation* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10605 | const upb_MiniTableField field = {1, UPB_SIZE(4, 16), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10606 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 10607 | if (arr) { |
| 10608 | if (size) *size = arr->size; |
| 10609 | return (int32_t const*)_upb_array_constptr(arr); |
| 10610 | } else { |
| 10611 | if (size) *size = 0; |
| 10612 | return NULL; |
| 10613 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 10614 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 10615 | UPB_INLINE const upb_Array* _google_protobuf_GeneratedCodeInfo_Annotation_path_upb_array(const google_protobuf_GeneratedCodeInfo_Annotation* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10616 | const upb_MiniTableField field = {1, UPB_SIZE(4, 16), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 10617 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 10618 | if (size) { |
| 10619 | *size = arr ? arr->size : 0; |
| 10620 | } |
| 10621 | return arr; |
| 10622 | } |
| 10623 | UPB_INLINE upb_Array* _google_protobuf_GeneratedCodeInfo_Annotation_path_mutable_upb_array(const google_protobuf_GeneratedCodeInfo_Annotation* msg, size_t* size, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10624 | const upb_MiniTableField field = {1, UPB_SIZE(4, 16), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 10625 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 10626 | (upb_Message*)msg, &field, arena); |
| 10627 | if (size) { |
| 10628 | *size = arr ? arr->size : 0; |
| 10629 | } |
| 10630 | return arr; |
| 10631 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10632 | UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_path(const google_protobuf_GeneratedCodeInfo_Annotation* msg) { |
| 10633 | size_t size; |
| 10634 | google_protobuf_GeneratedCodeInfo_Annotation_path(msg, &size); |
| 10635 | return size != 0; |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 10636 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10637 | UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_clear_source_file(google_protobuf_GeneratedCodeInfo_Annotation* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10638 | const upb_MiniTableField field = {2, UPB_SIZE(20, 24), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 10639 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10640 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10641 | UPB_INLINE upb_StringView google_protobuf_GeneratedCodeInfo_Annotation_source_file(const google_protobuf_GeneratedCodeInfo_Annotation* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10642 | upb_StringView default_val = upb_StringView_FromString(""); |
| 10643 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10644 | const upb_MiniTableField field = {2, UPB_SIZE(20, 24), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 10645 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10646 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10647 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10648 | UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_source_file(const google_protobuf_GeneratedCodeInfo_Annotation* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10649 | const upb_MiniTableField field = {2, UPB_SIZE(20, 24), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 10650 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 10651 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10652 | UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_clear_begin(google_protobuf_GeneratedCodeInfo_Annotation* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10653 | const upb_MiniTableField field = {3, UPB_SIZE(8, 4), 2, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 10654 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10655 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10656 | UPB_INLINE int32_t google_protobuf_GeneratedCodeInfo_Annotation_begin(const google_protobuf_GeneratedCodeInfo_Annotation* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10657 | int32_t default_val = (int32_t)0; |
| 10658 | int32_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10659 | const upb_MiniTableField field = {3, UPB_SIZE(8, 4), 2, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 10660 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10661 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10662 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10663 | UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_begin(const google_protobuf_GeneratedCodeInfo_Annotation* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10664 | const upb_MiniTableField field = {3, UPB_SIZE(8, 4), 2, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 10665 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 10666 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10667 | UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_clear_end(google_protobuf_GeneratedCodeInfo_Annotation* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10668 | const upb_MiniTableField field = {4, UPB_SIZE(12, 8), 3, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 10669 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10670 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10671 | UPB_INLINE int32_t google_protobuf_GeneratedCodeInfo_Annotation_end(const google_protobuf_GeneratedCodeInfo_Annotation* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10672 | int32_t default_val = (int32_t)0; |
| 10673 | int32_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10674 | const upb_MiniTableField field = {4, UPB_SIZE(12, 8), 3, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 10675 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10676 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10677 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10678 | UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_end(const google_protobuf_GeneratedCodeInfo_Annotation* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10679 | const upb_MiniTableField field = {4, UPB_SIZE(12, 8), 3, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 10680 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10681 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10682 | UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_clear_semantic(google_protobuf_GeneratedCodeInfo_Annotation* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10683 | const upb_MiniTableField field = {5, UPB_SIZE(16, 12), 4, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 10684 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10685 | } |
| 10686 | UPB_INLINE int32_t google_protobuf_GeneratedCodeInfo_Annotation_semantic(const google_protobuf_GeneratedCodeInfo_Annotation* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10687 | int32_t default_val = 0; |
| 10688 | int32_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10689 | const upb_MiniTableField field = {5, UPB_SIZE(16, 12), 4, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 10690 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10691 | return ret; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10692 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10693 | UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_semantic(const google_protobuf_GeneratedCodeInfo_Annotation* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10694 | const upb_MiniTableField field = {5, UPB_SIZE(16, 12), 4, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 10695 | return _upb_Message_HasNonExtensionField(msg, &field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10696 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10697 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10698 | UPB_INLINE int32_t* google_protobuf_GeneratedCodeInfo_Annotation_mutable_path(google_protobuf_GeneratedCodeInfo_Annotation* msg, size_t* size) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10699 | upb_MiniTableField field = {1, UPB_SIZE(4, 16), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10700 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 10701 | if (arr) { |
| 10702 | if (size) *size = arr->size; |
| 10703 | return (int32_t*)_upb_array_ptr(arr); |
| 10704 | } else { |
| 10705 | if (size) *size = 0; |
| 10706 | return NULL; |
| 10707 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10708 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10709 | UPB_INLINE int32_t* google_protobuf_GeneratedCodeInfo_Annotation_resize_path(google_protobuf_GeneratedCodeInfo_Annotation* msg, size_t size, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10710 | upb_MiniTableField field = {1, UPB_SIZE(4, 16), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Jie Luo | f36a5c6 | 2023-05-23 17:56:18 -0700 | [diff] [blame] | 10711 | return (int32_t*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10712 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 10713 | UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_add_path(google_protobuf_GeneratedCodeInfo_Annotation* msg, int32_t val, upb_Arena* arena) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10714 | upb_MiniTableField field = {1, UPB_SIZE(4, 16), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10715 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 10716 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 10717 | return false; |
| 10718 | } |
| 10719 | _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val)); |
| 10720 | return true; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10721 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10722 | UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_set_source_file(google_protobuf_GeneratedCodeInfo_Annotation *msg, upb_StringView value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10723 | const upb_MiniTableField field = {2, UPB_SIZE(20, 24), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 10724 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 10725 | } |
| 10726 | UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_set_begin(google_protobuf_GeneratedCodeInfo_Annotation *msg, int32_t value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10727 | const upb_MiniTableField field = {3, UPB_SIZE(8, 4), 2, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 10728 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 10729 | } |
| 10730 | UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_set_end(google_protobuf_GeneratedCodeInfo_Annotation *msg, int32_t value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10731 | const upb_MiniTableField field = {4, UPB_SIZE(12, 8), 3, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 10732 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 10733 | } |
| 10734 | UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_set_semantic(google_protobuf_GeneratedCodeInfo_Annotation *msg, int32_t value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10735 | const upb_MiniTableField field = {5, UPB_SIZE(16, 12), 4, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 10736 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10737 | } |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 10738 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10739 | /* Max size 32 is google.protobuf.FileOptions */ |
| 10740 | /* Max size 64 is google.protobuf.FileOptions */ |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 10741 | #define _UPB_MAXOPT_SIZE UPB_SIZE(112, 200) |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10742 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10743 | #ifdef __cplusplus |
| 10744 | } /* extern "C" */ |
| 10745 | #endif |
| 10746 | |
| 10747 | |
| 10748 | #endif /* GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_H_ */ |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 10749 | // end:github_only |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10750 | |
Protobuf Team Bot | 7dabac9 | 2023-09-07 18:35:50 +0000 | [diff] [blame] | 10751 | typedef enum { |
| 10752 | kUpb_Syntax_Proto2 = 2, |
| 10753 | kUpb_Syntax_Proto3 = 3, |
| 10754 | kUpb_Syntax_Editions = 99 |
| 10755 | } upb_Syntax; |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10756 | |
| 10757 | // Forward declarations for circular references. |
| 10758 | typedef struct upb_DefPool upb_DefPool; |
| 10759 | typedef struct upb_EnumDef upb_EnumDef; |
| 10760 | typedef struct upb_EnumReservedRange upb_EnumReservedRange; |
| 10761 | typedef struct upb_EnumValueDef upb_EnumValueDef; |
| 10762 | typedef struct upb_ExtensionRange upb_ExtensionRange; |
| 10763 | typedef struct upb_FieldDef upb_FieldDef; |
| 10764 | typedef struct upb_FileDef upb_FileDef; |
| 10765 | typedef struct upb_MessageDef upb_MessageDef; |
| 10766 | typedef struct upb_MessageReservedRange upb_MessageReservedRange; |
| 10767 | typedef struct upb_MethodDef upb_MethodDef; |
| 10768 | typedef struct upb_OneofDef upb_OneofDef; |
| 10769 | typedef struct upb_ServiceDef upb_ServiceDef; |
| 10770 | |
| 10771 | // EVERYTHING BELOW THIS LINE IS INTERNAL - DO NOT USE ///////////////////////// |
| 10772 | |
| 10773 | typedef struct upb_DefBuilder upb_DefBuilder; |
| 10774 | |
| 10775 | #endif /* UPB_REFLECTION_COMMON_H_ */ |
| 10776 | |
| 10777 | #ifndef UPB_REFLECTION_DEF_TYPE_H_ |
| 10778 | #define UPB_REFLECTION_DEF_TYPE_H_ |
| 10779 | |
| 10780 | |
| 10781 | // Must be last. |
| 10782 | |
| 10783 | // Inside a symtab we store tagged pointers to specific def types. |
| 10784 | typedef enum { |
| 10785 | UPB_DEFTYPE_MASK = 7, |
| 10786 | |
| 10787 | // Only inside symtab table. |
| 10788 | UPB_DEFTYPE_EXT = 0, |
| 10789 | UPB_DEFTYPE_MSG = 1, |
| 10790 | UPB_DEFTYPE_ENUM = 2, |
| 10791 | UPB_DEFTYPE_ENUMVAL = 3, |
| 10792 | UPB_DEFTYPE_SERVICE = 4, |
| 10793 | |
| 10794 | // Only inside message table. |
| 10795 | UPB_DEFTYPE_FIELD = 0, |
| 10796 | UPB_DEFTYPE_ONEOF = 1, |
| 10797 | UPB_DEFTYPE_FIELD_JSONNAME = 2, |
| 10798 | } upb_deftype_t; |
| 10799 | |
| 10800 | #ifdef __cplusplus |
| 10801 | extern "C" { |
| 10802 | #endif |
| 10803 | |
| 10804 | // Our 3-bit pointer tagging requires all pointers to be multiples of 8. |
| 10805 | // The arena will always yield 8-byte-aligned addresses, however we put |
| 10806 | // the defs into arrays. For each element in the array to be 8-byte-aligned, |
| 10807 | // the sizes of each def type must also be a multiple of 8. |
| 10808 | // |
| 10809 | // If any of these asserts fail, we need to add or remove padding on 32-bit |
| 10810 | // machines (64-bit machines will have 8-byte alignment already due to |
| 10811 | // pointers, which all of these structs have). |
| 10812 | UPB_INLINE void _upb_DefType_CheckPadding(size_t size) { |
| 10813 | UPB_ASSERT((size & UPB_DEFTYPE_MASK) == 0); |
| 10814 | } |
| 10815 | |
| 10816 | upb_deftype_t _upb_DefType_Type(upb_value v); |
| 10817 | |
| 10818 | upb_value _upb_DefType_Pack(const void* ptr, upb_deftype_t type); |
| 10819 | |
| 10820 | const void* _upb_DefType_Unpack(upb_value v, upb_deftype_t type); |
| 10821 | |
| 10822 | #ifdef __cplusplus |
| 10823 | } /* extern "C" */ |
| 10824 | #endif |
| 10825 | |
| 10826 | |
| 10827 | #endif /* UPB_REFLECTION_DEF_TYPE_H_ */ |
| 10828 | |
| 10829 | // Must be last. |
| 10830 | |
| 10831 | #ifdef __cplusplus |
| 10832 | extern "C" { |
| 10833 | #endif |
| 10834 | |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 10835 | UPB_API void upb_DefPool_Free(upb_DefPool* s); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10836 | |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 10837 | UPB_API upb_DefPool* upb_DefPool_New(void); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10838 | |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 10839 | UPB_API const upb_MessageDef* upb_DefPool_FindMessageByName( |
| 10840 | const upb_DefPool* s, const char* sym); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10841 | |
| 10842 | const upb_MessageDef* upb_DefPool_FindMessageByNameWithSize( |
| 10843 | const upb_DefPool* s, const char* sym, size_t len); |
| 10844 | |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 10845 | UPB_API const upb_EnumDef* upb_DefPool_FindEnumByName(const upb_DefPool* s, |
| 10846 | const char* sym); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10847 | |
| 10848 | const upb_EnumValueDef* upb_DefPool_FindEnumByNameval(const upb_DefPool* s, |
| 10849 | const char* sym); |
| 10850 | |
| 10851 | const upb_FileDef* upb_DefPool_FindFileByName(const upb_DefPool* s, |
| 10852 | const char* name); |
| 10853 | |
| 10854 | const upb_FileDef* upb_DefPool_FindFileByNameWithSize(const upb_DefPool* s, |
| 10855 | const char* name, |
| 10856 | size_t len); |
| 10857 | |
| 10858 | const upb_FieldDef* upb_DefPool_FindExtensionByMiniTable( |
| 10859 | const upb_DefPool* s, const upb_MiniTableExtension* ext); |
| 10860 | |
| 10861 | const upb_FieldDef* upb_DefPool_FindExtensionByName(const upb_DefPool* s, |
| 10862 | const char* sym); |
| 10863 | |
| 10864 | const upb_FieldDef* upb_DefPool_FindExtensionByNameWithSize( |
| 10865 | const upb_DefPool* s, const char* name, size_t size); |
| 10866 | |
| 10867 | const upb_FieldDef* upb_DefPool_FindExtensionByNumber(const upb_DefPool* s, |
| 10868 | const upb_MessageDef* m, |
| 10869 | int32_t fieldnum); |
| 10870 | |
| 10871 | const upb_ServiceDef* upb_DefPool_FindServiceByName(const upb_DefPool* s, |
| 10872 | const char* name); |
| 10873 | |
| 10874 | const upb_ServiceDef* upb_DefPool_FindServiceByNameWithSize( |
| 10875 | const upb_DefPool* s, const char* name, size_t size); |
| 10876 | |
| 10877 | const upb_FileDef* upb_DefPool_FindFileContainingSymbol(const upb_DefPool* s, |
| 10878 | const char* name); |
| 10879 | |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 10880 | UPB_API const upb_FileDef* upb_DefPool_AddFile( |
| 10881 | upb_DefPool* s, const UPB_DESC(FileDescriptorProto) * file_proto, |
| 10882 | upb_Status* status); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10883 | |
| 10884 | const upb_ExtensionRegistry* upb_DefPool_ExtensionRegistry( |
| 10885 | const upb_DefPool* s); |
| 10886 | |
| 10887 | const upb_FieldDef** upb_DefPool_GetAllExtensions(const upb_DefPool* s, |
| 10888 | const upb_MessageDef* m, |
| 10889 | size_t* count); |
| 10890 | |
| 10891 | #ifdef __cplusplus |
| 10892 | } /* extern "C" */ |
| 10893 | #endif |
| 10894 | |
| 10895 | |
| 10896 | #endif /* UPB_REFLECTION_DEF_POOL_H_ */ |
| 10897 | |
Protobuf Team Bot | fea7645 | 2023-09-12 20:32:11 +0000 | [diff] [blame] | 10898 | // IWYU pragma: private, include "upb/upb/reflection/def.h" |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10899 | |
| 10900 | #ifndef UPB_REFLECTION_ENUM_DEF_H_ |
| 10901 | #define UPB_REFLECTION_ENUM_DEF_H_ |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10902 | |
| 10903 | |
| 10904 | // Must be last. |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10905 | |
| 10906 | #ifdef __cplusplus |
| 10907 | extern "C" { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10908 | #endif |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10909 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10910 | bool upb_EnumDef_CheckNumber(const upb_EnumDef* e, int32_t num); |
| 10911 | const upb_MessageDef* upb_EnumDef_ContainingType(const upb_EnumDef* e); |
| 10912 | int32_t upb_EnumDef_Default(const upb_EnumDef* e); |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 10913 | UPB_API const upb_FileDef* upb_EnumDef_File(const upb_EnumDef* e); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10914 | const upb_EnumValueDef* upb_EnumDef_FindValueByName(const upb_EnumDef* e, |
| 10915 | const char* name); |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 10916 | UPB_API const upb_EnumValueDef* upb_EnumDef_FindValueByNameWithSize( |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10917 | const upb_EnumDef* e, const char* name, size_t size); |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 10918 | UPB_API const upb_EnumValueDef* upb_EnumDef_FindValueByNumber( |
| 10919 | const upb_EnumDef* e, int32_t num); |
| 10920 | UPB_API const char* upb_EnumDef_FullName(const upb_EnumDef* e); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10921 | bool upb_EnumDef_HasOptions(const upb_EnumDef* e); |
| 10922 | bool upb_EnumDef_IsClosed(const upb_EnumDef* e); |
| 10923 | |
| 10924 | // Creates a mini descriptor string for an enum, returns true on success. |
| 10925 | bool upb_EnumDef_MiniDescriptorEncode(const upb_EnumDef* e, upb_Arena* a, |
| 10926 | upb_StringView* out); |
| 10927 | |
| 10928 | const char* upb_EnumDef_Name(const upb_EnumDef* e); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 10929 | const UPB_DESC(EnumOptions) * upb_EnumDef_Options(const upb_EnumDef* e); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10930 | |
| 10931 | upb_StringView upb_EnumDef_ReservedName(const upb_EnumDef* e, int i); |
| 10932 | int upb_EnumDef_ReservedNameCount(const upb_EnumDef* e); |
| 10933 | |
| 10934 | const upb_EnumReservedRange* upb_EnumDef_ReservedRange(const upb_EnumDef* e, |
| 10935 | int i); |
| 10936 | int upb_EnumDef_ReservedRangeCount(const upb_EnumDef* e); |
| 10937 | |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 10938 | UPB_API const upb_EnumValueDef* upb_EnumDef_Value(const upb_EnumDef* e, int i); |
| 10939 | UPB_API int upb_EnumDef_ValueCount(const upb_EnumDef* e); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10940 | |
| 10941 | #ifdef __cplusplus |
| 10942 | } /* extern "C" */ |
| 10943 | #endif |
| 10944 | |
| 10945 | |
| 10946 | #endif /* UPB_REFLECTION_ENUM_DEF_H_ */ |
| 10947 | |
Protobuf Team Bot | fea7645 | 2023-09-12 20:32:11 +0000 | [diff] [blame] | 10948 | // IWYU pragma: private, include "upb/upb/reflection/def.h" |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10949 | |
| 10950 | #ifndef UPB_REFLECTION_ENUM_VALUE_DEF_H_ |
| 10951 | #define UPB_REFLECTION_ENUM_VALUE_DEF_H_ |
| 10952 | |
| 10953 | |
| 10954 | // Must be last. |
| 10955 | |
| 10956 | #ifdef __cplusplus |
| 10957 | extern "C" { |
| 10958 | #endif |
| 10959 | |
| 10960 | const upb_EnumDef* upb_EnumValueDef_Enum(const upb_EnumValueDef* v); |
| 10961 | const char* upb_EnumValueDef_FullName(const upb_EnumValueDef* v); |
| 10962 | bool upb_EnumValueDef_HasOptions(const upb_EnumValueDef* v); |
| 10963 | uint32_t upb_EnumValueDef_Index(const upb_EnumValueDef* v); |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 10964 | UPB_API const char* upb_EnumValueDef_Name(const upb_EnumValueDef* v); |
| 10965 | UPB_API int32_t upb_EnumValueDef_Number(const upb_EnumValueDef* v); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 10966 | const UPB_DESC(EnumValueOptions) * |
| 10967 | upb_EnumValueDef_Options(const upb_EnumValueDef* v); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10968 | |
| 10969 | #ifdef __cplusplus |
| 10970 | } /* extern "C" */ |
| 10971 | #endif |
| 10972 | |
| 10973 | |
| 10974 | #endif /* UPB_REFLECTION_ENUM_VALUE_DEF_H_ */ |
| 10975 | |
Protobuf Team Bot | fea7645 | 2023-09-12 20:32:11 +0000 | [diff] [blame] | 10976 | // IWYU pragma: private, include "upb/upb/reflection/def.h" |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10977 | |
| 10978 | #ifndef UPB_REFLECTION_EXTENSION_RANGE_H_ |
| 10979 | #define UPB_REFLECTION_EXTENSION_RANGE_H_ |
| 10980 | |
| 10981 | |
| 10982 | // Must be last. |
| 10983 | |
| 10984 | #ifdef __cplusplus |
| 10985 | extern "C" { |
| 10986 | #endif |
| 10987 | |
| 10988 | int32_t upb_ExtensionRange_Start(const upb_ExtensionRange* r); |
| 10989 | int32_t upb_ExtensionRange_End(const upb_ExtensionRange* r); |
| 10990 | |
| 10991 | bool upb_ExtensionRange_HasOptions(const upb_ExtensionRange* r); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 10992 | const UPB_DESC(ExtensionRangeOptions) * |
| 10993 | upb_ExtensionRange_Options(const upb_ExtensionRange* r); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10994 | |
| 10995 | #ifdef __cplusplus |
| 10996 | } /* extern "C" */ |
| 10997 | #endif |
| 10998 | |
| 10999 | |
| 11000 | #endif /* UPB_REFLECTION_EXTENSION_RANGE_H_ */ |
| 11001 | |
Protobuf Team Bot | fea7645 | 2023-09-12 20:32:11 +0000 | [diff] [blame] | 11002 | // IWYU pragma: private, include "upb/upb/reflection/def.h" |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11003 | |
| 11004 | #ifndef UPB_REFLECTION_FIELD_DEF_H_ |
| 11005 | #define UPB_REFLECTION_FIELD_DEF_H_ |
| 11006 | |
| 11007 | |
| 11008 | // Must be last. |
| 11009 | |
| 11010 | // Maximum field number allowed for FieldDefs. |
| 11011 | // This is an inherent limit of the protobuf wire format. |
| 11012 | #define kUpb_MaxFieldNumber ((1 << 29) - 1) |
| 11013 | |
| 11014 | #ifdef __cplusplus |
| 11015 | extern "C" { |
| 11016 | #endif |
| 11017 | |
| 11018 | const upb_OneofDef* upb_FieldDef_ContainingOneof(const upb_FieldDef* f); |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11019 | UPB_API const upb_MessageDef* upb_FieldDef_ContainingType( |
| 11020 | const upb_FieldDef* f); |
| 11021 | UPB_API upb_CType upb_FieldDef_CType(const upb_FieldDef* f); |
| 11022 | UPB_API upb_MessageValue upb_FieldDef_Default(const upb_FieldDef* f); |
| 11023 | UPB_API const upb_EnumDef* upb_FieldDef_EnumSubDef(const upb_FieldDef* f); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11024 | const upb_MessageDef* upb_FieldDef_ExtensionScope(const upb_FieldDef* f); |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11025 | UPB_API const upb_FileDef* upb_FieldDef_File(const upb_FieldDef* f); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11026 | const char* upb_FieldDef_FullName(const upb_FieldDef* f); |
| 11027 | bool upb_FieldDef_HasDefault(const upb_FieldDef* f); |
| 11028 | bool upb_FieldDef_HasJsonName(const upb_FieldDef* f); |
| 11029 | bool upb_FieldDef_HasOptions(const upb_FieldDef* f); |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11030 | UPB_API bool upb_FieldDef_HasPresence(const upb_FieldDef* f); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11031 | bool upb_FieldDef_HasSubDef(const upb_FieldDef* f); |
| 11032 | uint32_t upb_FieldDef_Index(const upb_FieldDef* f); |
| 11033 | bool upb_FieldDef_IsExtension(const upb_FieldDef* f); |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11034 | UPB_API bool upb_FieldDef_IsMap(const upb_FieldDef* f); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11035 | bool upb_FieldDef_IsOptional(const upb_FieldDef* f); |
| 11036 | bool upb_FieldDef_IsPacked(const upb_FieldDef* f); |
| 11037 | bool upb_FieldDef_IsPrimitive(const upb_FieldDef* f); |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11038 | UPB_API bool upb_FieldDef_IsRepeated(const upb_FieldDef* f); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11039 | bool upb_FieldDef_IsRequired(const upb_FieldDef* f); |
| 11040 | bool upb_FieldDef_IsString(const upb_FieldDef* f); |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11041 | UPB_API bool upb_FieldDef_IsSubMessage(const upb_FieldDef* f); |
| 11042 | UPB_API const char* upb_FieldDef_JsonName(const upb_FieldDef* f); |
| 11043 | UPB_API upb_Label upb_FieldDef_Label(const upb_FieldDef* f); |
| 11044 | UPB_API const upb_MessageDef* upb_FieldDef_MessageSubDef(const upb_FieldDef* f); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11045 | |
| 11046 | // Creates a mini descriptor string for a field, returns true on success. |
| 11047 | bool upb_FieldDef_MiniDescriptorEncode(const upb_FieldDef* f, upb_Arena* a, |
| 11048 | upb_StringView* out); |
| 11049 | |
| 11050 | const upb_MiniTableField* upb_FieldDef_MiniTable(const upb_FieldDef* f); |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11051 | UPB_API const char* upb_FieldDef_Name(const upb_FieldDef* f); |
| 11052 | UPB_API uint32_t upb_FieldDef_Number(const upb_FieldDef* f); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 11053 | const UPB_DESC(FieldOptions) * upb_FieldDef_Options(const upb_FieldDef* f); |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11054 | UPB_API const upb_OneofDef* upb_FieldDef_RealContainingOneof( |
| 11055 | const upb_FieldDef* f); |
| 11056 | UPB_API upb_FieldType upb_FieldDef_Type(const upb_FieldDef* f); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11057 | |
| 11058 | #ifdef __cplusplus |
| 11059 | } /* extern "C" */ |
| 11060 | #endif |
| 11061 | |
| 11062 | |
| 11063 | #endif /* UPB_REFLECTION_FIELD_DEF_H_ */ |
| 11064 | |
Protobuf Team Bot | fea7645 | 2023-09-12 20:32:11 +0000 | [diff] [blame] | 11065 | // IWYU pragma: private, include "upb/upb/reflection/def.h" |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11066 | |
| 11067 | #ifndef UPB_REFLECTION_FILE_DEF_H_ |
| 11068 | #define UPB_REFLECTION_FILE_DEF_H_ |
| 11069 | |
| 11070 | |
| 11071 | // Must be last. |
| 11072 | |
| 11073 | #ifdef __cplusplus |
| 11074 | extern "C" { |
| 11075 | #endif |
| 11076 | |
| 11077 | const upb_FileDef* upb_FileDef_Dependency(const upb_FileDef* f, int i); |
| 11078 | int upb_FileDef_DependencyCount(const upb_FileDef* f); |
| 11079 | bool upb_FileDef_HasOptions(const upb_FileDef* f); |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11080 | UPB_API const char* upb_FileDef_Name(const upb_FileDef* f); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 11081 | const UPB_DESC(FileOptions) * upb_FileDef_Options(const upb_FileDef* f); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11082 | const char* upb_FileDef_Package(const upb_FileDef* f); |
Protobuf Team Bot | 7dabac9 | 2023-09-07 18:35:50 +0000 | [diff] [blame] | 11083 | UPB_DESC(Edition) upb_FileDef_Edition(const upb_FileDef* f); |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11084 | UPB_API const upb_DefPool* upb_FileDef_Pool(const upb_FileDef* f); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11085 | |
| 11086 | const upb_FileDef* upb_FileDef_PublicDependency(const upb_FileDef* f, int i); |
| 11087 | int upb_FileDef_PublicDependencyCount(const upb_FileDef* f); |
| 11088 | |
| 11089 | const upb_ServiceDef* upb_FileDef_Service(const upb_FileDef* f, int i); |
| 11090 | int upb_FileDef_ServiceCount(const upb_FileDef* f); |
| 11091 | |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11092 | UPB_API upb_Syntax upb_FileDef_Syntax(const upb_FileDef* f); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11093 | |
| 11094 | const upb_EnumDef* upb_FileDef_TopLevelEnum(const upb_FileDef* f, int i); |
| 11095 | int upb_FileDef_TopLevelEnumCount(const upb_FileDef* f); |
| 11096 | |
| 11097 | const upb_FieldDef* upb_FileDef_TopLevelExtension(const upb_FileDef* f, int i); |
| 11098 | int upb_FileDef_TopLevelExtensionCount(const upb_FileDef* f); |
| 11099 | |
| 11100 | const upb_MessageDef* upb_FileDef_TopLevelMessage(const upb_FileDef* f, int i); |
| 11101 | int upb_FileDef_TopLevelMessageCount(const upb_FileDef* f); |
| 11102 | |
| 11103 | const upb_FileDef* upb_FileDef_WeakDependency(const upb_FileDef* f, int i); |
| 11104 | int upb_FileDef_WeakDependencyCount(const upb_FileDef* f); |
| 11105 | |
| 11106 | #ifdef __cplusplus |
| 11107 | } /* extern "C" */ |
| 11108 | #endif |
| 11109 | |
| 11110 | |
| 11111 | #endif /* UPB_REFLECTION_FILE_DEF_H_ */ |
| 11112 | |
Protobuf Team Bot | fea7645 | 2023-09-12 20:32:11 +0000 | [diff] [blame] | 11113 | // IWYU pragma: private, include "upb/upb/reflection/def.h" |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11114 | |
| 11115 | #ifndef UPB_REFLECTION_MESSAGE_DEF_H_ |
| 11116 | #define UPB_REFLECTION_MESSAGE_DEF_H_ |
| 11117 | |
| 11118 | |
| 11119 | // Must be last. |
| 11120 | |
| 11121 | // Well-known field tag numbers for map-entry messages. |
| 11122 | #define kUpb_MapEntry_KeyFieldNumber 1 |
| 11123 | #define kUpb_MapEntry_ValueFieldNumber 2 |
| 11124 | |
| 11125 | // Well-known field tag numbers for Any messages. |
| 11126 | #define kUpb_Any_TypeFieldNumber 1 |
| 11127 | #define kUpb_Any_ValueFieldNumber 2 |
| 11128 | |
| 11129 | // Well-known field tag numbers for duration messages. |
| 11130 | #define kUpb_Duration_SecondsFieldNumber 1 |
| 11131 | #define kUpb_Duration_NanosFieldNumber 2 |
| 11132 | |
| 11133 | // Well-known field tag numbers for timestamp messages. |
| 11134 | #define kUpb_Timestamp_SecondsFieldNumber 1 |
| 11135 | #define kUpb_Timestamp_NanosFieldNumber 2 |
| 11136 | |
| 11137 | // All the different kind of well known type messages. For simplicity of check, |
| 11138 | // number wrappers and string wrappers are grouped together. Make sure the |
| 11139 | // order and number of these groups are not changed. |
| 11140 | typedef enum { |
| 11141 | kUpb_WellKnown_Unspecified, |
| 11142 | kUpb_WellKnown_Any, |
| 11143 | kUpb_WellKnown_FieldMask, |
| 11144 | kUpb_WellKnown_Duration, |
| 11145 | kUpb_WellKnown_Timestamp, |
| 11146 | |
| 11147 | // number wrappers |
| 11148 | kUpb_WellKnown_DoubleValue, |
| 11149 | kUpb_WellKnown_FloatValue, |
| 11150 | kUpb_WellKnown_Int64Value, |
| 11151 | kUpb_WellKnown_UInt64Value, |
| 11152 | kUpb_WellKnown_Int32Value, |
| 11153 | kUpb_WellKnown_UInt32Value, |
| 11154 | |
| 11155 | // string wrappers |
| 11156 | kUpb_WellKnown_StringValue, |
| 11157 | kUpb_WellKnown_BytesValue, |
| 11158 | kUpb_WellKnown_BoolValue, |
| 11159 | kUpb_WellKnown_Value, |
| 11160 | kUpb_WellKnown_ListValue, |
| 11161 | kUpb_WellKnown_Struct, |
| 11162 | } upb_WellKnown; |
| 11163 | |
| 11164 | #ifdef __cplusplus |
| 11165 | extern "C" { |
| 11166 | #endif |
| 11167 | |
| 11168 | const upb_MessageDef* upb_MessageDef_ContainingType(const upb_MessageDef* m); |
| 11169 | |
| 11170 | const upb_ExtensionRange* upb_MessageDef_ExtensionRange(const upb_MessageDef* m, |
| 11171 | int i); |
| 11172 | int upb_MessageDef_ExtensionRangeCount(const upb_MessageDef* m); |
| 11173 | |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11174 | UPB_API const upb_FieldDef* upb_MessageDef_Field(const upb_MessageDef* m, |
| 11175 | int i); |
| 11176 | UPB_API int upb_MessageDef_FieldCount(const upb_MessageDef* m); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11177 | |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11178 | UPB_API const upb_FileDef* upb_MessageDef_File(const upb_MessageDef* m); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11179 | |
| 11180 | // Returns a field by either JSON name or regular proto name. |
| 11181 | const upb_FieldDef* upb_MessageDef_FindByJsonNameWithSize( |
| 11182 | const upb_MessageDef* m, const char* name, size_t size); |
| 11183 | UPB_INLINE const upb_FieldDef* upb_MessageDef_FindByJsonName( |
| 11184 | const upb_MessageDef* m, const char* name) { |
| 11185 | return upb_MessageDef_FindByJsonNameWithSize(m, name, strlen(name)); |
| 11186 | } |
| 11187 | |
| 11188 | // Lookup of either field or oneof by name. Returns whether either was found. |
| 11189 | // If the return is true, then the found def will be set, and the non-found |
| 11190 | // one set to NULL. |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11191 | UPB_API bool upb_MessageDef_FindByNameWithSize(const upb_MessageDef* m, |
| 11192 | const char* name, size_t size, |
| 11193 | const upb_FieldDef** f, |
| 11194 | const upb_OneofDef** o); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11195 | UPB_INLINE bool upb_MessageDef_FindByName(const upb_MessageDef* m, |
| 11196 | const char* name, |
| 11197 | const upb_FieldDef** f, |
| 11198 | const upb_OneofDef** o) { |
| 11199 | return upb_MessageDef_FindByNameWithSize(m, name, strlen(name), f, o); |
| 11200 | } |
| 11201 | |
| 11202 | const upb_FieldDef* upb_MessageDef_FindFieldByName(const upb_MessageDef* m, |
| 11203 | const char* name); |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11204 | UPB_API const upb_FieldDef* upb_MessageDef_FindFieldByNameWithSize( |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11205 | const upb_MessageDef* m, const char* name, size_t size); |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11206 | UPB_API const upb_FieldDef* upb_MessageDef_FindFieldByNumber( |
| 11207 | const upb_MessageDef* m, uint32_t i); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11208 | const upb_OneofDef* upb_MessageDef_FindOneofByName(const upb_MessageDef* m, |
| 11209 | const char* name); |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11210 | UPB_API const upb_OneofDef* upb_MessageDef_FindOneofByNameWithSize( |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11211 | const upb_MessageDef* m, const char* name, size_t size); |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11212 | UPB_API const char* upb_MessageDef_FullName(const upb_MessageDef* m); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11213 | bool upb_MessageDef_HasOptions(const upb_MessageDef* m); |
| 11214 | bool upb_MessageDef_IsMapEntry(const upb_MessageDef* m); |
| 11215 | bool upb_MessageDef_IsMessageSet(const upb_MessageDef* m); |
| 11216 | |
| 11217 | // Creates a mini descriptor string for a message, returns true on success. |
| 11218 | bool upb_MessageDef_MiniDescriptorEncode(const upb_MessageDef* m, upb_Arena* a, |
| 11219 | upb_StringView* out); |
| 11220 | |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11221 | UPB_API const upb_MiniTable* upb_MessageDef_MiniTable(const upb_MessageDef* m); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11222 | const char* upb_MessageDef_Name(const upb_MessageDef* m); |
| 11223 | |
| 11224 | const upb_EnumDef* upb_MessageDef_NestedEnum(const upb_MessageDef* m, int i); |
| 11225 | const upb_FieldDef* upb_MessageDef_NestedExtension(const upb_MessageDef* m, |
| 11226 | int i); |
| 11227 | const upb_MessageDef* upb_MessageDef_NestedMessage(const upb_MessageDef* m, |
| 11228 | int i); |
| 11229 | |
| 11230 | int upb_MessageDef_NestedEnumCount(const upb_MessageDef* m); |
| 11231 | int upb_MessageDef_NestedExtensionCount(const upb_MessageDef* m); |
| 11232 | int upb_MessageDef_NestedMessageCount(const upb_MessageDef* m); |
| 11233 | |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11234 | UPB_API const upb_OneofDef* upb_MessageDef_Oneof(const upb_MessageDef* m, |
| 11235 | int i); |
| 11236 | UPB_API int upb_MessageDef_OneofCount(const upb_MessageDef* m); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 11237 | int upb_MessageDef_RealOneofCount(const upb_MessageDef* m); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11238 | |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 11239 | const UPB_DESC(MessageOptions) * |
| 11240 | upb_MessageDef_Options(const upb_MessageDef* m); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11241 | |
| 11242 | upb_StringView upb_MessageDef_ReservedName(const upb_MessageDef* m, int i); |
| 11243 | int upb_MessageDef_ReservedNameCount(const upb_MessageDef* m); |
| 11244 | |
| 11245 | const upb_MessageReservedRange* upb_MessageDef_ReservedRange( |
| 11246 | const upb_MessageDef* m, int i); |
| 11247 | int upb_MessageDef_ReservedRangeCount(const upb_MessageDef* m); |
| 11248 | |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11249 | UPB_API upb_Syntax upb_MessageDef_Syntax(const upb_MessageDef* m); |
| 11250 | UPB_API upb_WellKnown upb_MessageDef_WellKnownType(const upb_MessageDef* m); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11251 | |
| 11252 | #ifdef __cplusplus |
| 11253 | } /* extern "C" */ |
| 11254 | #endif |
| 11255 | |
| 11256 | |
| 11257 | #endif /* UPB_REFLECTION_MESSAGE_DEF_H_ */ |
| 11258 | |
Protobuf Team Bot | fea7645 | 2023-09-12 20:32:11 +0000 | [diff] [blame] | 11259 | // IWYU pragma: private, include "upb/upb/reflection/def.h" |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11260 | |
| 11261 | #ifndef UPB_REFLECTION_METHOD_DEF_H_ |
| 11262 | #define UPB_REFLECTION_METHOD_DEF_H_ |
| 11263 | |
| 11264 | |
| 11265 | // Must be last. |
| 11266 | |
| 11267 | #ifdef __cplusplus |
| 11268 | extern "C" { |
| 11269 | #endif |
| 11270 | |
| 11271 | bool upb_MethodDef_ClientStreaming(const upb_MethodDef* m); |
| 11272 | const char* upb_MethodDef_FullName(const upb_MethodDef* m); |
| 11273 | bool upb_MethodDef_HasOptions(const upb_MethodDef* m); |
| 11274 | int upb_MethodDef_Index(const upb_MethodDef* m); |
| 11275 | const upb_MessageDef* upb_MethodDef_InputType(const upb_MethodDef* m); |
| 11276 | const char* upb_MethodDef_Name(const upb_MethodDef* m); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 11277 | const UPB_DESC(MethodOptions) * upb_MethodDef_Options(const upb_MethodDef* m); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11278 | const upb_MessageDef* upb_MethodDef_OutputType(const upb_MethodDef* m); |
| 11279 | bool upb_MethodDef_ServerStreaming(const upb_MethodDef* m); |
| 11280 | const upb_ServiceDef* upb_MethodDef_Service(const upb_MethodDef* m); |
| 11281 | |
| 11282 | #ifdef __cplusplus |
| 11283 | } /* extern "C" */ |
| 11284 | #endif |
| 11285 | |
| 11286 | |
| 11287 | #endif /* UPB_REFLECTION_METHOD_DEF_H_ */ |
| 11288 | |
Protobuf Team Bot | fea7645 | 2023-09-12 20:32:11 +0000 | [diff] [blame] | 11289 | // IWYU pragma: private, include "upb/upb/reflection/def.h" |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11290 | |
| 11291 | #ifndef UPB_REFLECTION_ONEOF_DEF_H_ |
| 11292 | #define UPB_REFLECTION_ONEOF_DEF_H_ |
| 11293 | |
| 11294 | |
| 11295 | // Must be last. |
| 11296 | |
| 11297 | #ifdef __cplusplus |
| 11298 | extern "C" { |
| 11299 | #endif |
| 11300 | |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11301 | UPB_API const upb_MessageDef* upb_OneofDef_ContainingType( |
| 11302 | const upb_OneofDef* o); |
| 11303 | UPB_API const upb_FieldDef* upb_OneofDef_Field(const upb_OneofDef* o, int i); |
| 11304 | UPB_API int upb_OneofDef_FieldCount(const upb_OneofDef* o); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11305 | const char* upb_OneofDef_FullName(const upb_OneofDef* o); |
| 11306 | bool upb_OneofDef_HasOptions(const upb_OneofDef* o); |
| 11307 | uint32_t upb_OneofDef_Index(const upb_OneofDef* o); |
| 11308 | bool upb_OneofDef_IsSynthetic(const upb_OneofDef* o); |
| 11309 | const upb_FieldDef* upb_OneofDef_LookupName(const upb_OneofDef* o, |
| 11310 | const char* name); |
| 11311 | const upb_FieldDef* upb_OneofDef_LookupNameWithSize(const upb_OneofDef* o, |
| 11312 | const char* name, |
| 11313 | size_t size); |
| 11314 | const upb_FieldDef* upb_OneofDef_LookupNumber(const upb_OneofDef* o, |
| 11315 | uint32_t num); |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11316 | UPB_API const char* upb_OneofDef_Name(const upb_OneofDef* o); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11317 | int upb_OneofDef_numfields(const upb_OneofDef* o); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 11318 | const UPB_DESC(OneofOptions) * upb_OneofDef_Options(const upb_OneofDef* o); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11319 | |
| 11320 | #ifdef __cplusplus |
| 11321 | } /* extern "C" */ |
| 11322 | #endif |
| 11323 | |
| 11324 | |
| 11325 | #endif /* UPB_REFLECTION_ONEOF_DEF_H_ */ |
| 11326 | |
Protobuf Team Bot | fea7645 | 2023-09-12 20:32:11 +0000 | [diff] [blame] | 11327 | // IWYU pragma: private, include "upb/upb/reflection/def.h" |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11328 | |
| 11329 | #ifndef UPB_REFLECTION_SERVICE_DEF_H_ |
| 11330 | #define UPB_REFLECTION_SERVICE_DEF_H_ |
| 11331 | |
| 11332 | |
| 11333 | // Must be last. |
| 11334 | |
| 11335 | #ifdef __cplusplus |
| 11336 | extern "C" { |
| 11337 | #endif |
| 11338 | |
| 11339 | const upb_FileDef* upb_ServiceDef_File(const upb_ServiceDef* s); |
| 11340 | const upb_MethodDef* upb_ServiceDef_FindMethodByName(const upb_ServiceDef* s, |
| 11341 | const char* name); |
| 11342 | const char* upb_ServiceDef_FullName(const upb_ServiceDef* s); |
| 11343 | bool upb_ServiceDef_HasOptions(const upb_ServiceDef* s); |
| 11344 | int upb_ServiceDef_Index(const upb_ServiceDef* s); |
| 11345 | const upb_MethodDef* upb_ServiceDef_Method(const upb_ServiceDef* s, int i); |
| 11346 | int upb_ServiceDef_MethodCount(const upb_ServiceDef* s); |
| 11347 | const char* upb_ServiceDef_Name(const upb_ServiceDef* s); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 11348 | const UPB_DESC(ServiceOptions) * |
| 11349 | upb_ServiceDef_Options(const upb_ServiceDef* s); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11350 | |
| 11351 | #ifdef __cplusplus |
| 11352 | } /* extern "C" */ |
| 11353 | #endif |
| 11354 | |
| 11355 | |
| 11356 | #endif /* UPB_REFLECTION_SERVICE_DEF_H_ */ |
Protobuf Team Bot | ffc56ba | 2023-09-08 15:29:06 +0000 | [diff] [blame] | 11357 | // IWYU pragma: end_exports |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11358 | |
| 11359 | #endif /* UPB_REFLECTION_DEF_H_ */ |
| 11360 | |
| 11361 | // Must be last. |
| 11362 | |
| 11363 | #ifdef __cplusplus |
| 11364 | extern "C" { |
| 11365 | #endif |
| 11366 | |
| 11367 | enum { upb_JsonDecode_IgnoreUnknown = 1 }; |
| 11368 | |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11369 | UPB_API bool upb_JsonDecode(const char* buf, size_t size, upb_Message* msg, |
| 11370 | const upb_MessageDef* m, const upb_DefPool* symtab, |
| 11371 | int options, upb_Arena* arena, upb_Status* status); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11372 | |
| 11373 | #ifdef __cplusplus |
| 11374 | } /* extern "C" */ |
| 11375 | #endif |
| 11376 | |
| 11377 | |
| 11378 | #endif /* UPB_JSONDECODE_H_ */ |
| 11379 | |
| 11380 | #ifndef UPB_LEX_ATOI_H_ |
| 11381 | #define UPB_LEX_ATOI_H_ |
| 11382 | |
Adam Cozzette | 7d5592e | 2023-08-23 12:15:26 -0700 | [diff] [blame] | 11383 | #include <stdint.h> |
| 11384 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11385 | // Must be last. |
| 11386 | |
| 11387 | #ifdef __cplusplus |
| 11388 | extern "C" { |
| 11389 | #endif |
| 11390 | |
| 11391 | // We use these hand-written routines instead of strto[u]l() because the "long |
| 11392 | // long" variants aren't in c89. Also our version allows setting a ptr limit. |
| 11393 | // Return the new position of the pointer after parsing the int, or NULL on |
| 11394 | // integer overflow. |
| 11395 | |
| 11396 | const char* upb_BufToUint64(const char* ptr, const char* end, uint64_t* val); |
| 11397 | const char* upb_BufToInt64(const char* ptr, const char* end, int64_t* val, |
| 11398 | bool* is_neg); |
| 11399 | |
| 11400 | #ifdef __cplusplus |
| 11401 | } /* extern "C" */ |
| 11402 | #endif |
| 11403 | |
| 11404 | |
| 11405 | #endif /* UPB_LEX_ATOI_H_ */ |
| 11406 | |
| 11407 | #ifndef UPB_LEX_UNICODE_H_ |
| 11408 | #define UPB_LEX_UNICODE_H_ |
| 11409 | |
Adam Cozzette | 7d5592e | 2023-08-23 12:15:26 -0700 | [diff] [blame] | 11410 | #include <stdint.h> |
| 11411 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11412 | // Must be last. |
| 11413 | |
| 11414 | #ifdef __cplusplus |
| 11415 | extern "C" { |
| 11416 | #endif |
| 11417 | |
| 11418 | // Returns true iff a codepoint is the value for a high surrogate. |
| 11419 | UPB_INLINE bool upb_Unicode_IsHigh(uint32_t cp) { |
| 11420 | return (cp >= 0xd800 && cp <= 0xdbff); |
| 11421 | } |
| 11422 | |
| 11423 | // Returns true iff a codepoint is the value for a low surrogate. |
| 11424 | UPB_INLINE bool upb_Unicode_IsLow(uint32_t cp) { |
| 11425 | return (cp >= 0xdc00 && cp <= 0xdfff); |
| 11426 | } |
| 11427 | |
| 11428 | // Returns the high 16-bit surrogate value for a supplementary codepoint. |
| 11429 | // Does not sanity-check the input. |
| 11430 | UPB_INLINE uint16_t upb_Unicode_ToHigh(uint32_t cp) { |
| 11431 | return (cp >> 10) + 0xd7c0; |
| 11432 | } |
| 11433 | |
| 11434 | // Returns the low 16-bit surrogate value for a supplementary codepoint. |
| 11435 | // Does not sanity-check the input. |
| 11436 | UPB_INLINE uint16_t upb_Unicode_ToLow(uint32_t cp) { |
| 11437 | return (cp & 0x3ff) | 0xdc00; |
| 11438 | } |
| 11439 | |
| 11440 | // Returns the 32-bit value corresponding to a pair of 16-bit surrogates. |
| 11441 | // Does not sanity-check the input. |
| 11442 | UPB_INLINE uint32_t upb_Unicode_FromPair(uint32_t high, uint32_t low) { |
| 11443 | return ((high & 0x3ff) << 10) + (low & 0x3ff) + 0x10000; |
| 11444 | } |
| 11445 | |
| 11446 | // Outputs a codepoint as UTF8. |
| 11447 | // Returns the number of bytes written (1-4 on success, 0 on error). |
| 11448 | // Does not sanity-check the input. Specifically does not check for surrogates. |
| 11449 | int upb_Unicode_ToUTF8(uint32_t cp, char* out); |
| 11450 | |
| 11451 | #ifdef __cplusplus |
| 11452 | } /* extern "C" */ |
| 11453 | #endif |
| 11454 | |
| 11455 | |
| 11456 | #endif /* UPB_LEX_UNICODE_H_ */ |
| 11457 | |
| 11458 | #ifndef UPB_REFLECTION_MESSAGE_H_ |
| 11459 | #define UPB_REFLECTION_MESSAGE_H_ |
| 11460 | |
Protobuf Team Bot | 473d20d | 2023-09-15 22:27:16 +0000 | [diff] [blame] | 11461 | #include <stddef.h> |
| 11462 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11463 | |
| 11464 | // Must be last. |
| 11465 | |
| 11466 | #ifdef __cplusplus |
| 11467 | extern "C" { |
| 11468 | #endif |
| 11469 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 11470 | // Returns a mutable pointer to a map, array, or submessage value. If the given |
| 11471 | // arena is non-NULL this will construct a new object if it was not previously |
| 11472 | // present. May not be called for primitive fields. |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11473 | UPB_API upb_MutableMessageValue upb_Message_Mutable(upb_Message* msg, |
| 11474 | const upb_FieldDef* f, |
| 11475 | upb_Arena* a); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11476 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 11477 | // Returns the field that is set in the oneof, or NULL if none are set. |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11478 | UPB_API const upb_FieldDef* upb_Message_WhichOneof(const upb_Message* msg, |
| 11479 | const upb_OneofDef* o); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11480 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 11481 | // Clear all data and unknown fields. |
| 11482 | void upb_Message_ClearByDef(upb_Message* msg, const upb_MessageDef* m); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11483 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 11484 | // Clears any field presence and sets the value back to its default. |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11485 | UPB_API void upb_Message_ClearFieldByDef(upb_Message* msg, |
| 11486 | const upb_FieldDef* f); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11487 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 11488 | // May only be called for fields where upb_FieldDef_HasPresence(f) == true. |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11489 | UPB_API bool upb_Message_HasFieldByDef(const upb_Message* msg, |
| 11490 | const upb_FieldDef* f); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11491 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 11492 | // Returns the value in the message associated with this field def. |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11493 | UPB_API upb_MessageValue upb_Message_GetFieldByDef(const upb_Message* msg, |
| 11494 | const upb_FieldDef* f); |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 11495 | |
| 11496 | // Sets the given field to the given value. For a msg/array/map/string, the |
| 11497 | // caller must ensure that the target data outlives |msg| (by living either in |
| 11498 | // the same arena or a different arena that outlives it). |
| 11499 | // |
| 11500 | // Returns false if allocation fails. |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11501 | UPB_API bool upb_Message_SetFieldByDef(upb_Message* msg, const upb_FieldDef* f, |
| 11502 | upb_MessageValue val, upb_Arena* a); |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 11503 | |
| 11504 | // Iterate over present fields. |
| 11505 | // |
| 11506 | // size_t iter = kUpb_Message_Begin; |
| 11507 | // const upb_FieldDef *f; |
| 11508 | // upb_MessageValue val; |
| 11509 | // while (upb_Message_Next(msg, m, ext_pool, &f, &val, &iter)) { |
| 11510 | // process_field(f, val); |
| 11511 | // } |
| 11512 | // |
| 11513 | // If ext_pool is NULL, no extensions will be returned. If the given symtab |
| 11514 | // returns extensions that don't match what is in this message, those extensions |
| 11515 | // will be skipped. |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11516 | |
| 11517 | #define kUpb_Message_Begin -1 |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 11518 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11519 | bool upb_Message_Next(const upb_Message* msg, const upb_MessageDef* m, |
| 11520 | const upb_DefPool* ext_pool, const upb_FieldDef** f, |
| 11521 | upb_MessageValue* val, size_t* iter); |
| 11522 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 11523 | // Clears all unknown field data from this message and all submessages. |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11524 | UPB_API bool upb_Message_DiscardUnknown(upb_Message* msg, |
| 11525 | const upb_MessageDef* m, int maxdepth); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11526 | |
| 11527 | #ifdef __cplusplus |
| 11528 | } /* extern "C" */ |
| 11529 | #endif |
| 11530 | |
| 11531 | |
| 11532 | #endif /* UPB_REFLECTION_MESSAGE_H_ */ |
| 11533 | |
| 11534 | #ifndef UPB_JSON_ENCODE_H_ |
| 11535 | #define UPB_JSON_ENCODE_H_ |
| 11536 | |
| 11537 | |
| 11538 | // Must be last. |
| 11539 | |
| 11540 | #ifdef __cplusplus |
| 11541 | extern "C" { |
| 11542 | #endif |
| 11543 | |
| 11544 | enum { |
Protobuf Team Bot | 986cbb6 | 2023-09-19 15:03:51 +0000 | [diff] [blame^] | 11545 | /* When set, emits 0/default values. TODO: proto3 only? */ |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11546 | upb_JsonEncode_EmitDefaults = 1 << 0, |
| 11547 | |
| 11548 | /* When set, use normal (snake_case) field names instead of JSON (camelCase) |
| 11549 | names. */ |
| 11550 | upb_JsonEncode_UseProtoNames = 1 << 1, |
| 11551 | |
| 11552 | /* When set, emits enums as their integer values instead of as their names. */ |
| 11553 | upb_JsonEncode_FormatEnumsAsIntegers = 1 << 2 |
| 11554 | }; |
| 11555 | |
| 11556 | /* Encodes the given |msg| to JSON format. The message's reflection is given in |
Protobuf Team Bot | ad88453 | 2023-09-05 18:31:02 +0000 | [diff] [blame] | 11557 | * |m|. The DefPool in |ext_pool| is used to find extensions (if NULL, |
| 11558 | * extensions will not be printed). |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11559 | * |
| 11560 | * Output is placed in the given buffer, and always NULL-terminated. The output |
| 11561 | * size (excluding NULL) is returned. This means that a return value >= |size| |
| 11562 | * implies that the output was truncated. (These are the same semantics as |
| 11563 | * snprintf()). */ |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11564 | UPB_API size_t upb_JsonEncode(const upb_Message* msg, const upb_MessageDef* m, |
| 11565 | const upb_DefPool* ext_pool, int options, |
| 11566 | char* buf, size_t size, upb_Status* status); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11567 | |
| 11568 | #ifdef __cplusplus |
| 11569 | } /* extern "C" */ |
| 11570 | #endif |
| 11571 | |
| 11572 | |
| 11573 | #endif /* UPB_JSONENCODE_H_ */ |
| 11574 | |
| 11575 | #ifndef UPB_LEX_ROUND_TRIP_H_ |
| 11576 | #define UPB_LEX_ROUND_TRIP_H_ |
| 11577 | |
| 11578 | // Must be last. |
| 11579 | |
| 11580 | // Encodes a float or double that is round-trippable, but as short as possible. |
| 11581 | // These routines are not fully optimal (not guaranteed to be shortest), but are |
| 11582 | // short-ish and match the implementation that has been used in protobuf since |
| 11583 | // the beginning. |
| 11584 | |
| 11585 | // The given buffer size must be at least kUpb_RoundTripBufferSize. |
| 11586 | enum { kUpb_RoundTripBufferSize = 32 }; |
| 11587 | |
| 11588 | #ifdef __cplusplus |
| 11589 | extern "C" { |
| 11590 | #endif |
| 11591 | |
| 11592 | void _upb_EncodeRoundTripDouble(double val, char* buf, size_t size); |
| 11593 | void _upb_EncodeRoundTripFloat(float val, char* buf, size_t size); |
| 11594 | |
| 11595 | #ifdef __cplusplus |
| 11596 | } /* extern "C" */ |
| 11597 | #endif |
| 11598 | |
| 11599 | |
| 11600 | #endif /* UPB_LEX_ROUND_TRIP_H_ */ |
| 11601 | |
| 11602 | #ifndef UPB_PORT_VSNPRINTF_COMPAT_H_ |
| 11603 | #define UPB_PORT_VSNPRINTF_COMPAT_H_ |
| 11604 | |
| 11605 | // Must be last. |
| 11606 | |
| 11607 | UPB_INLINE int _upb_vsnprintf(char* buf, size_t size, const char* fmt, |
| 11608 | va_list ap) { |
| 11609 | #if defined(__MINGW64__) || defined(__MINGW32__) || defined(_MSC_VER) |
| 11610 | // The msvc runtime has a non-conforming vsnprintf() that requires the |
| 11611 | // following compatibility code to become conformant. |
| 11612 | int n = -1; |
| 11613 | if (size != 0) n = _vsnprintf_s(buf, size, _TRUNCATE, fmt, ap); |
| 11614 | if (n == -1) n = _vscprintf(fmt, ap); |
| 11615 | return n; |
| 11616 | #else |
| 11617 | return vsnprintf(buf, size, fmt, ap); |
| 11618 | #endif |
| 11619 | } |
| 11620 | |
| 11621 | |
| 11622 | #endif // UPB_PORT_VSNPRINTF_COMPAT_H_ |
| 11623 | |
| 11624 | #ifndef UPB_LEX_STRTOD_H_ |
| 11625 | #define UPB_LEX_STRTOD_H_ |
| 11626 | |
| 11627 | // Must be last. |
| 11628 | |
| 11629 | #ifdef __cplusplus |
| 11630 | extern "C" { |
| 11631 | #endif |
| 11632 | |
| 11633 | double _upb_NoLocaleStrtod(const char *str, char **endptr); |
| 11634 | |
| 11635 | #ifdef __cplusplus |
| 11636 | } /* extern "C" */ |
| 11637 | #endif |
| 11638 | |
| 11639 | |
| 11640 | #endif /* UPB_LEX_STRTOD_H_ */ |
| 11641 | |
Sandy Zhang | e3b0943 | 2023-08-07 09:30:02 -0700 | [diff] [blame] | 11642 | #ifndef UPB_MEM_INTERNAL_ARENA_H_ |
| 11643 | #define UPB_MEM_INTERNAL_ARENA_H_ |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11644 | |
| 11645 | |
| 11646 | // Must be last. |
| 11647 | |
| 11648 | typedef struct _upb_MemBlock _upb_MemBlock; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 11649 | |
| 11650 | struct upb_Arena { |
| 11651 | _upb_ArenaHead head; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 11652 | |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 11653 | // upb_alloc* together with a low bit which signals if there is an initial |
| 11654 | // block. |
| 11655 | uintptr_t block_alloc; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 11656 | |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 11657 | // When multiple arenas are fused together, each arena points to a parent |
| 11658 | // arena (root points to itself). The root tracks how many live arenas |
| 11659 | // reference it. |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 11660 | |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 11661 | // The low bit is tagged: |
| 11662 | // 0: pointer to parent |
| 11663 | // 1: count, left shifted by one |
| 11664 | UPB_ATOMIC(uintptr_t) parent_or_count; |
| 11665 | |
| 11666 | // All nodes that are fused together are in a singly-linked list. |
| 11667 | UPB_ATOMIC(upb_Arena*) next; // NULL at end of list. |
| 11668 | |
| 11669 | // The last element of the linked list. This is present only as an |
| 11670 | // optimization, so that we do not have to iterate over all members for every |
| 11671 | // fuse. Only significant for an arena root. In other cases it is ignored. |
| 11672 | UPB_ATOMIC(upb_Arena*) tail; // == self when no other list members. |
| 11673 | |
| 11674 | // Linked list of blocks to free/cleanup. Atomic only for the benefit of |
| 11675 | // upb_Arena_SpaceAllocated(). |
| 11676 | UPB_ATOMIC(_upb_MemBlock*) blocks; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 11677 | }; |
| 11678 | |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 11679 | UPB_INLINE bool _upb_Arena_IsTaggedRefcount(uintptr_t parent_or_count) { |
| 11680 | return (parent_or_count & 1) == 1; |
| 11681 | } |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11682 | |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 11683 | UPB_INLINE bool _upb_Arena_IsTaggedPointer(uintptr_t parent_or_count) { |
| 11684 | return (parent_or_count & 1) == 0; |
| 11685 | } |
| 11686 | |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 11687 | UPB_INLINE uintptr_t _upb_Arena_RefCountFromTagged(uintptr_t parent_or_count) { |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 11688 | UPB_ASSERT(_upb_Arena_IsTaggedRefcount(parent_or_count)); |
| 11689 | return parent_or_count >> 1; |
| 11690 | } |
| 11691 | |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 11692 | UPB_INLINE uintptr_t _upb_Arena_TaggedFromRefcount(uintptr_t refcount) { |
| 11693 | uintptr_t parent_or_count = (refcount << 1) | 1; |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 11694 | UPB_ASSERT(_upb_Arena_IsTaggedRefcount(parent_or_count)); |
| 11695 | return parent_or_count; |
| 11696 | } |
| 11697 | |
| 11698 | UPB_INLINE upb_Arena* _upb_Arena_PointerFromTagged(uintptr_t parent_or_count) { |
| 11699 | UPB_ASSERT(_upb_Arena_IsTaggedPointer(parent_or_count)); |
| 11700 | return (upb_Arena*)parent_or_count; |
| 11701 | } |
| 11702 | |
| 11703 | UPB_INLINE uintptr_t _upb_Arena_TaggedFromPointer(upb_Arena* a) { |
| 11704 | uintptr_t parent_or_count = (uintptr_t)a; |
| 11705 | UPB_ASSERT(_upb_Arena_IsTaggedPointer(parent_or_count)); |
| 11706 | return parent_or_count; |
| 11707 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 11708 | |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 11709 | UPB_INLINE upb_alloc* upb_Arena_BlockAlloc(upb_Arena* arena) { |
| 11710 | return (upb_alloc*)(arena->block_alloc & ~0x1); |
| 11711 | } |
| 11712 | |
| 11713 | UPB_INLINE uintptr_t upb_Arena_MakeBlockAlloc(upb_alloc* alloc, |
| 11714 | bool has_initial) { |
| 11715 | uintptr_t alloc_uint = (uintptr_t)alloc; |
| 11716 | UPB_ASSERT((alloc_uint & 1) == 0); |
| 11717 | return alloc_uint | (has_initial ? 1 : 0); |
| 11718 | } |
| 11719 | |
| 11720 | UPB_INLINE bool upb_Arena_HasInitialBlock(upb_Arena* arena) { |
| 11721 | return arena->block_alloc & 0x1; |
| 11722 | } |
| 11723 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 11724 | |
Sandy Zhang | e3b0943 | 2023-08-07 09:30:02 -0700 | [diff] [blame] | 11725 | #endif /* UPB_MEM_INTERNAL_ARENA_H_ */ |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11726 | |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 11727 | #ifndef UPB_PORT_ATOMIC_H_ |
| 11728 | #define UPB_PORT_ATOMIC_H_ |
| 11729 | |
| 11730 | |
| 11731 | #ifdef UPB_USE_C11_ATOMICS |
| 11732 | |
Protobuf Team Bot | 743bf92 | 2023-09-14 01:12:11 +0000 | [diff] [blame] | 11733 | // IWYU pragma: begin_exports |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 11734 | #include <stdatomic.h> |
| 11735 | #include <stdbool.h> |
Protobuf Team Bot | 743bf92 | 2023-09-14 01:12:11 +0000 | [diff] [blame] | 11736 | // IWYU pragma: end_exports |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 11737 | |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 11738 | #define upb_Atomic_Init(addr, val) atomic_init(addr, val) |
| 11739 | #define upb_Atomic_Load(addr, order) atomic_load_explicit(addr, order) |
| 11740 | #define upb_Atomic_Store(addr, val, order) \ |
| 11741 | atomic_store_explicit(addr, val, order) |
| 11742 | #define upb_Atomic_Add(addr, val, order) \ |
| 11743 | atomic_fetch_add_explicit(addr, val, order) |
| 11744 | #define upb_Atomic_Sub(addr, val, order) \ |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 11745 | atomic_fetch_sub_explicit(addr, val, order) |
| 11746 | #define upb_Atomic_Exchange(addr, val, order) \ |
| 11747 | atomic_exchange_explicit(addr, val, order) |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 11748 | #define upb_Atomic_CompareExchangeStrong(addr, expected, desired, \ |
| 11749 | success_order, failure_order) \ |
| 11750 | atomic_compare_exchange_strong_explicit(addr, expected, desired, \ |
| 11751 | success_order, failure_order) |
| 11752 | #define upb_Atomic_CompareExchangeWeak(addr, expected, desired, success_order, \ |
| 11753 | failure_order) \ |
| 11754 | atomic_compare_exchange_weak_explicit(addr, expected, desired, \ |
| 11755 | success_order, failure_order) |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 11756 | |
| 11757 | #else // !UPB_USE_C11_ATOMICS |
| 11758 | |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 11759 | #include <string.h> |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 11760 | |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 11761 | #define upb_Atomic_Init(addr, val) (*addr = val) |
| 11762 | #define upb_Atomic_Load(addr, order) (*addr) |
| 11763 | #define upb_Atomic_Store(addr, val, order) (*(addr) = val) |
| 11764 | #define upb_Atomic_Add(addr, val, order) (*(addr) += val) |
| 11765 | #define upb_Atomic_Sub(addr, val, order) (*(addr) -= val) |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 11766 | |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 11767 | UPB_INLINE void* _upb_NonAtomic_Exchange(void* addr, void* value) { |
| 11768 | void* old; |
| 11769 | memcpy(&old, addr, sizeof(value)); |
| 11770 | memcpy(addr, &value, sizeof(value)); |
| 11771 | return old; |
| 11772 | } |
| 11773 | |
| 11774 | #define upb_Atomic_Exchange(addr, val, order) _upb_NonAtomic_Exchange(addr, val) |
| 11775 | |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 11776 | // `addr` and `expected` are logically double pointers. |
| 11777 | UPB_INLINE bool _upb_NonAtomic_CompareExchangeStrongP(void* addr, |
| 11778 | void* expected, |
| 11779 | void* desired) { |
| 11780 | if (memcmp(addr, expected, sizeof(desired)) == 0) { |
| 11781 | memcpy(addr, &desired, sizeof(desired)); |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 11782 | return true; |
| 11783 | } else { |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 11784 | memcpy(expected, addr, sizeof(desired)); |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 11785 | return false; |
| 11786 | } |
| 11787 | } |
| 11788 | |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 11789 | #define upb_Atomic_CompareExchangeStrong(addr, expected, desired, \ |
| 11790 | success_order, failure_order) \ |
| 11791 | _upb_NonAtomic_CompareExchangeStrongP((void*)addr, (void*)expected, \ |
| 11792 | (void*)desired) |
| 11793 | #define upb_Atomic_CompareExchangeWeak(addr, expected, desired, success_order, \ |
| 11794 | failure_order) \ |
| 11795 | upb_Atomic_CompareExchangeStrong(addr, expected, desired, 0, 0) |
| 11796 | |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 11797 | #endif |
| 11798 | |
| 11799 | |
| 11800 | #endif // UPB_PORT_ATOMIC_H_ |
| 11801 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 11802 | #ifndef UPB_WIRE_READER_H_ |
| 11803 | #define UPB_WIRE_READER_H_ |
| 11804 | |
| 11805 | |
Sandy Zhang | e3b0943 | 2023-08-07 09:30:02 -0700 | [diff] [blame] | 11806 | #ifndef UPB_WIRE_INTERNAL_SWAP_H_ |
| 11807 | #define UPB_WIRE_INTERNAL_SWAP_H_ |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 11808 | |
Adam Cozzette | 7d5592e | 2023-08-23 12:15:26 -0700 | [diff] [blame] | 11809 | #include <stdint.h> |
| 11810 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 11811 | // Must be last. |
| 11812 | |
| 11813 | #ifdef __cplusplus |
| 11814 | extern "C" { |
| 11815 | #endif |
| 11816 | |
| 11817 | UPB_INLINE bool _upb_IsLittleEndian(void) { |
| 11818 | int x = 1; |
| 11819 | return *(char*)&x == 1; |
| 11820 | } |
| 11821 | |
| 11822 | UPB_INLINE uint32_t _upb_BigEndian_Swap32(uint32_t val) { |
| 11823 | if (_upb_IsLittleEndian()) return val; |
| 11824 | |
| 11825 | return ((val & 0xff) << 24) | ((val & 0xff00) << 8) | |
| 11826 | ((val & 0xff0000) >> 8) | ((val & 0xff000000) >> 24); |
| 11827 | } |
| 11828 | |
| 11829 | UPB_INLINE uint64_t _upb_BigEndian_Swap64(uint64_t val) { |
| 11830 | if (_upb_IsLittleEndian()) return val; |
| 11831 | |
| 11832 | return ((uint64_t)_upb_BigEndian_Swap32((uint32_t)val) << 32) | |
| 11833 | _upb_BigEndian_Swap32((uint32_t)(val >> 32)); |
| 11834 | } |
| 11835 | |
| 11836 | #ifdef __cplusplus |
| 11837 | } /* extern "C" */ |
| 11838 | #endif |
| 11839 | |
| 11840 | |
Sandy Zhang | e3b0943 | 2023-08-07 09:30:02 -0700 | [diff] [blame] | 11841 | #endif /* UPB_WIRE_INTERNAL_SWAP_H_ */ |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 11842 | |
Protobuf Team Bot | 743bf92 | 2023-09-14 01:12:11 +0000 | [diff] [blame] | 11843 | #ifndef UPB_WIRE_TYPES_H_ |
| 11844 | #define UPB_WIRE_TYPES_H_ |
| 11845 | |
| 11846 | // A list of types as they are encoded on the wire. |
| 11847 | typedef enum { |
| 11848 | kUpb_WireType_Varint = 0, |
| 11849 | kUpb_WireType_64Bit = 1, |
| 11850 | kUpb_WireType_Delimited = 2, |
| 11851 | kUpb_WireType_StartGroup = 3, |
| 11852 | kUpb_WireType_EndGroup = 4, |
| 11853 | kUpb_WireType_32Bit = 5 |
| 11854 | } upb_WireType; |
| 11855 | |
| 11856 | #endif /* UPB_WIRE_TYPES_H_ */ |
| 11857 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 11858 | // Must be last. |
| 11859 | |
| 11860 | #ifdef __cplusplus |
| 11861 | extern "C" { |
| 11862 | #endif |
| 11863 | |
| 11864 | // The upb_WireReader interface is suitable for general-purpose parsing of |
| 11865 | // protobuf binary wire format. It is designed to be used along with |
| 11866 | // upb_EpsCopyInputStream for buffering, and all parsing routines in this file |
| 11867 | // assume that at least kUpb_EpsCopyInputStream_SlopBytes worth of data is |
| 11868 | // available to read without any bounds checks. |
| 11869 | |
| 11870 | #define kUpb_WireReader_WireTypeMask 7 |
| 11871 | #define kUpb_WireReader_WireTypeBits 3 |
| 11872 | |
| 11873 | typedef struct { |
| 11874 | const char* ptr; |
| 11875 | uint64_t val; |
| 11876 | } _upb_WireReader_ReadLongVarintRet; |
| 11877 | |
| 11878 | _upb_WireReader_ReadLongVarintRet _upb_WireReader_ReadLongVarint( |
| 11879 | const char* ptr, uint64_t val); |
| 11880 | |
| 11881 | static UPB_FORCEINLINE const char* _upb_WireReader_ReadVarint(const char* ptr, |
| 11882 | uint64_t* val, |
| 11883 | int maxlen, |
| 11884 | uint64_t maxval) { |
| 11885 | uint64_t byte = (uint8_t)*ptr; |
| 11886 | if (UPB_LIKELY((byte & 0x80) == 0)) { |
| 11887 | *val = (uint32_t)byte; |
| 11888 | return ptr + 1; |
| 11889 | } |
| 11890 | const char* start = ptr; |
| 11891 | _upb_WireReader_ReadLongVarintRet res = |
| 11892 | _upb_WireReader_ReadLongVarint(ptr, byte); |
| 11893 | if (!res.ptr || (maxlen < 10 && res.ptr - start > maxlen) || |
| 11894 | res.val > maxval) { |
| 11895 | return NULL; // Malformed. |
| 11896 | } |
| 11897 | *val = res.val; |
| 11898 | return res.ptr; |
| 11899 | } |
| 11900 | |
| 11901 | // Parses a tag into `tag`, and returns a pointer past the end of the tag, or |
| 11902 | // NULL if there was an error in the tag data. |
| 11903 | // |
| 11904 | // REQUIRES: there must be at least 10 bytes of data available at `ptr`. |
| 11905 | // Bounds checks must be performed before calling this function, preferably |
| 11906 | // by calling upb_EpsCopyInputStream_IsDone(). |
| 11907 | static UPB_FORCEINLINE const char* upb_WireReader_ReadTag(const char* ptr, |
| 11908 | uint32_t* tag) { |
| 11909 | uint64_t val; |
| 11910 | ptr = _upb_WireReader_ReadVarint(ptr, &val, 5, UINT32_MAX); |
| 11911 | if (!ptr) return NULL; |
| 11912 | *tag = val; |
| 11913 | return ptr; |
| 11914 | } |
| 11915 | |
| 11916 | // Given a tag, returns the field number. |
| 11917 | UPB_INLINE uint32_t upb_WireReader_GetFieldNumber(uint32_t tag) { |
| 11918 | return tag >> kUpb_WireReader_WireTypeBits; |
| 11919 | } |
| 11920 | |
| 11921 | // Given a tag, returns the wire type. |
| 11922 | UPB_INLINE uint8_t upb_WireReader_GetWireType(uint32_t tag) { |
| 11923 | return tag & kUpb_WireReader_WireTypeMask; |
| 11924 | } |
| 11925 | |
| 11926 | UPB_INLINE const char* upb_WireReader_ReadVarint(const char* ptr, |
| 11927 | uint64_t* val) { |
| 11928 | return _upb_WireReader_ReadVarint(ptr, val, 10, UINT64_MAX); |
| 11929 | } |
| 11930 | |
| 11931 | // Skips data for a varint, returning a pointer past the end of the varint, or |
| 11932 | // NULL if there was an error in the varint data. |
| 11933 | // |
| 11934 | // REQUIRES: there must be at least 10 bytes of data available at `ptr`. |
| 11935 | // Bounds checks must be performed before calling this function, preferably |
| 11936 | // by calling upb_EpsCopyInputStream_IsDone(). |
| 11937 | UPB_INLINE const char* upb_WireReader_SkipVarint(const char* ptr) { |
| 11938 | uint64_t val; |
| 11939 | return upb_WireReader_ReadVarint(ptr, &val); |
| 11940 | } |
| 11941 | |
| 11942 | // Reads a varint indicating the size of a delimited field into `size`, or |
| 11943 | // NULL if there was an error in the varint data. |
| 11944 | // |
| 11945 | // REQUIRES: there must be at least 10 bytes of data available at `ptr`. |
| 11946 | // Bounds checks must be performed before calling this function, preferably |
| 11947 | // by calling upb_EpsCopyInputStream_IsDone(). |
| 11948 | UPB_INLINE const char* upb_WireReader_ReadSize(const char* ptr, int* size) { |
| 11949 | uint64_t size64; |
| 11950 | ptr = upb_WireReader_ReadVarint(ptr, &size64); |
| 11951 | if (!ptr || size64 >= INT32_MAX) return NULL; |
| 11952 | *size = size64; |
| 11953 | return ptr; |
| 11954 | } |
| 11955 | |
| 11956 | // Reads a fixed32 field, performing byte swapping if necessary. |
| 11957 | // |
| 11958 | // REQUIRES: there must be at least 4 bytes of data available at `ptr`. |
| 11959 | // Bounds checks must be performed before calling this function, preferably |
| 11960 | // by calling upb_EpsCopyInputStream_IsDone(). |
| 11961 | UPB_INLINE const char* upb_WireReader_ReadFixed32(const char* ptr, void* val) { |
| 11962 | uint32_t uval; |
| 11963 | memcpy(&uval, ptr, 4); |
| 11964 | uval = _upb_BigEndian_Swap32(uval); |
| 11965 | memcpy(val, &uval, 4); |
| 11966 | return ptr + 4; |
| 11967 | } |
| 11968 | |
| 11969 | // Reads a fixed64 field, performing byte swapping if necessary. |
| 11970 | // |
| 11971 | // REQUIRES: there must be at least 4 bytes of data available at `ptr`. |
| 11972 | // Bounds checks must be performed before calling this function, preferably |
| 11973 | // by calling upb_EpsCopyInputStream_IsDone(). |
| 11974 | UPB_INLINE const char* upb_WireReader_ReadFixed64(const char* ptr, void* val) { |
| 11975 | uint64_t uval; |
| 11976 | memcpy(&uval, ptr, 8); |
| 11977 | uval = _upb_BigEndian_Swap64(uval); |
| 11978 | memcpy(val, &uval, 8); |
| 11979 | return ptr + 8; |
| 11980 | } |
| 11981 | |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 11982 | const char* _upb_WireReader_SkipGroup(const char* ptr, uint32_t tag, |
| 11983 | int depth_limit, |
| 11984 | upb_EpsCopyInputStream* stream); |
| 11985 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 11986 | // Skips data for a group, returning a pointer past the end of the group, or |
| 11987 | // NULL if there was an error parsing the group. The `tag` argument should be |
| 11988 | // the start group tag that begins the group. The `depth_limit` argument |
| 11989 | // indicates how many levels of recursion the group is allowed to have before |
| 11990 | // reporting a parse error (this limit exists to protect against stack |
| 11991 | // overflow). |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 11992 | // |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 11993 | // TODO: evaluate how the depth_limit should be specified. Do users need |
| 11994 | // control over this? |
| 11995 | UPB_INLINE const char* upb_WireReader_SkipGroup( |
| 11996 | const char* ptr, uint32_t tag, upb_EpsCopyInputStream* stream) { |
| 11997 | return _upb_WireReader_SkipGroup(ptr, tag, 100, stream); |
| 11998 | } |
| 11999 | |
| 12000 | UPB_INLINE const char* _upb_WireReader_SkipValue( |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 12001 | const char* ptr, uint32_t tag, int depth_limit, |
| 12002 | upb_EpsCopyInputStream* stream) { |
| 12003 | switch (upb_WireReader_GetWireType(tag)) { |
| 12004 | case kUpb_WireType_Varint: |
| 12005 | return upb_WireReader_SkipVarint(ptr); |
| 12006 | case kUpb_WireType_32Bit: |
| 12007 | return ptr + 4; |
| 12008 | case kUpb_WireType_64Bit: |
| 12009 | return ptr + 8; |
| 12010 | case kUpb_WireType_Delimited: { |
| 12011 | int size; |
| 12012 | ptr = upb_WireReader_ReadSize(ptr, &size); |
| 12013 | if (!ptr) return NULL; |
| 12014 | ptr += size; |
| 12015 | return ptr; |
| 12016 | } |
| 12017 | case kUpb_WireType_StartGroup: |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 12018 | return _upb_WireReader_SkipGroup(ptr, tag, depth_limit, stream); |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 12019 | case kUpb_WireType_EndGroup: |
| 12020 | return NULL; // Should be handled before now. |
| 12021 | default: |
| 12022 | return NULL; // Unknown wire type. |
| 12023 | } |
| 12024 | } |
| 12025 | |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 12026 | // Skips data for a wire value of any type, returning a pointer past the end of |
| 12027 | // the data, or NULL if there was an error parsing the group. The `tag` argument |
| 12028 | // should be the tag that was just parsed. The `depth_limit` argument indicates |
| 12029 | // how many levels of recursion a group is allowed to have before reporting a |
| 12030 | // parse error (this limit exists to protect against stack overflow). |
| 12031 | // |
| 12032 | // REQUIRES: there must be at least 10 bytes of data available at `ptr`. |
| 12033 | // Bounds checks must be performed before calling this function, preferably |
| 12034 | // by calling upb_EpsCopyInputStream_IsDone(). |
| 12035 | // |
| 12036 | // TODO: evaluate how the depth_limit should be specified. Do users need |
| 12037 | // control over this? |
| 12038 | UPB_INLINE const char* upb_WireReader_SkipValue( |
| 12039 | const char* ptr, uint32_t tag, upb_EpsCopyInputStream* stream) { |
| 12040 | return _upb_WireReader_SkipValue(ptr, tag, 100, stream); |
| 12041 | } |
| 12042 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 12043 | #ifdef __cplusplus |
| 12044 | } /* extern "C" */ |
| 12045 | #endif |
| 12046 | |
| 12047 | |
| 12048 | #endif // UPB_WIRE_READER_H_ |
| 12049 | |
Adam Cozzette | 8059da2 | 2023-08-16 07:57:14 -0700 | [diff] [blame] | 12050 | #ifndef UPB_MINI_DESCRIPTOR_INTERNAL_DECODER_H_ |
| 12051 | #define UPB_MINI_DESCRIPTOR_INTERNAL_DECODER_H_ |
| 12052 | |
| 12053 | |
| 12054 | #ifndef UPB_MINI_DESCRIPTOR_INTERNAL_BASE92_H_ |
| 12055 | #define UPB_MINI_DESCRIPTOR_INTERNAL_BASE92_H_ |
| 12056 | |
Adam Cozzette | 7d5592e | 2023-08-23 12:15:26 -0700 | [diff] [blame] | 12057 | #include <stdint.h> |
| 12058 | |
Adam Cozzette | 8059da2 | 2023-08-16 07:57:14 -0700 | [diff] [blame] | 12059 | |
| 12060 | // Must be last. |
| 12061 | |
| 12062 | #ifdef __cplusplus |
| 12063 | extern "C" { |
| 12064 | #endif |
| 12065 | |
| 12066 | UPB_INLINE char _upb_ToBase92(int8_t ch) { |
| 12067 | extern const char _kUpb_ToBase92[]; |
| 12068 | UPB_ASSERT(0 <= ch && ch < 92); |
| 12069 | return _kUpb_ToBase92[ch]; |
| 12070 | } |
| 12071 | |
| 12072 | UPB_INLINE char _upb_FromBase92(uint8_t ch) { |
| 12073 | extern const int8_t _kUpb_FromBase92[]; |
| 12074 | if (' ' > ch || ch > '~') return -1; |
| 12075 | return _kUpb_FromBase92[ch - ' ']; |
| 12076 | } |
| 12077 | |
| 12078 | UPB_INLINE const char* _upb_Base92_DecodeVarint(const char* ptr, |
| 12079 | const char* end, char first_ch, |
| 12080 | uint8_t min, uint8_t max, |
| 12081 | uint32_t* out_val) { |
| 12082 | uint32_t val = 0; |
| 12083 | uint32_t shift = 0; |
| 12084 | const int bits_per_char = |
| 12085 | upb_Log2Ceiling(_upb_FromBase92(max) - _upb_FromBase92(min)); |
| 12086 | char ch = first_ch; |
| 12087 | while (1) { |
| 12088 | uint32_t bits = _upb_FromBase92(ch) - _upb_FromBase92(min); |
| 12089 | val |= bits << shift; |
| 12090 | if (ptr == end || *ptr < min || max < *ptr) { |
| 12091 | *out_val = val; |
| 12092 | UPB_ASSUME(ptr != NULL); |
| 12093 | return ptr; |
| 12094 | } |
| 12095 | ch = *ptr++; |
| 12096 | shift += bits_per_char; |
| 12097 | if (shift >= 32) return NULL; |
| 12098 | } |
| 12099 | } |
| 12100 | |
| 12101 | #ifdef __cplusplus |
| 12102 | } /* extern "C" */ |
| 12103 | #endif |
| 12104 | |
| 12105 | |
| 12106 | #endif // UPB_MINI_DESCRIPTOR_INTERNAL_BASE92_H_ |
| 12107 | |
| 12108 | // Must be last. |
| 12109 | |
| 12110 | // upb_MdDecoder: used internally for decoding MiniDescriptors for messages, |
| 12111 | // extensions, and enums. |
| 12112 | typedef struct { |
| 12113 | const char* end; |
| 12114 | upb_Status* status; |
| 12115 | jmp_buf err; |
| 12116 | } upb_MdDecoder; |
| 12117 | |
| 12118 | UPB_PRINTF(2, 3) |
| 12119 | UPB_NORETURN UPB_INLINE void upb_MdDecoder_ErrorJmp(upb_MdDecoder* d, |
| 12120 | const char* fmt, ...) { |
| 12121 | if (d->status) { |
| 12122 | va_list argp; |
| 12123 | upb_Status_SetErrorMessage(d->status, "Error building mini table: "); |
| 12124 | va_start(argp, fmt); |
| 12125 | upb_Status_VAppendErrorFormat(d->status, fmt, argp); |
| 12126 | va_end(argp); |
| 12127 | } |
| 12128 | UPB_LONGJMP(d->err, 1); |
| 12129 | } |
| 12130 | |
| 12131 | UPB_INLINE void upb_MdDecoder_CheckOutOfMemory(upb_MdDecoder* d, |
| 12132 | const void* ptr) { |
| 12133 | if (!ptr) upb_MdDecoder_ErrorJmp(d, "Out of memory"); |
| 12134 | } |
| 12135 | |
| 12136 | UPB_INLINE const char* upb_MdDecoder_DecodeBase92Varint( |
| 12137 | upb_MdDecoder* d, const char* ptr, char first_ch, uint8_t min, uint8_t max, |
| 12138 | uint32_t* out_val) { |
| 12139 | ptr = _upb_Base92_DecodeVarint(ptr, d->end, first_ch, min, max, out_val); |
| 12140 | if (!ptr) upb_MdDecoder_ErrorJmp(d, "Overlong varint"); |
| 12141 | return ptr; |
| 12142 | } |
| 12143 | |
| 12144 | |
| 12145 | #endif // UPB_MINI_DESCRIPTOR_INTERNAL_DECODER_H_ |
| 12146 | |
| 12147 | #ifndef UPB_MINI_DESCRIPTOR_INTERNAL_WIRE_CONSTANTS_H_ |
| 12148 | #define UPB_MINI_DESCRIPTOR_INTERNAL_WIRE_CONSTANTS_H_ |
| 12149 | |
| 12150 | |
| 12151 | // Must be last. |
| 12152 | |
| 12153 | typedef enum { |
| 12154 | kUpb_EncodedType_Double = 0, |
| 12155 | kUpb_EncodedType_Float = 1, |
| 12156 | kUpb_EncodedType_Fixed32 = 2, |
| 12157 | kUpb_EncodedType_Fixed64 = 3, |
| 12158 | kUpb_EncodedType_SFixed32 = 4, |
| 12159 | kUpb_EncodedType_SFixed64 = 5, |
| 12160 | kUpb_EncodedType_Int32 = 6, |
| 12161 | kUpb_EncodedType_UInt32 = 7, |
| 12162 | kUpb_EncodedType_SInt32 = 8, |
| 12163 | kUpb_EncodedType_Int64 = 9, |
| 12164 | kUpb_EncodedType_UInt64 = 10, |
| 12165 | kUpb_EncodedType_SInt64 = 11, |
| 12166 | kUpb_EncodedType_OpenEnum = 12, |
| 12167 | kUpb_EncodedType_Bool = 13, |
| 12168 | kUpb_EncodedType_Bytes = 14, |
| 12169 | kUpb_EncodedType_String = 15, |
| 12170 | kUpb_EncodedType_Group = 16, |
| 12171 | kUpb_EncodedType_Message = 17, |
| 12172 | kUpb_EncodedType_ClosedEnum = 18, |
| 12173 | |
| 12174 | kUpb_EncodedType_RepeatedBase = 20, |
| 12175 | } upb_EncodedType; |
| 12176 | |
| 12177 | typedef enum { |
| 12178 | kUpb_EncodedFieldModifier_FlipPacked = 1 << 0, |
| 12179 | kUpb_EncodedFieldModifier_IsRequired = 1 << 1, |
| 12180 | kUpb_EncodedFieldModifier_IsProto3Singular = 1 << 2, |
| 12181 | } upb_EncodedFieldModifier; |
| 12182 | |
| 12183 | enum { |
| 12184 | kUpb_EncodedValue_MinField = ' ', |
| 12185 | kUpb_EncodedValue_MaxField = 'I', |
| 12186 | kUpb_EncodedValue_MinModifier = 'L', |
| 12187 | kUpb_EncodedValue_MaxModifier = '[', |
| 12188 | kUpb_EncodedValue_End = '^', |
| 12189 | kUpb_EncodedValue_MinSkip = '_', |
| 12190 | kUpb_EncodedValue_MaxSkip = '~', |
| 12191 | kUpb_EncodedValue_OneofSeparator = '~', |
| 12192 | kUpb_EncodedValue_FieldSeparator = '|', |
| 12193 | kUpb_EncodedValue_MinOneofField = ' ', |
| 12194 | kUpb_EncodedValue_MaxOneofField = 'b', |
| 12195 | kUpb_EncodedValue_MaxEnumMask = 'A', |
| 12196 | }; |
| 12197 | |
| 12198 | enum { |
| 12199 | kUpb_EncodedVersion_EnumV1 = '!', |
| 12200 | kUpb_EncodedVersion_ExtensionV1 = '#', |
| 12201 | kUpb_EncodedVersion_MapV1 = '%', |
| 12202 | kUpb_EncodedVersion_MessageV1 = '$', |
| 12203 | kUpb_EncodedVersion_MessageSetV1 = '&', |
| 12204 | }; |
| 12205 | |
| 12206 | |
| 12207 | #endif // UPB_MINI_DESCRIPTOR_INTERNAL_WIRE_CONSTANTS_H_ |
| 12208 | |
| 12209 | #ifndef UPB_MINI_DESCRIPTOR_INTERNAL_MODIFIERS_H_ |
| 12210 | #define UPB_MINI_DESCRIPTOR_INTERNAL_MODIFIERS_H_ |
| 12211 | |
| 12212 | // Must be last. |
| 12213 | |
| 12214 | typedef enum { |
| 12215 | kUpb_FieldModifier_IsRepeated = 1 << 0, |
| 12216 | kUpb_FieldModifier_IsPacked = 1 << 1, |
| 12217 | kUpb_FieldModifier_IsClosedEnum = 1 << 2, |
| 12218 | kUpb_FieldModifier_IsProto3Singular = 1 << 3, |
| 12219 | kUpb_FieldModifier_IsRequired = 1 << 4, |
| 12220 | } kUpb_FieldModifier; |
| 12221 | |
| 12222 | typedef enum { |
| 12223 | kUpb_MessageModifier_ValidateUtf8 = 1 << 0, |
| 12224 | kUpb_MessageModifier_DefaultIsPacked = 1 << 1, |
| 12225 | kUpb_MessageModifier_IsExtendable = 1 << 2, |
| 12226 | } kUpb_MessageModifier; |
| 12227 | |
| 12228 | |
| 12229 | #endif // UPB_MINI_DESCRIPTOR_INTERNAL_MODIFIERS_H_ |
| 12230 | |
| 12231 | #ifndef UPB_MINI_DESCRIPTOR_INTERNAL_ENCODE_H_ |
| 12232 | #define UPB_MINI_DESCRIPTOR_INTERNAL_ENCODE_H_ |
| 12233 | |
Adam Cozzette | 7d5592e | 2023-08-23 12:15:26 -0700 | [diff] [blame] | 12234 | #include <stdint.h> |
| 12235 | |
Adam Cozzette | 8059da2 | 2023-08-16 07:57:14 -0700 | [diff] [blame] | 12236 | |
| 12237 | // Must be last. |
| 12238 | |
| 12239 | // If the input buffer has at least this many bytes available, the encoder call |
| 12240 | // is guaranteed to succeed (as long as field number order is maintained). |
| 12241 | #define kUpb_MtDataEncoder_MinSize 16 |
| 12242 | |
| 12243 | typedef struct { |
| 12244 | char* end; // Limit of the buffer passed as a parameter. |
| 12245 | // Aliased to internal-only members in .cc. |
| 12246 | char internal[32]; |
| 12247 | } upb_MtDataEncoder; |
| 12248 | |
| 12249 | #ifdef __cplusplus |
| 12250 | extern "C" { |
| 12251 | #endif |
| 12252 | |
| 12253 | // Encodes field/oneof information for a given message. The sequence of calls |
| 12254 | // should look like: |
| 12255 | // |
| 12256 | // upb_MtDataEncoder e; |
| 12257 | // char buf[256]; |
| 12258 | // char* ptr = buf; |
| 12259 | // e.end = ptr + sizeof(buf); |
| 12260 | // unit64_t msg_mod = ...; // bitwise & of kUpb_MessageModifiers or zero |
| 12261 | // ptr = upb_MtDataEncoder_StartMessage(&e, ptr, msg_mod); |
| 12262 | // // Fields *must* be in field number order. |
| 12263 | // ptr = upb_MtDataEncoder_PutField(&e, ptr, ...); |
| 12264 | // ptr = upb_MtDataEncoder_PutField(&e, ptr, ...); |
| 12265 | // ptr = upb_MtDataEncoder_PutField(&e, ptr, ...); |
| 12266 | // |
| 12267 | // // If oneofs are present. Oneofs must be encoded after regular fields. |
| 12268 | // ptr = upb_MiniTable_StartOneof(&e, ptr) |
| 12269 | // ptr = upb_MiniTable_PutOneofField(&e, ptr, ...); |
| 12270 | // ptr = upb_MiniTable_PutOneofField(&e, ptr, ...); |
| 12271 | // |
| 12272 | // ptr = upb_MiniTable_StartOneof(&e, ptr); |
| 12273 | // ptr = upb_MiniTable_PutOneofField(&e, ptr, ...); |
| 12274 | // ptr = upb_MiniTable_PutOneofField(&e, ptr, ...); |
| 12275 | // |
| 12276 | // Oneofs must be encoded after all regular fields. |
| 12277 | char* upb_MtDataEncoder_StartMessage(upb_MtDataEncoder* e, char* ptr, |
| 12278 | uint64_t msg_mod); |
| 12279 | char* upb_MtDataEncoder_PutField(upb_MtDataEncoder* e, char* ptr, |
| 12280 | upb_FieldType type, uint32_t field_num, |
| 12281 | uint64_t field_mod); |
| 12282 | char* upb_MtDataEncoder_StartOneof(upb_MtDataEncoder* e, char* ptr); |
| 12283 | char* upb_MtDataEncoder_PutOneofField(upb_MtDataEncoder* e, char* ptr, |
| 12284 | uint32_t field_num); |
| 12285 | |
| 12286 | // Encodes the set of values for a given enum. The values must be given in |
| 12287 | // order (after casting to uint32_t), and repeats are not allowed. |
| 12288 | char* upb_MtDataEncoder_StartEnum(upb_MtDataEncoder* e, char* ptr); |
| 12289 | char* upb_MtDataEncoder_PutEnumValue(upb_MtDataEncoder* e, char* ptr, |
| 12290 | uint32_t val); |
| 12291 | char* upb_MtDataEncoder_EndEnum(upb_MtDataEncoder* e, char* ptr); |
| 12292 | |
| 12293 | // Encodes an entire mini descriptor for an extension. |
| 12294 | char* upb_MtDataEncoder_EncodeExtension(upb_MtDataEncoder* e, char* ptr, |
| 12295 | upb_FieldType type, uint32_t field_num, |
| 12296 | uint64_t field_mod); |
| 12297 | |
| 12298 | // Encodes an entire mini descriptor for a map. |
| 12299 | char* upb_MtDataEncoder_EncodeMap(upb_MtDataEncoder* e, char* ptr, |
| 12300 | upb_FieldType key_type, |
| 12301 | upb_FieldType value_type, uint64_t key_mod, |
| 12302 | uint64_t value_mod); |
| 12303 | |
| 12304 | // Encodes an entire mini descriptor for a message set. |
| 12305 | char* upb_MtDataEncoder_EncodeMessageSet(upb_MtDataEncoder* e, char* ptr); |
| 12306 | |
| 12307 | #ifdef __cplusplus |
| 12308 | } /* extern "C" */ |
| 12309 | #endif |
| 12310 | |
| 12311 | |
| 12312 | #endif /* UPB_MINI_DESCRIPTOR_INTERNAL_ENCODE_H_ */ |
| 12313 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12314 | #ifndef UPB_REFLECTION_DEF_POOL_INTERNAL_H_ |
| 12315 | #define UPB_REFLECTION_DEF_POOL_INTERNAL_H_ |
| 12316 | |
| 12317 | |
| 12318 | // Must be last. |
| 12319 | |
| 12320 | #ifdef __cplusplus |
| 12321 | extern "C" { |
| 12322 | #endif |
| 12323 | |
| 12324 | upb_Arena* _upb_DefPool_Arena(const upb_DefPool* s); |
| 12325 | size_t _upb_DefPool_BytesLoaded(const upb_DefPool* s); |
| 12326 | upb_ExtensionRegistry* _upb_DefPool_ExtReg(const upb_DefPool* s); |
| 12327 | |
| 12328 | bool _upb_DefPool_InsertExt(upb_DefPool* s, const upb_MiniTableExtension* ext, |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 12329 | const upb_FieldDef* f); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12330 | bool _upb_DefPool_InsertSym(upb_DefPool* s, upb_StringView sym, upb_value v, |
| 12331 | upb_Status* status); |
| 12332 | bool _upb_DefPool_LookupSym(const upb_DefPool* s, const char* sym, size_t size, |
| 12333 | upb_value* v); |
| 12334 | |
| 12335 | void** _upb_DefPool_ScratchData(const upb_DefPool* s); |
| 12336 | size_t* _upb_DefPool_ScratchSize(const upb_DefPool* s); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 12337 | void _upb_DefPool_SetPlatform(upb_DefPool* s, upb_MiniTablePlatform platform); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12338 | |
| 12339 | // For generated code only: loads a generated descriptor. |
| 12340 | typedef struct _upb_DefPool_Init { |
| 12341 | struct _upb_DefPool_Init** deps; // Dependencies of this file. |
| 12342 | const upb_MiniTableFile* layout; |
| 12343 | const char* filename; |
| 12344 | upb_StringView descriptor; // Serialized descriptor. |
| 12345 | } _upb_DefPool_Init; |
| 12346 | |
| 12347 | bool _upb_DefPool_LoadDefInit(upb_DefPool* s, const _upb_DefPool_Init* init); |
| 12348 | |
| 12349 | // Should only be directly called by tests. This variant lets us suppress |
| 12350 | // the use of compiled-in tables, forcing a rebuild of the tables at runtime. |
| 12351 | bool _upb_DefPool_LoadDefInitEx(upb_DefPool* s, const _upb_DefPool_Init* init, |
| 12352 | bool rebuild_minitable); |
| 12353 | |
| 12354 | #ifdef __cplusplus |
| 12355 | } /* extern "C" */ |
| 12356 | #endif |
| 12357 | |
| 12358 | |
| 12359 | #endif /* UPB_REFLECTION_DEF_POOL_INTERNAL_H_ */ |
| 12360 | |
Protobuf Team Bot | 7be2a45 | 2023-09-13 16:50:05 +0000 | [diff] [blame] | 12361 | #ifndef UPB_REFLECTION_DEF_BUILDER_INTERNAL_H_ |
| 12362 | #define UPB_REFLECTION_DEF_BUILDER_INTERNAL_H_ |
| 12363 | |
| 12364 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12365 | // Must be last. |
| 12366 | |
| 12367 | // We want to copy the options verbatim into the destination options proto. |
| 12368 | // We use serialize+parse as our deep copy. |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 12369 | #define UPB_DEF_SET_OPTIONS(target, desc_type, options_type, proto) \ |
| 12370 | if (UPB_DESC(desc_type##_has_options)(proto)) { \ |
| 12371 | size_t size; \ |
| 12372 | char* pb = UPB_DESC(options_type##_serialize)( \ |
| 12373 | UPB_DESC(desc_type##_options)(proto), ctx->tmp_arena, &size); \ |
| 12374 | if (!pb) _upb_DefBuilder_OomErr(ctx); \ |
| 12375 | target = \ |
| 12376 | UPB_DESC(options_type##_parse)(pb, size, _upb_DefBuilder_Arena(ctx)); \ |
| 12377 | if (!target) _upb_DefBuilder_OomErr(ctx); \ |
| 12378 | } else { \ |
| 12379 | target = (const UPB_DESC(options_type)*)kUpbDefOptDefault; \ |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12380 | } |
| 12381 | |
| 12382 | #ifdef __cplusplus |
| 12383 | extern "C" { |
| 12384 | #endif |
| 12385 | |
| 12386 | struct upb_DefBuilder { |
| 12387 | upb_DefPool* symtab; |
| 12388 | upb_FileDef* file; // File we are building. |
| 12389 | upb_Arena* arena; // Allocate defs here. |
| 12390 | upb_Arena* tmp_arena; // For temporary allocations. |
| 12391 | upb_Status* status; // Record errors here. |
| 12392 | const upb_MiniTableFile* layout; // NULL if we should build layouts. |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 12393 | upb_MiniTablePlatform platform; // Platform we are targeting. |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12394 | int enum_count; // Count of enums built so far. |
| 12395 | int msg_count; // Count of messages built so far. |
| 12396 | int ext_count; // Count of extensions built so far. |
| 12397 | jmp_buf err; // longjmp() on error. |
| 12398 | }; |
| 12399 | |
| 12400 | extern const char* kUpbDefOptDefault; |
| 12401 | |
| 12402 | // ctx->status has already been set elsewhere so just fail/longjmp() |
| 12403 | UPB_NORETURN void _upb_DefBuilder_FailJmp(upb_DefBuilder* ctx); |
| 12404 | |
| 12405 | UPB_NORETURN void _upb_DefBuilder_Errf(upb_DefBuilder* ctx, const char* fmt, |
| 12406 | ...) UPB_PRINTF(2, 3); |
| 12407 | UPB_NORETURN void _upb_DefBuilder_OomErr(upb_DefBuilder* ctx); |
| 12408 | |
| 12409 | const char* _upb_DefBuilder_MakeFullName(upb_DefBuilder* ctx, |
| 12410 | const char* prefix, |
| 12411 | upb_StringView name); |
| 12412 | |
| 12413 | // Given a symbol and the base symbol inside which it is defined, |
| 12414 | // find the symbol's definition. |
| 12415 | const void* _upb_DefBuilder_ResolveAny(upb_DefBuilder* ctx, |
| 12416 | const char* from_name_dbg, |
| 12417 | const char* base, upb_StringView sym, |
| 12418 | upb_deftype_t* type); |
| 12419 | |
| 12420 | const void* _upb_DefBuilder_Resolve(upb_DefBuilder* ctx, |
| 12421 | const char* from_name_dbg, const char* base, |
| 12422 | upb_StringView sym, upb_deftype_t type); |
| 12423 | |
| 12424 | char _upb_DefBuilder_ParseEscape(upb_DefBuilder* ctx, const upb_FieldDef* f, |
| 12425 | const char** src, const char* end); |
| 12426 | |
| 12427 | const char* _upb_DefBuilder_FullToShort(const char* fullname); |
| 12428 | |
| 12429 | UPB_INLINE void* _upb_DefBuilder_Alloc(upb_DefBuilder* ctx, size_t bytes) { |
| 12430 | if (bytes == 0) return NULL; |
| 12431 | void* ret = upb_Arena_Malloc(ctx->arena, bytes); |
| 12432 | if (!ret) _upb_DefBuilder_OomErr(ctx); |
| 12433 | return ret; |
| 12434 | } |
| 12435 | |
| 12436 | // Adds a symbol |v| to the symtab, which must be a def pointer previously |
| 12437 | // packed with pack_def(). The def's pointer to upb_FileDef* must be set before |
| 12438 | // adding, so we know which entries to remove if building this file fails. |
| 12439 | UPB_INLINE void _upb_DefBuilder_Add(upb_DefBuilder* ctx, const char* name, |
| 12440 | upb_value v) { |
| 12441 | upb_StringView sym = {.data = name, .size = strlen(name)}; |
| 12442 | bool ok = _upb_DefPool_InsertSym(ctx->symtab, sym, v, ctx->status); |
| 12443 | if (!ok) _upb_DefBuilder_FailJmp(ctx); |
| 12444 | } |
| 12445 | |
| 12446 | UPB_INLINE upb_Arena* _upb_DefBuilder_Arena(const upb_DefBuilder* ctx) { |
| 12447 | return ctx->arena; |
| 12448 | } |
| 12449 | |
| 12450 | UPB_INLINE upb_FileDef* _upb_DefBuilder_File(const upb_DefBuilder* ctx) { |
| 12451 | return ctx->file; |
| 12452 | } |
| 12453 | |
| 12454 | // This version of CheckIdent() is only called by other, faster versions after |
| 12455 | // they detect a parsing error. |
| 12456 | void _upb_DefBuilder_CheckIdentSlow(upb_DefBuilder* ctx, upb_StringView name, |
| 12457 | bool full); |
| 12458 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12459 | // Verify a full identifier string. This is slightly more complicated than |
| 12460 | // verifying a relative identifier string because we must track '.' chars. |
| 12461 | UPB_INLINE void _upb_DefBuilder_CheckIdentFull(upb_DefBuilder* ctx, |
| 12462 | upb_StringView name) { |
| 12463 | bool good = name.size > 0; |
| 12464 | bool start = true; |
| 12465 | |
| 12466 | for (size_t i = 0; i < name.size; i++) { |
| 12467 | const char c = name.data[i]; |
| 12468 | const char d = c | 0x20; // force lowercase |
| 12469 | const bool is_alpha = (('a' <= d) & (d <= 'z')) | (c == '_'); |
| 12470 | const bool is_numer = ('0' <= c) & (c <= '9') & !start; |
| 12471 | const bool is_dot = (c == '.') & !start; |
| 12472 | |
| 12473 | good &= is_alpha | is_numer | is_dot; |
| 12474 | start = is_dot; |
| 12475 | } |
| 12476 | |
| 12477 | if (!good) _upb_DefBuilder_CheckIdentSlow(ctx, name, true); |
| 12478 | } |
| 12479 | |
| 12480 | #ifdef __cplusplus |
| 12481 | } /* extern "C" */ |
| 12482 | #endif |
| 12483 | |
| 12484 | |
| 12485 | #endif /* UPB_REFLECTION_DEF_BUILDER_INTERNAL_H_ */ |
| 12486 | |
| 12487 | #ifndef UPB_REFLECTION_ENUM_DEF_INTERNAL_H_ |
| 12488 | #define UPB_REFLECTION_ENUM_DEF_INTERNAL_H_ |
| 12489 | |
| 12490 | |
| 12491 | // Must be last. |
| 12492 | |
| 12493 | #ifdef __cplusplus |
| 12494 | extern "C" { |
| 12495 | #endif |
| 12496 | |
| 12497 | upb_EnumDef* _upb_EnumDef_At(const upb_EnumDef* e, int i); |
| 12498 | bool _upb_EnumDef_Insert(upb_EnumDef* e, upb_EnumValueDef* v, upb_Arena* a); |
| 12499 | const upb_MiniTableEnum* _upb_EnumDef_MiniTable(const upb_EnumDef* e); |
| 12500 | |
| 12501 | // Allocate and initialize an array of |n| enum defs. |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 12502 | upb_EnumDef* _upb_EnumDefs_New( |
| 12503 | upb_DefBuilder* ctx, int n, |
| 12504 | const UPB_DESC(EnumDescriptorProto) * const* protos, |
| 12505 | const upb_MessageDef* containing_type); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12506 | |
| 12507 | #ifdef __cplusplus |
| 12508 | } /* extern "C" */ |
| 12509 | #endif |
| 12510 | |
| 12511 | |
| 12512 | #endif /* UPB_REFLECTION_ENUM_DEF_INTERNAL_H_ */ |
| 12513 | |
| 12514 | #ifndef UPB_REFLECTION_ENUM_VALUE_DEF_INTERNAL_H_ |
| 12515 | #define UPB_REFLECTION_ENUM_VALUE_DEF_INTERNAL_H_ |
| 12516 | |
| 12517 | |
| 12518 | // Must be last. |
| 12519 | |
| 12520 | #ifdef __cplusplus |
| 12521 | extern "C" { |
| 12522 | #endif |
| 12523 | |
| 12524 | upb_EnumValueDef* _upb_EnumValueDef_At(const upb_EnumValueDef* v, int i); |
| 12525 | |
| 12526 | // Allocate and initialize an array of |n| enum value defs owned by |e|. |
| 12527 | upb_EnumValueDef* _upb_EnumValueDefs_New( |
| 12528 | upb_DefBuilder* ctx, const char* prefix, int n, |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 12529 | const UPB_DESC(EnumValueDescriptorProto) * const* protos, upb_EnumDef* e, |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12530 | bool* is_sorted); |
| 12531 | |
| 12532 | const upb_EnumValueDef** _upb_EnumValueDefs_Sorted(const upb_EnumValueDef* v, |
| 12533 | int n, upb_Arena* a); |
| 12534 | |
| 12535 | #ifdef __cplusplus |
| 12536 | } /* extern "C" */ |
| 12537 | #endif |
| 12538 | |
| 12539 | |
| 12540 | #endif /* UPB_REFLECTION_ENUM_VALUE_DEF_INTERNAL_H_ */ |
| 12541 | |
| 12542 | #ifndef UPB_REFLECTION_FIELD_DEF_INTERNAL_H_ |
| 12543 | #define UPB_REFLECTION_FIELD_DEF_INTERNAL_H_ |
| 12544 | |
| 12545 | |
| 12546 | // Must be last. |
| 12547 | |
| 12548 | #ifdef __cplusplus |
| 12549 | extern "C" { |
| 12550 | #endif |
| 12551 | |
| 12552 | upb_FieldDef* _upb_FieldDef_At(const upb_FieldDef* f, int i); |
| 12553 | |
| 12554 | const upb_MiniTableExtension* _upb_FieldDef_ExtensionMiniTable( |
| 12555 | const upb_FieldDef* f); |
| 12556 | bool _upb_FieldDef_IsClosedEnum(const upb_FieldDef* f); |
| 12557 | bool _upb_FieldDef_IsProto3Optional(const upb_FieldDef* f); |
| 12558 | int _upb_FieldDef_LayoutIndex(const upb_FieldDef* f); |
| 12559 | uint64_t _upb_FieldDef_Modifiers(const upb_FieldDef* f); |
| 12560 | void _upb_FieldDef_Resolve(upb_DefBuilder* ctx, const char* prefix, |
| 12561 | upb_FieldDef* f); |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 12562 | void _upb_FieldDef_BuildMiniTableExtension(upb_DefBuilder* ctx, |
| 12563 | const upb_FieldDef* f); |
| 12564 | |
| 12565 | // Allocate and initialize an array of |n| extensions (field defs). |
| 12566 | upb_FieldDef* _upb_Extensions_New( |
| 12567 | upb_DefBuilder* ctx, int n, |
| 12568 | const UPB_DESC(FieldDescriptorProto) * const* protos, const char* prefix, |
| 12569 | upb_MessageDef* m); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12570 | |
| 12571 | // Allocate and initialize an array of |n| field defs. |
| 12572 | upb_FieldDef* _upb_FieldDefs_New( |
| 12573 | upb_DefBuilder* ctx, int n, |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 12574 | const UPB_DESC(FieldDescriptorProto) * const* protos, const char* prefix, |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12575 | upb_MessageDef* m, bool* is_sorted); |
| 12576 | |
| 12577 | // Allocate and return a list of pointers to the |n| field defs in |ff|, |
| 12578 | // sorted by field number. |
| 12579 | const upb_FieldDef** _upb_FieldDefs_Sorted(const upb_FieldDef* f, int n, |
| 12580 | upb_Arena* a); |
| 12581 | |
| 12582 | #ifdef __cplusplus |
| 12583 | } /* extern "C" */ |
| 12584 | #endif |
| 12585 | |
| 12586 | |
| 12587 | #endif /* UPB_REFLECTION_FIELD_DEF_INTERNAL_H_ */ |
| 12588 | |
| 12589 | #ifndef UPB_REFLECTION_FILE_DEF_INTERNAL_H_ |
| 12590 | #define UPB_REFLECTION_FILE_DEF_INTERNAL_H_ |
| 12591 | |
| 12592 | |
| 12593 | // Must be last. |
| 12594 | |
| 12595 | #ifdef __cplusplus |
| 12596 | extern "C" { |
| 12597 | #endif |
| 12598 | |
| 12599 | const upb_MiniTableExtension* _upb_FileDef_ExtensionMiniTable( |
| 12600 | const upb_FileDef* f, int i); |
| 12601 | const int32_t* _upb_FileDef_PublicDependencyIndexes(const upb_FileDef* f); |
| 12602 | const int32_t* _upb_FileDef_WeakDependencyIndexes(const upb_FileDef* f); |
| 12603 | |
| 12604 | // upb_FileDef_Package() returns "" if f->package is NULL, this does not. |
| 12605 | const char* _upb_FileDef_RawPackage(const upb_FileDef* f); |
| 12606 | |
| 12607 | void _upb_FileDef_Create(upb_DefBuilder* ctx, |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 12608 | const UPB_DESC(FileDescriptorProto) * file_proto); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12609 | |
| 12610 | #ifdef __cplusplus |
| 12611 | } /* extern "C" */ |
| 12612 | #endif |
| 12613 | |
| 12614 | |
| 12615 | #endif /* UPB_REFLECTION_FILE_DEF_INTERNAL_H_ */ |
| 12616 | |
| 12617 | #ifndef UPB_REFLECTION_MESSAGE_DEF_INTERNAL_H_ |
| 12618 | #define UPB_REFLECTION_MESSAGE_DEF_INTERNAL_H_ |
| 12619 | |
| 12620 | |
| 12621 | // Must be last. |
| 12622 | |
| 12623 | #ifdef __cplusplus |
| 12624 | extern "C" { |
| 12625 | #endif |
| 12626 | |
| 12627 | upb_MessageDef* _upb_MessageDef_At(const upb_MessageDef* m, int i); |
| 12628 | bool _upb_MessageDef_InMessageSet(const upb_MessageDef* m); |
| 12629 | bool _upb_MessageDef_Insert(upb_MessageDef* m, const char* name, size_t size, |
| 12630 | upb_value v, upb_Arena* a); |
| 12631 | void _upb_MessageDef_InsertField(upb_DefBuilder* ctx, upb_MessageDef* m, |
| 12632 | const upb_FieldDef* f); |
| 12633 | bool _upb_MessageDef_IsValidExtensionNumber(const upb_MessageDef* m, int n); |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 12634 | void _upb_MessageDef_CreateMiniTable(upb_DefBuilder* ctx, upb_MessageDef* m); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12635 | void _upb_MessageDef_LinkMiniTable(upb_DefBuilder* ctx, |
| 12636 | const upb_MessageDef* m); |
| 12637 | void _upb_MessageDef_Resolve(upb_DefBuilder* ctx, upb_MessageDef* m); |
| 12638 | |
| 12639 | // Allocate and initialize an array of |n| message defs. |
| 12640 | upb_MessageDef* _upb_MessageDefs_New( |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 12641 | upb_DefBuilder* ctx, int n, const UPB_DESC(DescriptorProto) * const* protos, |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12642 | const upb_MessageDef* containing_type); |
| 12643 | |
| 12644 | #ifdef __cplusplus |
| 12645 | } /* extern "C" */ |
| 12646 | #endif |
| 12647 | |
| 12648 | |
| 12649 | #endif /* UPB_REFLECTION_MESSAGE_DEF_INTERNAL_H_ */ |
| 12650 | |
| 12651 | #ifndef UPB_REFLECTION_SERVICE_DEF_INTERNAL_H_ |
| 12652 | #define UPB_REFLECTION_SERVICE_DEF_INTERNAL_H_ |
| 12653 | |
| 12654 | |
| 12655 | // Must be last. |
| 12656 | |
| 12657 | #ifdef __cplusplus |
| 12658 | extern "C" { |
| 12659 | #endif |
| 12660 | |
| 12661 | upb_ServiceDef* _upb_ServiceDef_At(const upb_ServiceDef* s, int i); |
| 12662 | |
| 12663 | // Allocate and initialize an array of |n| service defs. |
| 12664 | upb_ServiceDef* _upb_ServiceDefs_New( |
| 12665 | upb_DefBuilder* ctx, int n, |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 12666 | const UPB_DESC(ServiceDescriptorProto) * const* protos); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12667 | |
| 12668 | #ifdef __cplusplus |
| 12669 | } /* extern "C" */ |
| 12670 | #endif |
| 12671 | |
| 12672 | |
| 12673 | #endif /* UPB_REFLECTION_SERVICE_DEF_INTERNAL_H_ */ |
| 12674 | |
| 12675 | #ifndef UPB_REFLECTION_DESC_STATE_INTERNAL_H_ |
| 12676 | #define UPB_REFLECTION_DESC_STATE_INTERNAL_H_ |
| 12677 | |
| 12678 | |
| 12679 | // Must be last. |
| 12680 | |
| 12681 | // Manages the storage for mini descriptor strings as they are being encoded. |
Protobuf Team Bot | 986cbb6 | 2023-09-19 15:03:51 +0000 | [diff] [blame^] | 12682 | // TODO: Move some of this state directly into the encoder, maybe. |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12683 | typedef struct { |
| 12684 | upb_MtDataEncoder e; |
| 12685 | size_t bufsize; |
| 12686 | char* buf; |
| 12687 | char* ptr; |
| 12688 | } upb_DescState; |
| 12689 | |
| 12690 | #ifdef __cplusplus |
| 12691 | extern "C" { |
| 12692 | #endif |
| 12693 | |
| 12694 | UPB_INLINE void _upb_DescState_Init(upb_DescState* d) { |
| 12695 | d->bufsize = kUpb_MtDataEncoder_MinSize * 2; |
| 12696 | d->buf = NULL; |
| 12697 | d->ptr = NULL; |
| 12698 | } |
| 12699 | |
| 12700 | bool _upb_DescState_Grow(upb_DescState* d, upb_Arena* a); |
| 12701 | |
| 12702 | #ifdef __cplusplus |
| 12703 | } /* extern "C" */ |
| 12704 | #endif |
| 12705 | |
| 12706 | |
| 12707 | #endif /* UPB_REFLECTION_DESC_STATE_INTERNAL_H_ */ |
| 12708 | |
| 12709 | #ifndef UPB_REFLECTION_ENUM_RESERVED_RANGE_INTERNAL_H_ |
| 12710 | #define UPB_REFLECTION_ENUM_RESERVED_RANGE_INTERNAL_H_ |
| 12711 | |
| 12712 | |
Protobuf Team Bot | fea7645 | 2023-09-12 20:32:11 +0000 | [diff] [blame] | 12713 | // IWYU pragma: private, include "upb/upb/reflection/def.h" |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12714 | |
| 12715 | #ifndef UPB_REFLECTION_ENUM_RESERVED_RANGE_H_ |
| 12716 | #define UPB_REFLECTION_ENUM_RESERVED_RANGE_H_ |
| 12717 | |
| 12718 | |
| 12719 | // Must be last. |
| 12720 | |
| 12721 | #ifdef __cplusplus |
| 12722 | extern "C" { |
| 12723 | #endif |
| 12724 | |
| 12725 | int32_t upb_EnumReservedRange_Start(const upb_EnumReservedRange* r); |
| 12726 | int32_t upb_EnumReservedRange_End(const upb_EnumReservedRange* r); |
| 12727 | |
| 12728 | #ifdef __cplusplus |
| 12729 | } /* extern "C" */ |
| 12730 | #endif |
| 12731 | |
| 12732 | |
| 12733 | #endif /* UPB_REFLECTION_ENUM_RESERVED_RANGE_H_ */ |
| 12734 | |
| 12735 | // Must be last. |
| 12736 | |
| 12737 | #ifdef __cplusplus |
| 12738 | extern "C" { |
| 12739 | #endif |
| 12740 | |
| 12741 | upb_EnumReservedRange* _upb_EnumReservedRange_At(const upb_EnumReservedRange* r, |
| 12742 | int i); |
| 12743 | |
| 12744 | // Allocate and initialize an array of |n| reserved ranges owned by |e|. |
| 12745 | upb_EnumReservedRange* _upb_EnumReservedRanges_New( |
| 12746 | upb_DefBuilder* ctx, int n, |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 12747 | const UPB_DESC(EnumDescriptorProto_EnumReservedRange) * const* protos, |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12748 | const upb_EnumDef* e); |
| 12749 | |
| 12750 | #ifdef __cplusplus |
| 12751 | } /* extern "C" */ |
| 12752 | #endif |
| 12753 | |
| 12754 | |
| 12755 | #endif /* UPB_REFLECTION_ENUM_RESERVED_RANGE_INTERNAL_H_ */ |
| 12756 | |
Protobuf Team Bot | 7be2a45 | 2023-09-13 16:50:05 +0000 | [diff] [blame] | 12757 | #ifndef UPB_REFLECTION_INTERNAL_STRDUP2_H_ |
| 12758 | #define UPB_REFLECTION_INTERNAL_STRDUP2_H_ |
| 12759 | |
| 12760 | #include <stddef.h> |
| 12761 | |
| 12762 | |
| 12763 | // Must be last. |
| 12764 | |
| 12765 | #ifdef __cplusplus |
| 12766 | extern "C" { |
| 12767 | #endif |
| 12768 | |
| 12769 | // Variant that works with a length-delimited rather than NULL-delimited string, |
| 12770 | // as supported by strtable. |
| 12771 | char* upb_strdup2(const char* s, size_t len, upb_Arena* a); |
| 12772 | |
| 12773 | #ifdef __cplusplus |
| 12774 | } /* extern "C" */ |
| 12775 | #endif |
| 12776 | |
| 12777 | |
| 12778 | #endif /* UPB_REFLECTION_INTERNAL_STRDUP2_H_ */ |
| 12779 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12780 | #ifndef UPB_REFLECTION_EXTENSION_RANGE_INTERNAL_H_ |
| 12781 | #define UPB_REFLECTION_EXTENSION_RANGE_INTERNAL_H_ |
| 12782 | |
| 12783 | |
| 12784 | // Must be last. |
| 12785 | |
| 12786 | #ifdef __cplusplus |
| 12787 | extern "C" { |
| 12788 | #endif |
| 12789 | |
| 12790 | upb_ExtensionRange* _upb_ExtensionRange_At(const upb_ExtensionRange* r, int i); |
| 12791 | |
| 12792 | // Allocate and initialize an array of |n| extension ranges owned by |m|. |
| 12793 | upb_ExtensionRange* _upb_ExtensionRanges_New( |
| 12794 | upb_DefBuilder* ctx, int n, |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 12795 | const UPB_DESC(DescriptorProto_ExtensionRange) * const* protos, |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12796 | const upb_MessageDef* m); |
| 12797 | |
| 12798 | #ifdef __cplusplus |
| 12799 | } /* extern "C" */ |
| 12800 | #endif |
| 12801 | |
| 12802 | |
| 12803 | #endif /* UPB_REFLECTION_EXTENSION_RANGE_INTERNAL_H_ */ |
| 12804 | |
| 12805 | #ifndef UPB_REFLECTION_ONEOF_DEF_INTERNAL_H_ |
| 12806 | #define UPB_REFLECTION_ONEOF_DEF_INTERNAL_H_ |
| 12807 | |
| 12808 | |
| 12809 | // Must be last. |
| 12810 | |
| 12811 | #ifdef __cplusplus |
| 12812 | extern "C" { |
| 12813 | #endif |
| 12814 | |
| 12815 | upb_OneofDef* _upb_OneofDef_At(const upb_OneofDef* o, int i); |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 12816 | void _upb_OneofDef_Insert(upb_DefBuilder* ctx, upb_OneofDef* o, |
| 12817 | const upb_FieldDef* f, const char* name, size_t size); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12818 | |
| 12819 | // Allocate and initialize an array of |n| oneof defs owned by |m|. |
| 12820 | upb_OneofDef* _upb_OneofDefs_New( |
| 12821 | upb_DefBuilder* ctx, int n, |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 12822 | const UPB_DESC(OneofDescriptorProto) * const* protos, upb_MessageDef* m); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12823 | |
| 12824 | size_t _upb_OneofDefs_Finalize(upb_DefBuilder* ctx, upb_MessageDef* m); |
| 12825 | |
| 12826 | #ifdef __cplusplus |
| 12827 | } /* extern "C" */ |
| 12828 | #endif |
| 12829 | |
| 12830 | |
| 12831 | #endif /* UPB_REFLECTION_ONEOF_DEF_INTERNAL_H_ */ |
| 12832 | |
| 12833 | #ifndef UPB_REFLECTION_MESSAGE_RESERVED_RANGE_INTERNAL_H_ |
| 12834 | #define UPB_REFLECTION_MESSAGE_RESERVED_RANGE_INTERNAL_H_ |
| 12835 | |
| 12836 | |
Protobuf Team Bot | fea7645 | 2023-09-12 20:32:11 +0000 | [diff] [blame] | 12837 | // IWYU pragma: private, include "upb/upb/reflection/def.h" |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12838 | |
| 12839 | #ifndef UPB_REFLECTION_MESSAGE_RESERVED_RANGE_H_ |
| 12840 | #define UPB_REFLECTION_MESSAGE_RESERVED_RANGE_H_ |
| 12841 | |
| 12842 | |
| 12843 | // Must be last. |
| 12844 | |
| 12845 | #ifdef __cplusplus |
| 12846 | extern "C" { |
| 12847 | #endif |
| 12848 | |
| 12849 | int32_t upb_MessageReservedRange_Start(const upb_MessageReservedRange* r); |
| 12850 | int32_t upb_MessageReservedRange_End(const upb_MessageReservedRange* r); |
| 12851 | |
| 12852 | #ifdef __cplusplus |
| 12853 | } /* extern "C" */ |
| 12854 | #endif |
| 12855 | |
| 12856 | |
| 12857 | #endif /* UPB_REFLECTION_MESSAGE_RESERVED_RANGE_H_ */ |
| 12858 | |
| 12859 | // Must be last. |
| 12860 | |
| 12861 | #ifdef __cplusplus |
| 12862 | extern "C" { |
| 12863 | #endif |
| 12864 | |
| 12865 | upb_MessageReservedRange* _upb_MessageReservedRange_At( |
| 12866 | const upb_MessageReservedRange* r, int i); |
| 12867 | |
| 12868 | // Allocate and initialize an array of |n| reserved ranges owned by |m|. |
| 12869 | upb_MessageReservedRange* _upb_MessageReservedRanges_New( |
| 12870 | upb_DefBuilder* ctx, int n, |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 12871 | const UPB_DESC(DescriptorProto_ReservedRange) * const* protos, |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12872 | const upb_MessageDef* m); |
| 12873 | |
| 12874 | #ifdef __cplusplus |
| 12875 | } /* extern "C" */ |
| 12876 | #endif |
| 12877 | |
| 12878 | |
| 12879 | #endif /* UPB_REFLECTION_MESSAGE_RESERVED_RANGE_INTERNAL_H_ */ |
| 12880 | |
| 12881 | #ifndef UPB_REFLECTION_METHOD_DEF_INTERNAL_H_ |
| 12882 | #define UPB_REFLECTION_METHOD_DEF_INTERNAL_H_ |
| 12883 | |
| 12884 | |
| 12885 | // Must be last. |
| 12886 | |
| 12887 | #ifdef __cplusplus |
| 12888 | extern "C" { |
| 12889 | #endif |
| 12890 | |
| 12891 | upb_MethodDef* _upb_MethodDef_At(const upb_MethodDef* m, int i); |
| 12892 | |
| 12893 | // Allocate and initialize an array of |n| method defs owned by |s|. |
| 12894 | upb_MethodDef* _upb_MethodDefs_New( |
| 12895 | upb_DefBuilder* ctx, int n, |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 12896 | const UPB_DESC(MethodDescriptorProto) * const* protos, upb_ServiceDef* s); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12897 | |
| 12898 | #ifdef __cplusplus |
| 12899 | } /* extern "C" */ |
| 12900 | #endif |
| 12901 | |
| 12902 | |
| 12903 | #endif /* UPB_REFLECTION_METHOD_DEF_INTERNAL_H_ */ |
| 12904 | |
Protobuf Team Bot | 743bf92 | 2023-09-14 01:12:11 +0000 | [diff] [blame] | 12905 | #ifndef UPB_WIRE_INTERNAL_CONSTANTS_H_ |
| 12906 | #define UPB_WIRE_INTERNAL_CONSTANTS_H_ |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12907 | |
Protobuf Team Bot | 743bf92 | 2023-09-14 01:12:11 +0000 | [diff] [blame] | 12908 | #define kUpb_WireFormat_DefaultDepthLimit 100 |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12909 | |
| 12910 | // MessageSet wire format is: |
| 12911 | // message MessageSet { |
| 12912 | // repeated group Item = 1 { |
| 12913 | // required int32 type_id = 2; |
| 12914 | // required bytes message = 3; |
| 12915 | // } |
| 12916 | // } |
| 12917 | |
| 12918 | enum { |
| 12919 | kUpb_MsgSet_Item = 1, |
| 12920 | kUpb_MsgSet_TypeId = 2, |
| 12921 | kUpb_MsgSet_Message = 3, |
| 12922 | }; |
| 12923 | |
Protobuf Team Bot | 743bf92 | 2023-09-14 01:12:11 +0000 | [diff] [blame] | 12924 | #endif /* UPB_WIRE_INTERNAL_CONSTANTS_H_ */ |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12925 | |
| 12926 | /* |
| 12927 | * Internal implementation details of the decoder that are shared between |
| 12928 | * decode.c and decode_fast.c. |
| 12929 | */ |
| 12930 | |
Sandy Zhang | e3b0943 | 2023-08-07 09:30:02 -0700 | [diff] [blame] | 12931 | #ifndef UPB_WIRE_INTERNAL_DECODE_H_ |
| 12932 | #define UPB_WIRE_INTERNAL_DECODE_H_ |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12933 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 12934 | #include "utf8_range.h" |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 12935 | |
| 12936 | // Must be last. |
| 12937 | |
| 12938 | #define DECODE_NOGROUP (uint32_t) - 1 |
| 12939 | |
| 12940 | typedef struct upb_Decoder { |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 12941 | upb_EpsCopyInputStream input; |
| 12942 | const upb_ExtensionRegistry* extreg; |
| 12943 | const char* unknown; // Start of unknown data, preserve at buffer flip |
| 12944 | upb_Message* unknown_msg; // Pointer to preserve data to |
| 12945 | int depth; // Tracks recursion depth to bound stack usage. |
| 12946 | uint32_t end_group; // field number of END_GROUP tag, else DECODE_NOGROUP. |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 12947 | uint16_t options; |
| 12948 | bool missing_required; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 12949 | upb_Arena arena; |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 12950 | upb_DecodeStatus status; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 12951 | jmp_buf err; |
| 12952 | |
| 12953 | #ifndef NDEBUG |
| 12954 | const char* debug_tagstart; |
| 12955 | const char* debug_valstart; |
| 12956 | #endif |
| 12957 | } upb_Decoder; |
| 12958 | |
| 12959 | /* Error function that will abort decoding with longjmp(). We can't declare this |
| 12960 | * UPB_NORETURN, even though it is appropriate, because if we do then compilers |
| 12961 | * will "helpfully" refuse to tailcall to it |
| 12962 | * (see: https://stackoverflow.com/a/55657013), which will defeat a major goal |
| 12963 | * of our optimizations. That is also why we must declare it in a separate file, |
| 12964 | * otherwise the compiler will see that it calls longjmp() and deduce that it is |
| 12965 | * noreturn. */ |
| 12966 | const char* _upb_FastDecoder_ErrorJmp(upb_Decoder* d, int status); |
| 12967 | |
| 12968 | extern const uint8_t upb_utf8_offsets[]; |
| 12969 | |
| 12970 | UPB_INLINE |
| 12971 | bool _upb_Decoder_VerifyUtf8Inline(const char* ptr, int len) { |
| 12972 | const char* end = ptr + len; |
| 12973 | |
| 12974 | // Check 8 bytes at a time for any non-ASCII char. |
| 12975 | while (end - ptr >= 8) { |
| 12976 | uint64_t data; |
| 12977 | memcpy(&data, ptr, 8); |
| 12978 | if (data & 0x8080808080808080) goto non_ascii; |
| 12979 | ptr += 8; |
| 12980 | } |
| 12981 | |
| 12982 | // Check one byte at a time for non-ASCII. |
| 12983 | while (ptr < end) { |
| 12984 | if (*ptr & 0x80) goto non_ascii; |
| 12985 | ptr++; |
| 12986 | } |
| 12987 | |
| 12988 | return true; |
| 12989 | |
| 12990 | non_ascii: |
| 12991 | return utf8_range2((const unsigned char*)ptr, end - ptr) == 0; |
| 12992 | } |
| 12993 | |
| 12994 | const char* _upb_Decoder_CheckRequired(upb_Decoder* d, const char* ptr, |
| 12995 | const upb_Message* msg, |
| 12996 | const upb_MiniTable* l); |
| 12997 | |
| 12998 | /* x86-64 pointers always have the high 16 bits matching. So we can shift |
| 12999 | * left 8 and right 8 without loss of information. */ |
| 13000 | UPB_INLINE intptr_t decode_totable(const upb_MiniTable* tablep) { |
| 13001 | return ((intptr_t)tablep << 8) | tablep->table_mask; |
| 13002 | } |
| 13003 | |
| 13004 | UPB_INLINE const upb_MiniTable* decode_totablep(intptr_t table) { |
| 13005 | return (const upb_MiniTable*)(table >> 8); |
| 13006 | } |
| 13007 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 13008 | const char* _upb_Decoder_IsDoneFallback(upb_EpsCopyInputStream* e, |
| 13009 | const char* ptr, int overrun); |
| 13010 | |
| 13011 | UPB_INLINE bool _upb_Decoder_IsDone(upb_Decoder* d, const char** ptr) { |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 13012 | return upb_EpsCopyInputStream_IsDoneWithCallback( |
| 13013 | &d->input, ptr, &_upb_Decoder_IsDoneFallback); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 13014 | } |
| 13015 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 13016 | UPB_INLINE const char* _upb_Decoder_BufferFlipCallback( |
| 13017 | upb_EpsCopyInputStream* e, const char* old_end, const char* new_start) { |
| 13018 | upb_Decoder* d = (upb_Decoder*)e; |
| 13019 | if (!old_end) _upb_FastDecoder_ErrorJmp(d, kUpb_DecodeStatus_Malformed); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 13020 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 13021 | if (d->unknown) { |
| 13022 | if (!_upb_Message_AddUnknown(d->unknown_msg, d->unknown, |
| 13023 | old_end - d->unknown, &d->arena)) { |
| 13024 | _upb_FastDecoder_ErrorJmp(d, kUpb_DecodeStatus_OutOfMemory); |
| 13025 | } |
| 13026 | d->unknown = new_start; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 13027 | } |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 13028 | return new_start; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 13029 | } |
| 13030 | |
| 13031 | #if UPB_FASTTABLE |
| 13032 | UPB_INLINE |
| 13033 | const char* _upb_FastDecoder_TagDispatch(upb_Decoder* d, const char* ptr, |
| 13034 | upb_Message* msg, intptr_t table, |
| 13035 | uint64_t hasbits, uint64_t tag) { |
| 13036 | const upb_MiniTable* table_p = decode_totablep(table); |
| 13037 | uint8_t mask = table; |
| 13038 | uint64_t data; |
| 13039 | size_t idx = tag & mask; |
| 13040 | UPB_ASSUME((idx & 7) == 0); |
| 13041 | idx >>= 3; |
| 13042 | data = table_p->fasttable[idx].field_data ^ tag; |
| 13043 | UPB_MUSTTAIL return table_p->fasttable[idx].field_parser(d, ptr, msg, table, |
| 13044 | hasbits, data); |
| 13045 | } |
| 13046 | #endif |
| 13047 | |
| 13048 | UPB_INLINE uint32_t _upb_FastDecoder_LoadTag(const char* ptr) { |
| 13049 | uint16_t tag; |
| 13050 | memcpy(&tag, ptr, 2); |
| 13051 | return tag; |
| 13052 | } |
| 13053 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 13054 | |
Sandy Zhang | e3b0943 | 2023-08-07 09:30:02 -0700 | [diff] [blame] | 13055 | #endif /* UPB_WIRE_INTERNAL_DECODE_H_ */ |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 13056 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 13057 | // This should #undef all macros #defined in def.inc |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 13058 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 13059 | #undef UPB_SIZE |
| 13060 | #undef UPB_PTR_AT |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 13061 | #undef UPB_MAPTYPE_STRING |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 13062 | #undef UPB_EXPORT |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 13063 | #undef UPB_INLINE |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 13064 | #undef UPB_API |
| 13065 | #undef UPB_API_INLINE |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 13066 | #undef UPB_ALIGN_UP |
| 13067 | #undef UPB_ALIGN_DOWN |
| 13068 | #undef UPB_ALIGN_MALLOC |
| 13069 | #undef UPB_ALIGN_OF |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 13070 | #undef UPB_MALLOC_ALIGN |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 13071 | #undef UPB_LIKELY |
| 13072 | #undef UPB_UNLIKELY |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 13073 | #undef UPB_FORCEINLINE |
| 13074 | #undef UPB_NOINLINE |
| 13075 | #undef UPB_NORETURN |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 13076 | #undef UPB_PRINTF |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 13077 | #undef UPB_MAX |
| 13078 | #undef UPB_MIN |
| 13079 | #undef UPB_UNUSED |
| 13080 | #undef UPB_ASSUME |
| 13081 | #undef UPB_ASSERT |
| 13082 | #undef UPB_UNREACHABLE |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 13083 | #undef UPB_SETJMP |
| 13084 | #undef UPB_LONGJMP |
| 13085 | #undef UPB_PTRADD |
| 13086 | #undef UPB_MUSTTAIL |
| 13087 | #undef UPB_FASTTABLE_SUPPORTED |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 13088 | #undef UPB_FASTTABLE_MASK |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 13089 | #undef UPB_FASTTABLE |
| 13090 | #undef UPB_FASTTABLE_INIT |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 13091 | #undef UPB_POISON_MEMORY_REGION |
| 13092 | #undef UPB_UNPOISON_MEMORY_REGION |
| 13093 | #undef UPB_ASAN |
Sandy Zhang | e3b0943 | 2023-08-07 09:30:02 -0700 | [diff] [blame] | 13094 | #undef UPB_ASAN_GUARD_SIZE |
| 13095 | #undef UPB_CLANG_ASAN |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 13096 | #undef UPB_TREAT_PROTO2_ENUMS_LIKE_PROTO3 |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 13097 | #undef UPB_DEPRECATED |
| 13098 | #undef UPB_GNUC_MIN |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 13099 | #undef UPB_DESCRIPTOR_UPB_H_FILENAME |
| 13100 | #undef UPB_DESC |
| 13101 | #undef UPB_IS_GOOGLE3 |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 13102 | #undef UPB_ATOMIC |
| 13103 | #undef UPB_USE_C11_ATOMICS |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 13104 | #undef UPB_PRIVATE |