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 | 0631035 | 2023-09-26 21:54:58 +0000 | [diff] [blame] | 12 | * #include "upb/foobar.h" |
| 13 | * #include "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 | 0631035 | 2023-09-26 21:54:58 +0000 | [diff] [blame] | 16 | * #include "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 | 0631035 | 2023-09-26 21:54:58 +0000 | [diff] [blame] | 22 | * #include "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 |
Protobuf Team Bot | ce9dcc2 | 2023-11-03 22:38:26 +0000 | [diff] [blame] | 323 | #define UPB_DESC_MINITABLE(sym) &proto2__##sym##_msg_init |
| 324 | #elif defined(UPB_BOOTSTRAP_STAGE0) |
| 325 | #define UPB_DESC(sym) google_protobuf_##sym |
| 326 | #define UPB_DESC_MINITABLE(sym) google__protobuf__##sym##_msg_init() |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 327 | #else |
| 328 | #define UPB_DESC(sym) google_protobuf_##sym |
Protobuf Team Bot | ce9dcc2 | 2023-11-03 22:38:26 +0000 | [diff] [blame] | 329 | #define UPB_DESC_MINITABLE(sym) &google__protobuf__##sym##_msg_init |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 330 | #endif |
| 331 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 332 | #ifndef UPB_BASE_STATUS_H_ |
| 333 | #define UPB_BASE_STATUS_H_ |
| 334 | |
| 335 | #include <stdarg.h> |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 336 | |
| 337 | // Must be last. |
| 338 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 339 | #define _kUpb_Status_MaxMessage 127 |
| 340 | |
| 341 | typedef struct { |
| 342 | bool ok; |
| 343 | char msg[_kUpb_Status_MaxMessage]; // Error message; NULL-terminated. |
| 344 | } upb_Status; |
| 345 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 346 | #ifdef __cplusplus |
| 347 | extern "C" { |
| 348 | #endif |
| 349 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 350 | UPB_API const char* upb_Status_ErrorMessage(const upb_Status* status); |
| 351 | UPB_API bool upb_Status_IsOk(const upb_Status* status); |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 352 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 353 | // These are no-op if |status| is NULL. |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 354 | UPB_API void upb_Status_Clear(upb_Status* status); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 355 | void upb_Status_SetErrorMessage(upb_Status* status, const char* msg); |
| 356 | void upb_Status_SetErrorFormat(upb_Status* status, const char* fmt, ...) |
| 357 | UPB_PRINTF(2, 3); |
| 358 | void upb_Status_VSetErrorFormat(upb_Status* status, const char* fmt, |
| 359 | va_list args) UPB_PRINTF(2, 0); |
| 360 | void upb_Status_VAppendErrorFormat(upb_Status* status, const char* fmt, |
| 361 | va_list args) UPB_PRINTF(2, 0); |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 362 | |
| 363 | #ifdef __cplusplus |
| 364 | } /* extern "C" */ |
| 365 | #endif |
| 366 | |
| 367 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 368 | #endif /* UPB_BASE_STATUS_H_ */ |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 369 | |
Protobuf Team Bot | 376ba2f | 2023-09-29 22:17:43 +0000 | [diff] [blame] | 370 | #ifndef UPB_GENERATED_CODE_SUPPORT_H_ |
| 371 | #define UPB_GENERATED_CODE_SUPPORT_H_ |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 372 | |
Protobuf Team Bot | 376ba2f | 2023-09-29 22:17:43 +0000 | [diff] [blame] | 373 | // IWYU pragma: begin_exports |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 374 | |
Protobuf Team Bot | 376ba2f | 2023-09-29 22:17:43 +0000 | [diff] [blame] | 375 | #ifndef UPB_MESSAGE_ACCESSORS_H_ |
| 376 | #define UPB_MESSAGE_ACCESSORS_H_ |
Protobuf Team Bot | 473d20d | 2023-09-15 22:27:16 +0000 | [diff] [blame] | 377 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 378 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 379 | #ifndef UPB_BASE_DESCRIPTOR_CONSTANTS_H_ |
| 380 | #define UPB_BASE_DESCRIPTOR_CONSTANTS_H_ |
| 381 | |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 382 | // Must be last. |
| 383 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 384 | // The types a field can have. Note that this list is not identical to the |
| 385 | // types defined in descriptor.proto, which gives INT32 and SINT32 separate |
| 386 | // types (we distinguish the two with the "integer encoding" enum below). |
| 387 | // This enum is an internal convenience only and has no meaning outside of upb. |
| 388 | typedef enum { |
| 389 | kUpb_CType_Bool = 1, |
| 390 | kUpb_CType_Float = 2, |
| 391 | kUpb_CType_Int32 = 3, |
| 392 | kUpb_CType_UInt32 = 4, |
Protobuf Team Bot | 986cbb6 | 2023-09-19 15:03:51 +0000 | [diff] [blame] | 393 | kUpb_CType_Enum = 5, // Enum values are int32. TODO: rename |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 394 | kUpb_CType_Message = 6, |
| 395 | kUpb_CType_Double = 7, |
| 396 | kUpb_CType_Int64 = 8, |
| 397 | kUpb_CType_UInt64 = 9, |
| 398 | kUpb_CType_String = 10, |
| 399 | kUpb_CType_Bytes = 11 |
| 400 | } upb_CType; |
| 401 | |
| 402 | // The repeated-ness of each field; this matches descriptor.proto. |
| 403 | typedef enum { |
| 404 | kUpb_Label_Optional = 1, |
| 405 | kUpb_Label_Required = 2, |
| 406 | kUpb_Label_Repeated = 3 |
| 407 | } upb_Label; |
| 408 | |
| 409 | // Descriptor types, as defined in descriptor.proto. |
| 410 | typedef enum { |
| 411 | kUpb_FieldType_Double = 1, |
| 412 | kUpb_FieldType_Float = 2, |
| 413 | kUpb_FieldType_Int64 = 3, |
| 414 | kUpb_FieldType_UInt64 = 4, |
| 415 | kUpb_FieldType_Int32 = 5, |
| 416 | kUpb_FieldType_Fixed64 = 6, |
| 417 | kUpb_FieldType_Fixed32 = 7, |
| 418 | kUpb_FieldType_Bool = 8, |
| 419 | kUpb_FieldType_String = 9, |
| 420 | kUpb_FieldType_Group = 10, |
| 421 | kUpb_FieldType_Message = 11, |
| 422 | kUpb_FieldType_Bytes = 12, |
| 423 | kUpb_FieldType_UInt32 = 13, |
| 424 | kUpb_FieldType_Enum = 14, |
| 425 | kUpb_FieldType_SFixed32 = 15, |
| 426 | kUpb_FieldType_SFixed64 = 16, |
| 427 | kUpb_FieldType_SInt32 = 17, |
| 428 | kUpb_FieldType_SInt64 = 18, |
| 429 | } upb_FieldType; |
| 430 | |
| 431 | #define kUpb_FieldType_SizeOf 19 |
| 432 | |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 433 | #ifdef __cplusplus |
| 434 | extern "C" { |
| 435 | #endif |
| 436 | |
Protobuf Team Bot | 7c68721 | 2023-11-14 03:01:42 +0000 | [diff] [blame] | 437 | // Convert from upb_FieldType to upb_CType |
| 438 | UPB_INLINE upb_CType upb_FieldType_CType(upb_FieldType field_type) { |
| 439 | static const upb_CType c_type[] = { |
| 440 | kUpb_CType_Double, // kUpb_FieldType_Double |
| 441 | kUpb_CType_Float, // kUpb_FieldType_Float |
| 442 | kUpb_CType_Int64, // kUpb_FieldType_Int64 |
| 443 | kUpb_CType_UInt64, // kUpb_FieldType_UInt64 |
| 444 | kUpb_CType_Int32, // kUpb_FieldType_Int32 |
| 445 | kUpb_CType_UInt64, // kUpb_FieldType_Fixed64 |
| 446 | kUpb_CType_UInt32, // kUpb_FieldType_Fixed32 |
| 447 | kUpb_CType_Bool, // kUpb_FieldType_Bool |
| 448 | kUpb_CType_String, // kUpb_FieldType_String |
| 449 | kUpb_CType_Message, // kUpb_FieldType_Group |
| 450 | kUpb_CType_Message, // kUpb_FieldType_Message |
| 451 | kUpb_CType_Bytes, // kUpb_FieldType_Bytes |
| 452 | kUpb_CType_UInt32, // kUpb_FieldType_UInt32 |
| 453 | kUpb_CType_Enum, // kUpb_FieldType_Enum |
| 454 | kUpb_CType_Int32, // kUpb_FieldType_SFixed32 |
| 455 | kUpb_CType_Int64, // kUpb_FieldType_SFixed64 |
| 456 | kUpb_CType_Int32, // kUpb_FieldType_SInt32 |
| 457 | kUpb_CType_Int64, // kUpb_FieldType_SInt64 |
| 458 | }; |
| 459 | |
| 460 | // -1 here because the enum is one-based but the table is zero-based. |
| 461 | return c_type[field_type - 1]; |
| 462 | } |
| 463 | |
| 464 | UPB_INLINE bool upb_FieldType_IsPackable(upb_FieldType field_type) { |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 465 | // clang-format off |
| 466 | const unsigned kUnpackableTypes = |
| 467 | (1 << kUpb_FieldType_String) | |
| 468 | (1 << kUpb_FieldType_Bytes) | |
| 469 | (1 << kUpb_FieldType_Message) | |
| 470 | (1 << kUpb_FieldType_Group); |
| 471 | // clang-format on |
Protobuf Team Bot | 7c68721 | 2023-11-14 03:01:42 +0000 | [diff] [blame] | 472 | return (1 << field_type) & ~kUnpackableTypes; |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 473 | } |
| 474 | |
| 475 | #ifdef __cplusplus |
| 476 | } /* extern "C" */ |
| 477 | #endif |
| 478 | |
| 479 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 480 | #endif /* UPB_BASE_DESCRIPTOR_CONSTANTS_H_ */ |
| 481 | |
Protobuf Team Bot | 376ba2f | 2023-09-29 22:17:43 +0000 | [diff] [blame] | 482 | #ifndef UPB_MESSAGE_ARRAY_H_ |
| 483 | #define UPB_MESSAGE_ARRAY_H_ |
| 484 | |
| 485 | #include <stddef.h> |
| 486 | |
| 487 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 488 | /* upb_Arena is a specific allocator implementation that uses arena allocation. |
| 489 | * The user provides an allocator that will be used to allocate the underlying |
| 490 | * arena blocks. Arenas by nature do not require the individual allocations |
| 491 | * to be freed. However the Arena does allow users to register cleanup |
| 492 | * functions that will run when the arena is destroyed. |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 493 | * |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 494 | * A upb_Arena is *not* thread-safe. |
| 495 | * |
| 496 | * You could write a thread-safe arena allocator that satisfies the |
| 497 | * upb_alloc interface, but it would not be as efficient for the |
| 498 | * single-threaded case. */ |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 499 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 500 | #ifndef UPB_MEM_ARENA_H_ |
| 501 | #define UPB_MEM_ARENA_H_ |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 502 | |
Adam Cozzette | 7d5592e | 2023-08-23 12:15:26 -0700 | [diff] [blame] | 503 | #include <stddef.h> |
| 504 | #include <stdint.h> |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 505 | #include <string.h> |
| 506 | |
| 507 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 508 | #ifndef UPB_MEM_ALLOC_H_ |
| 509 | #define UPB_MEM_ALLOC_H_ |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 510 | |
| 511 | // Must be last. |
| 512 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 513 | #ifdef __cplusplus |
| 514 | extern "C" { |
| 515 | #endif |
| 516 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 517 | typedef struct upb_alloc upb_alloc; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 518 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 519 | /* A combined `malloc()`/`free()` function. |
| 520 | * If `size` is 0 then the function acts like `free()`, otherwise it acts like |
| 521 | * `realloc()`. Only `oldsize` bytes from a previous allocation are |
| 522 | * preserved. */ |
| 523 | typedef void* upb_alloc_func(upb_alloc* alloc, void* ptr, size_t oldsize, |
| 524 | size_t size); |
| 525 | |
| 526 | /* A upb_alloc is a possibly-stateful allocator object. |
| 527 | * |
| 528 | * It could either be an arena allocator (which doesn't require individual |
| 529 | * `free()` calls) or a regular `malloc()` (which does). The client must |
| 530 | * therefore free memory unless it knows that the allocator is an arena |
| 531 | * allocator. */ |
| 532 | struct upb_alloc { |
| 533 | upb_alloc_func* func; |
| 534 | }; |
| 535 | |
| 536 | UPB_INLINE void* upb_malloc(upb_alloc* alloc, size_t size) { |
| 537 | UPB_ASSERT(alloc); |
| 538 | return alloc->func(alloc, NULL, 0, size); |
| 539 | } |
| 540 | |
| 541 | UPB_INLINE void* upb_realloc(upb_alloc* alloc, void* ptr, size_t oldsize, |
| 542 | size_t size) { |
| 543 | UPB_ASSERT(alloc); |
| 544 | return alloc->func(alloc, ptr, oldsize, size); |
| 545 | } |
| 546 | |
| 547 | UPB_INLINE void upb_free(upb_alloc* alloc, void* ptr) { |
| 548 | UPB_ASSERT(alloc); |
| 549 | alloc->func(alloc, ptr, 0, 0); |
| 550 | } |
| 551 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 552 | // The global allocator used by upb. Uses the standard malloc()/free(). |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 553 | |
| 554 | extern upb_alloc upb_alloc_global; |
| 555 | |
| 556 | /* Functions that hard-code the global malloc. |
| 557 | * |
| 558 | * We still get benefit because we can put custom logic into our global |
| 559 | * allocator, like injecting out-of-memory faults in debug/testing builds. */ |
| 560 | |
| 561 | UPB_INLINE void* upb_gmalloc(size_t size) { |
| 562 | return upb_malloc(&upb_alloc_global, size); |
| 563 | } |
| 564 | |
| 565 | UPB_INLINE void* upb_grealloc(void* ptr, size_t oldsize, size_t size) { |
| 566 | return upb_realloc(&upb_alloc_global, ptr, oldsize, size); |
| 567 | } |
| 568 | |
| 569 | UPB_INLINE void upb_gfree(void* ptr) { upb_free(&upb_alloc_global, ptr); } |
| 570 | |
| 571 | #ifdef __cplusplus |
| 572 | } /* extern "C" */ |
| 573 | #endif |
| 574 | |
| 575 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 576 | #endif /* UPB_MEM_ALLOC_H_ */ |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 577 | |
| 578 | // Must be last. |
| 579 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 580 | typedef struct upb_Arena upb_Arena; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 581 | |
| 582 | typedef struct { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 583 | char *ptr, *end; |
| 584 | } _upb_ArenaHead; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 585 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 586 | #ifdef __cplusplus |
| 587 | extern "C" { |
| 588 | #endif |
| 589 | |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 590 | // Creates an arena from the given initial block (if any -- n may be 0). |
| 591 | // Additional blocks will be allocated from |alloc|. If |alloc| is NULL, this |
| 592 | // is a fixed-size arena and cannot grow. |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 593 | 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] | 594 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 595 | UPB_API void upb_Arena_Free(upb_Arena* a); |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 596 | UPB_API bool upb_Arena_Fuse(upb_Arena* a, upb_Arena* b); |
| 597 | |
Protobuf Team Bot | 1fb26f2 | 2023-10-19 01:48:15 +0000 | [diff] [blame] | 598 | bool upb_Arena_IncRefFor(upb_Arena* arena, const void* owner); |
Protobuf Team Bot | 777d6a9 | 2023-10-06 23:52:49 +0000 | [diff] [blame] | 599 | void upb_Arena_DecRefFor(upb_Arena* arena, const void* owner); |
| 600 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 601 | void* _upb_Arena_SlowMalloc(upb_Arena* a, size_t size); |
| 602 | size_t upb_Arena_SpaceAllocated(upb_Arena* arena); |
| 603 | uint32_t upb_Arena_DebugRefCount(upb_Arena* arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 604 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 605 | UPB_INLINE size_t _upb_ArenaHas(upb_Arena* a) { |
| 606 | _upb_ArenaHead* h = (_upb_ArenaHead*)a; |
| 607 | return (size_t)(h->end - h->ptr); |
| 608 | } |
| 609 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 610 | 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] | 611 | size = UPB_ALIGN_MALLOC(size); |
Sandy Zhang | e3b0943 | 2023-08-07 09:30:02 -0700 | [diff] [blame] | 612 | size_t span = size + UPB_ASAN_GUARD_SIZE; |
| 613 | if (UPB_UNLIKELY(_upb_ArenaHas(a) < span)) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 614 | return _upb_Arena_SlowMalloc(a, size); |
| 615 | } |
| 616 | |
| 617 | // We have enough space to do a fast malloc. |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 618 | _upb_ArenaHead* h = (_upb_ArenaHead*)a; |
| 619 | void* ret = h->ptr; |
| 620 | UPB_ASSERT(UPB_ALIGN_MALLOC((uintptr_t)ret) == (uintptr_t)ret); |
| 621 | UPB_ASSERT(UPB_ALIGN_MALLOC(size) == size); |
| 622 | UPB_UNPOISON_MEMORY_REGION(ret, size); |
| 623 | |
Sandy Zhang | e3b0943 | 2023-08-07 09:30:02 -0700 | [diff] [blame] | 624 | h->ptr += span; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 625 | |
| 626 | return ret; |
| 627 | } |
| 628 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 629 | // Shrinks the last alloc from arena. |
| 630 | // REQUIRES: (ptr, oldsize) was the last malloc/realloc from this arena. |
| 631 | // We could also add a upb_Arena_TryShrinkLast() which is simply a no-op if |
| 632 | // this was not the last alloc. |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 633 | UPB_API_INLINE void upb_Arena_ShrinkLast(upb_Arena* a, void* ptr, |
| 634 | size_t oldsize, size_t size) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 635 | _upb_ArenaHead* h = (_upb_ArenaHead*)a; |
| 636 | oldsize = UPB_ALIGN_MALLOC(oldsize); |
| 637 | size = UPB_ALIGN_MALLOC(size); |
Sandy Zhang | e3b0943 | 2023-08-07 09:30:02 -0700 | [diff] [blame] | 638 | // Must be the last alloc. |
| 639 | UPB_ASSERT((char*)ptr + oldsize == h->ptr - UPB_ASAN_GUARD_SIZE); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 640 | UPB_ASSERT(size <= oldsize); |
| 641 | h->ptr = (char*)ptr + size; |
| 642 | } |
| 643 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 644 | UPB_API_INLINE void* upb_Arena_Realloc(upb_Arena* a, void* ptr, size_t oldsize, |
| 645 | size_t size) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 646 | _upb_ArenaHead* h = (_upb_ArenaHead*)a; |
| 647 | oldsize = UPB_ALIGN_MALLOC(oldsize); |
| 648 | size = UPB_ALIGN_MALLOC(size); |
| 649 | bool is_most_recent_alloc = (uintptr_t)ptr + oldsize == (uintptr_t)h->ptr; |
| 650 | |
| 651 | if (is_most_recent_alloc) { |
| 652 | ptrdiff_t diff = size - oldsize; |
| 653 | if ((ptrdiff_t)_upb_ArenaHas(a) >= diff) { |
| 654 | h->ptr += diff; |
| 655 | return ptr; |
| 656 | } |
| 657 | } else if (size <= oldsize) { |
| 658 | return ptr; |
| 659 | } |
| 660 | |
| 661 | void* ret = upb_Arena_Malloc(a, size); |
| 662 | |
| 663 | if (ret && oldsize > 0) { |
| 664 | memcpy(ret, ptr, UPB_MIN(oldsize, size)); |
| 665 | } |
| 666 | |
| 667 | return ret; |
| 668 | } |
| 669 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 670 | UPB_API_INLINE upb_Arena* upb_Arena_New(void) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 671 | return upb_Arena_Init(NULL, 0, &upb_alloc_global); |
| 672 | } |
| 673 | |
| 674 | #ifdef __cplusplus |
| 675 | } /* extern "C" */ |
| 676 | #endif |
| 677 | |
| 678 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 679 | #endif /* UPB_MEM_ARENA_H_ */ |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 680 | |
Protobuf Team Bot | 473d20d | 2023-09-15 22:27:16 +0000 | [diff] [blame] | 681 | // Users should include array.h or map.h instead. |
Protobuf Team Bot | 376ba2f | 2023-09-29 22:17:43 +0000 | [diff] [blame] | 682 | // IWYU pragma: private, include "upb/message/array.h" |
Protobuf Team Bot | 473d20d | 2023-09-15 22:27:16 +0000 | [diff] [blame] | 683 | |
| 684 | #ifndef UPB_MESSAGE_VALUE_H_ |
| 685 | #define UPB_MESSAGE_VALUE_H_ |
| 686 | |
| 687 | #include <stdint.h> |
| 688 | |
| 689 | #ifndef UPB_BASE_STRING_VIEW_H_ |
| 690 | #define UPB_BASE_STRING_VIEW_H_ |
| 691 | |
| 692 | #include <string.h> |
| 693 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 694 | // Must be last. |
| 695 | |
Protobuf Team Bot | 473d20d | 2023-09-15 22:27:16 +0000 | [diff] [blame] | 696 | #define UPB_STRINGVIEW_INIT(ptr, len) \ |
| 697 | { ptr, len } |
| 698 | |
| 699 | #define UPB_STRINGVIEW_FORMAT "%.*s" |
| 700 | #define UPB_STRINGVIEW_ARGS(view) (int)(view).size, (view).data |
| 701 | |
| 702 | // LINT.IfChange(struct_definition) |
| 703 | typedef struct { |
| 704 | const char* data; |
| 705 | size_t size; |
| 706 | } upb_StringView; |
| 707 | // LINT.ThenChange( |
| 708 | // GoogleInternalName0, |
| 709 | // //depot/google3/third_party/upb/bits/golang/accessor.go:map_go_string |
| 710 | // ) |
| 711 | |
| 712 | #ifdef __cplusplus |
| 713 | extern "C" { |
| 714 | #endif |
| 715 | |
| 716 | UPB_API_INLINE upb_StringView upb_StringView_FromDataAndSize(const char* data, |
| 717 | size_t size) { |
| 718 | upb_StringView ret; |
| 719 | ret.data = data; |
| 720 | ret.size = size; |
| 721 | return ret; |
| 722 | } |
| 723 | |
| 724 | UPB_INLINE upb_StringView upb_StringView_FromString(const char* data) { |
| 725 | return upb_StringView_FromDataAndSize(data, strlen(data)); |
| 726 | } |
| 727 | |
| 728 | UPB_INLINE bool upb_StringView_IsEqual(upb_StringView a, upb_StringView b) { |
| 729 | return a.size == b.size && memcmp(a.data, b.data, a.size) == 0; |
| 730 | } |
| 731 | |
| 732 | #ifdef __cplusplus |
| 733 | } /* extern "C" */ |
| 734 | #endif |
| 735 | |
| 736 | |
| 737 | #endif /* UPB_BASE_STRING_VIEW_H_ */ |
| 738 | |
| 739 | #ifndef UPB_MINI_TABLE_TYPES_H_ |
| 740 | #define UPB_MINI_TABLE_TYPES_H_ |
| 741 | |
| 742 | #include <stdint.h> |
| 743 | |
| 744 | |
| 745 | #ifndef UPB_MESSAGE_TYPES_H_ |
| 746 | #define UPB_MESSAGE_TYPES_H_ |
| 747 | |
| 748 | // This typedef is in a leaf header to resolve a circular dependency between |
| 749 | // messages and mini tables. |
| 750 | typedef void upb_Message; |
| 751 | |
| 752 | #endif /* UPB_MESSAGE_TYPES_H_ */ |
| 753 | |
| 754 | // Must be last. |
| 755 | |
| 756 | #ifdef __cplusplus |
| 757 | extern "C" { |
| 758 | #endif |
| 759 | |
| 760 | // When a upb_Message* is stored in a message, array, or map, it is stored in a |
| 761 | // tagged form. If the tag bit is set, the referenced upb_Message is of type |
| 762 | // _kUpb_MiniTable_Empty (a sentinel message type with no fields) instead of |
| 763 | // that field's true message type. This forms the basis of what we call |
| 764 | // "dynamic tree shaking." |
| 765 | // |
| 766 | // See the documentation for kUpb_DecodeOption_ExperimentalAllowUnlinked for |
| 767 | // more information. |
| 768 | typedef uintptr_t upb_TaggedMessagePtr; |
| 769 | |
| 770 | // Internal-only because empty messages cannot be created by the user. |
| 771 | UPB_INLINE upb_TaggedMessagePtr _upb_TaggedMessagePtr_Pack(upb_Message* ptr, |
| 772 | bool empty) { |
| 773 | UPB_ASSERT(((uintptr_t)ptr & 1) == 0); |
| 774 | return (uintptr_t)ptr | (empty ? 1 : 0); |
| 775 | } |
| 776 | |
| 777 | // Users who enable unlinked sub-messages must use this to test whether a |
| 778 | // message is empty before accessing it. If a message is empty, it must be |
| 779 | // first promoted using the interfaces in message/promote.h. |
| 780 | UPB_INLINE bool upb_TaggedMessagePtr_IsEmpty(upb_TaggedMessagePtr ptr) { |
| 781 | return ptr & 1; |
| 782 | } |
| 783 | |
| 784 | UPB_INLINE upb_Message* _upb_TaggedMessagePtr_GetMessage( |
| 785 | upb_TaggedMessagePtr ptr) { |
| 786 | return (upb_Message*)(ptr & ~(uintptr_t)1); |
| 787 | } |
| 788 | |
| 789 | UPB_INLINE upb_Message* upb_TaggedMessagePtr_GetNonEmptyMessage( |
| 790 | upb_TaggedMessagePtr ptr) { |
| 791 | UPB_ASSERT(!upb_TaggedMessagePtr_IsEmpty(ptr)); |
| 792 | return _upb_TaggedMessagePtr_GetMessage(ptr); |
| 793 | } |
| 794 | |
| 795 | UPB_INLINE upb_Message* _upb_TaggedMessagePtr_GetEmptyMessage( |
| 796 | upb_TaggedMessagePtr ptr) { |
| 797 | UPB_ASSERT(upb_TaggedMessagePtr_IsEmpty(ptr)); |
| 798 | return _upb_TaggedMessagePtr_GetMessage(ptr); |
| 799 | } |
| 800 | |
| 801 | #ifdef __cplusplus |
| 802 | } /* extern "C" */ |
| 803 | #endif |
| 804 | |
| 805 | |
| 806 | #endif /* UPB_MINI_TABLE_TYPES_H_ */ |
| 807 | |
| 808 | typedef union { |
| 809 | bool bool_val; |
| 810 | float float_val; |
| 811 | double double_val; |
| 812 | int32_t int32_val; |
| 813 | int64_t int64_val; |
| 814 | uint32_t uint32_val; |
| 815 | uint64_t uint64_val; |
| 816 | const struct upb_Array* array_val; |
| 817 | const struct upb_Map* map_val; |
| 818 | const upb_Message* msg_val; |
| 819 | upb_StringView str_val; |
| 820 | |
| 821 | // EXPERIMENTAL: A tagged upb_Message*. Users must use this instead of |
| 822 | // msg_val if unlinked sub-messages may possibly be in use. See the |
| 823 | // documentation in kUpb_DecodeOption_ExperimentalAllowUnlinked for more |
| 824 | // information. |
| 825 | upb_TaggedMessagePtr tagged_msg_val; |
| 826 | } upb_MessageValue; |
| 827 | |
| 828 | typedef union { |
| 829 | struct upb_Array* array; |
| 830 | struct upb_Map* map; |
| 831 | upb_Message* msg; |
| 832 | } upb_MutableMessageValue; |
| 833 | |
| 834 | #endif /* UPB_MESSAGE_VALUE_H_ */ |
| 835 | |
| 836 | // Must be last. |
| 837 | |
| 838 | typedef struct upb_Array upb_Array; |
| 839 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 840 | #ifdef __cplusplus |
| 841 | extern "C" { |
| 842 | #endif |
| 843 | |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 844 | // Creates a new array on the given arena that holds elements of this type. |
| 845 | 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] | 846 | |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 847 | // Returns the number of elements in the array. |
| 848 | UPB_API size_t upb_Array_Size(const upb_Array* arr); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 849 | |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 850 | // Returns the given element, which must be within the array's current size. |
| 851 | 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] | 852 | |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 853 | // Sets the given element, which must be within the array's current size. |
| 854 | 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] | 855 | |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 856 | // Appends an element to the array. Returns false on allocation failure. |
| 857 | UPB_API bool upb_Array_Append(upb_Array* array, upb_MessageValue val, |
| 858 | upb_Arena* arena); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 859 | |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 860 | // Moves elements within the array using memmove(). |
| 861 | // Like memmove(), the source and destination elements may be overlapping. |
| 862 | UPB_API void upb_Array_Move(upb_Array* array, size_t dst_idx, size_t src_idx, |
| 863 | size_t count); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 864 | |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 865 | // Inserts one or more empty elements into the array. |
| 866 | // Existing elements are shifted right. |
| 867 | // The new elements have undefined state and must be set with `upb_Array_Set()`. |
| 868 | // REQUIRES: `i <= upb_Array_Size(arr)` |
| 869 | UPB_API bool upb_Array_Insert(upb_Array* array, size_t i, size_t count, |
| 870 | upb_Arena* arena); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 871 | |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 872 | // Deletes one or more elements from the array. |
| 873 | // Existing elements are shifted left. |
| 874 | // REQUIRES: `i + count <= upb_Array_Size(arr)` |
| 875 | 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] | 876 | |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 877 | // Changes the size of a vector. New elements are initialized to NULL/0. |
| 878 | // Returns false on allocation failure. |
| 879 | 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] | 880 | |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 881 | // Returns pointer to array data. |
| 882 | UPB_API const void* upb_Array_DataPtr(const upb_Array* arr); |
| 883 | |
| 884 | // Returns mutable pointer to array data. |
| 885 | UPB_API void* upb_Array_MutableDataPtr(upb_Array* arr); |
| 886 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 887 | #ifdef __cplusplus |
| 888 | } /* extern "C" */ |
| 889 | #endif |
| 890 | |
| 891 | |
Protobuf Team Bot | 376ba2f | 2023-09-29 22:17:43 +0000 | [diff] [blame] | 892 | #endif /* UPB_MESSAGE_ARRAY_H_ */ |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 893 | |
Protobuf Team Bot | 376ba2f | 2023-09-29 22:17:43 +0000 | [diff] [blame] | 894 | #ifndef UPB_MESSAGE_INTERNAL_ACCESSORS_H_ |
| 895 | #define UPB_MESSAGE_INTERNAL_ACCESSORS_H_ |
Protobuf Team Bot | dcc1f61 | 2023-09-05 21:56:25 +0000 | [diff] [blame] | 896 | |
Protobuf Team Bot | 7c68721 | 2023-11-14 03:01:42 +0000 | [diff] [blame] | 897 | #include <stddef.h> |
| 898 | #include <stdint.h> |
| 899 | #include <string.h> |
| 900 | |
Protobuf Team Bot | dcc1f61 | 2023-09-05 21:56:25 +0000 | [diff] [blame] | 901 | |
Adam Cozzette | 8059da2 | 2023-08-16 07:57:14 -0700 | [diff] [blame] | 902 | #ifndef UPB_MESSAGE_INTERNAL_EXTENSION_H_ |
| 903 | #define UPB_MESSAGE_INTERNAL_EXTENSION_H_ |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 904 | |
| 905 | |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 906 | // Public APIs for message operations that do not depend on the schema. |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 907 | // |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 908 | // MiniTable-based accessors live in accessors.h. |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 909 | |
| 910 | #ifndef UPB_MESSAGE_MESSAGE_H_ |
| 911 | #define UPB_MESSAGE_MESSAGE_H_ |
| 912 | |
Protobuf Team Bot | 75af7f9 | 2023-09-06 18:07:53 +0000 | [diff] [blame] | 913 | #include <stddef.h> |
| 914 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 915 | |
Protobuf Team Bot | 473d20d | 2023-09-15 22:27:16 +0000 | [diff] [blame] | 916 | #ifndef UPB_MINI_TABLE_MESSAGE_H_ |
| 917 | #define UPB_MINI_TABLE_MESSAGE_H_ |
| 918 | |
| 919 | |
| 920 | #ifndef UPB_MINI_TABLE_ENUM_H_ |
| 921 | #define UPB_MINI_TABLE_ENUM_H_ |
| 922 | |
| 923 | |
| 924 | #ifndef UPB_MINI_TABLE_INTERNAL_ENUM_H_ |
| 925 | #define UPB_MINI_TABLE_INTERNAL_ENUM_H_ |
| 926 | |
| 927 | #include <stdint.h> |
| 928 | |
| 929 | // Must be last. |
| 930 | |
| 931 | struct upb_MiniTableEnum { |
| 932 | uint32_t mask_limit; // Limit enum value that can be tested with mask. |
| 933 | uint32_t value_count; // Number of values after the bitfield. |
| 934 | uint32_t data[]; // Bitmask + enumerated values follow. |
| 935 | }; |
| 936 | |
| 937 | typedef enum { |
| 938 | _kUpb_FastEnumCheck_ValueIsInEnum = 0, |
| 939 | _kUpb_FastEnumCheck_ValueIsNotInEnum = 1, |
| 940 | _kUpb_FastEnumCheck_CannotCheckFast = 2, |
| 941 | } _kUpb_FastEnumCheck_Status; |
| 942 | |
| 943 | #ifdef __cplusplus |
| 944 | extern "C" { |
| 945 | #endif |
| 946 | |
| 947 | UPB_INLINE _kUpb_FastEnumCheck_Status _upb_MiniTable_CheckEnumValueFast( |
| 948 | const struct upb_MiniTableEnum* e, uint32_t val) { |
| 949 | if (UPB_UNLIKELY(val >= 64)) return _kUpb_FastEnumCheck_CannotCheckFast; |
| 950 | uint64_t mask = e->data[0] | ((uint64_t)e->data[1] << 32); |
| 951 | return (mask & (1ULL << val)) ? _kUpb_FastEnumCheck_ValueIsInEnum |
| 952 | : _kUpb_FastEnumCheck_ValueIsNotInEnum; |
| 953 | } |
| 954 | |
| 955 | UPB_INLINE bool _upb_MiniTable_CheckEnumValueSlow( |
| 956 | const struct upb_MiniTableEnum* e, uint32_t val) { |
| 957 | if (val < e->mask_limit) return e->data[val / 32] & (1ULL << (val % 32)); |
| 958 | // OPT: binary search long lists? |
| 959 | const uint32_t* start = &e->data[e->mask_limit / 32]; |
| 960 | const uint32_t* limit = &e->data[(e->mask_limit / 32) + e->value_count]; |
| 961 | for (const uint32_t* p = start; p < limit; p++) { |
| 962 | if (*p == val) return true; |
| 963 | } |
| 964 | return false; |
| 965 | } |
| 966 | |
| 967 | #ifdef __cplusplus |
| 968 | } /* extern "C" */ |
| 969 | #endif |
| 970 | |
| 971 | |
| 972 | #endif /* UPB_MINI_TABLE_INTERNAL_ENUM_H_ */ |
| 973 | |
| 974 | // Must be last |
| 975 | |
| 976 | typedef struct upb_MiniTableEnum upb_MiniTableEnum; |
| 977 | |
Protobuf Team Bot | 450e065 | 2023-09-21 17:36:36 +0000 | [diff] [blame] | 978 | #ifdef __cplusplus |
| 979 | extern "C" { |
| 980 | #endif |
| 981 | |
Protobuf Team Bot | 473d20d | 2023-09-15 22:27:16 +0000 | [diff] [blame] | 982 | // Validates enum value against range defined by enum mini table. |
| 983 | UPB_INLINE bool upb_MiniTableEnum_CheckValue(const struct upb_MiniTableEnum* e, |
| 984 | uint32_t val) { |
| 985 | _kUpb_FastEnumCheck_Status status = _upb_MiniTable_CheckEnumValueFast(e, val); |
| 986 | if (UPB_UNLIKELY(status == _kUpb_FastEnumCheck_CannotCheckFast)) { |
| 987 | return _upb_MiniTable_CheckEnumValueSlow(e, val); |
| 988 | } |
| 989 | return status == _kUpb_FastEnumCheck_ValueIsInEnum ? true : false; |
| 990 | } |
| 991 | |
Protobuf Team Bot | 450e065 | 2023-09-21 17:36:36 +0000 | [diff] [blame] | 992 | #ifdef __cplusplus |
| 993 | } /* extern "C" */ |
| 994 | #endif |
| 995 | |
Protobuf Team Bot | 473d20d | 2023-09-15 22:27:16 +0000 | [diff] [blame] | 996 | |
| 997 | #endif /* UPB_MINI_TABLE_ENUM_H_ */ |
| 998 | |
| 999 | #ifndef UPB_MINI_TABLE_FIELD_H_ |
| 1000 | #define UPB_MINI_TABLE_FIELD_H_ |
| 1001 | |
| 1002 | |
| 1003 | #ifndef UPB_MINI_TABLE_INTERNAL_FIELD_H_ |
| 1004 | #define UPB_MINI_TABLE_INTERNAL_FIELD_H_ |
| 1005 | |
| 1006 | #include <stdint.h> |
| 1007 | |
| 1008 | |
| 1009 | // Must be last. |
| 1010 | |
| 1011 | struct upb_MiniTableField { |
| 1012 | uint32_t number; |
| 1013 | uint16_t offset; |
| 1014 | int16_t presence; // If >0, hasbit_index. If <0, ~oneof_index |
| 1015 | |
| 1016 | // Indexes into `upb_MiniTable.subs` |
| 1017 | // Will be set to `kUpb_NoSub` if `descriptortype` != MESSAGE/GROUP/ENUM |
| 1018 | uint16_t UPB_PRIVATE(submsg_index); |
| 1019 | |
| 1020 | uint8_t UPB_PRIVATE(descriptortype); |
| 1021 | |
| 1022 | // upb_FieldMode | upb_LabelFlags | (upb_FieldRep << kUpb_FieldRep_Shift) |
| 1023 | uint8_t mode; |
| 1024 | }; |
| 1025 | |
| 1026 | #define kUpb_NoSub ((uint16_t)-1) |
| 1027 | |
| 1028 | typedef enum { |
| 1029 | kUpb_FieldMode_Map = 0, |
| 1030 | kUpb_FieldMode_Array = 1, |
| 1031 | kUpb_FieldMode_Scalar = 2, |
| 1032 | } upb_FieldMode; |
| 1033 | |
| 1034 | // Mask to isolate the upb_FieldMode from field.mode. |
| 1035 | #define kUpb_FieldMode_Mask 3 |
| 1036 | |
| 1037 | // Extra flags on the mode field. |
| 1038 | typedef enum { |
| 1039 | kUpb_LabelFlags_IsPacked = 4, |
| 1040 | kUpb_LabelFlags_IsExtension = 8, |
| 1041 | // Indicates that this descriptor type is an "alternate type": |
| 1042 | // - for Int32, this indicates that the actual type is Enum (but was |
| 1043 | // rewritten to Int32 because it is an open enum that requires no check). |
| 1044 | // - for Bytes, this indicates that the actual type is String (but does |
| 1045 | // not require any UTF-8 check). |
| 1046 | kUpb_LabelFlags_IsAlternate = 16, |
| 1047 | } upb_LabelFlags; |
| 1048 | |
| 1049 | // Note: we sort by this number when calculating layout order. |
| 1050 | typedef enum { |
| 1051 | kUpb_FieldRep_1Byte = 0, |
| 1052 | kUpb_FieldRep_4Byte = 1, |
| 1053 | kUpb_FieldRep_StringView = 2, |
| 1054 | kUpb_FieldRep_8Byte = 3, |
| 1055 | |
| 1056 | kUpb_FieldRep_NativePointer = |
| 1057 | UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte), |
| 1058 | kUpb_FieldRep_Max = kUpb_FieldRep_8Byte, |
| 1059 | } upb_FieldRep; |
| 1060 | |
| 1061 | #define kUpb_FieldRep_Shift 6 |
| 1062 | |
| 1063 | UPB_INLINE upb_FieldRep |
| 1064 | _upb_MiniTableField_GetRep(const struct upb_MiniTableField* field) { |
| 1065 | return (upb_FieldRep)(field->mode >> kUpb_FieldRep_Shift); |
| 1066 | } |
| 1067 | |
| 1068 | #ifdef __cplusplus |
| 1069 | extern "C" { |
| 1070 | #endif |
| 1071 | |
| 1072 | UPB_INLINE upb_FieldMode |
| 1073 | upb_FieldMode_Get(const struct upb_MiniTableField* field) { |
| 1074 | return (upb_FieldMode)(field->mode & 3); |
| 1075 | } |
| 1076 | |
| 1077 | UPB_INLINE void _upb_MiniTableField_CheckIsArray( |
| 1078 | const struct upb_MiniTableField* field) { |
| 1079 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_NativePointer); |
| 1080 | UPB_ASSUME(upb_FieldMode_Get(field) == kUpb_FieldMode_Array); |
| 1081 | UPB_ASSUME(field->presence == 0); |
| 1082 | } |
| 1083 | |
| 1084 | UPB_INLINE void _upb_MiniTableField_CheckIsMap( |
| 1085 | const struct upb_MiniTableField* field) { |
| 1086 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_NativePointer); |
| 1087 | UPB_ASSUME(upb_FieldMode_Get(field) == kUpb_FieldMode_Map); |
| 1088 | UPB_ASSUME(field->presence == 0); |
| 1089 | } |
| 1090 | |
| 1091 | UPB_INLINE bool upb_IsRepeatedOrMap(const struct upb_MiniTableField* field) { |
| 1092 | // This works because upb_FieldMode has no value 3. |
| 1093 | return !(field->mode & kUpb_FieldMode_Scalar); |
| 1094 | } |
| 1095 | |
| 1096 | UPB_INLINE bool upb_IsSubMessage(const struct upb_MiniTableField* field) { |
| 1097 | return field->UPB_PRIVATE(descriptortype) == kUpb_FieldType_Message || |
| 1098 | field->UPB_PRIVATE(descriptortype) == kUpb_FieldType_Group; |
| 1099 | } |
| 1100 | |
| 1101 | #ifdef __cplusplus |
| 1102 | } /* extern "C" */ |
| 1103 | #endif |
| 1104 | |
| 1105 | |
| 1106 | #endif /* UPB_MINI_TABLE_INTERNAL_FIELD_H_ */ |
| 1107 | |
| 1108 | #ifndef UPB_MINI_TABLE_INTERNAL_MESSAGE_H_ |
| 1109 | #define UPB_MINI_TABLE_INTERNAL_MESSAGE_H_ |
| 1110 | |
| 1111 | |
| 1112 | // Must be last. |
| 1113 | |
| 1114 | struct upb_Decoder; |
| 1115 | typedef const char* _upb_FieldParser(struct upb_Decoder* d, const char* ptr, |
| 1116 | upb_Message* msg, intptr_t table, |
| 1117 | uint64_t hasbits, uint64_t data); |
| 1118 | typedef struct { |
| 1119 | uint64_t field_data; |
| 1120 | _upb_FieldParser* field_parser; |
| 1121 | } _upb_FastTable_Entry; |
| 1122 | |
| 1123 | typedef enum { |
| 1124 | kUpb_ExtMode_NonExtendable = 0, // Non-extendable message. |
| 1125 | kUpb_ExtMode_Extendable = 1, // Normal extendable message. |
| 1126 | kUpb_ExtMode_IsMessageSet = 2, // MessageSet message. |
| 1127 | kUpb_ExtMode_IsMessageSet_ITEM = |
| 1128 | 3, // MessageSet item (temporary only, see decode.c) |
| 1129 | |
| 1130 | // During table building we steal a bit to indicate that the message is a map |
| 1131 | // entry. *Only* used during table building! |
| 1132 | kUpb_ExtMode_IsMapEntry = 4, |
| 1133 | } upb_ExtMode; |
| 1134 | |
| 1135 | union upb_MiniTableSub; |
| 1136 | |
| 1137 | // upb_MiniTable represents the memory layout of a given upb_MessageDef. |
| 1138 | // The members are public so generated code can initialize them, |
| 1139 | // but users MUST NOT directly read or write any of its members. |
| 1140 | struct upb_MiniTable { |
| 1141 | const union upb_MiniTableSub* subs; |
| 1142 | const struct upb_MiniTableField* fields; |
| 1143 | |
| 1144 | // Must be aligned to sizeof(void*). Doesn't include internal members like |
| 1145 | // unknown fields, extension dict, pointer to msglayout, etc. |
| 1146 | uint16_t size; |
| 1147 | |
| 1148 | uint16_t field_count; |
| 1149 | uint8_t ext; // upb_ExtMode, declared as uint8_t so sizeof(ext) == 1 |
| 1150 | uint8_t dense_below; |
| 1151 | uint8_t table_mask; |
| 1152 | uint8_t required_count; // Required fields have the lowest hasbits. |
| 1153 | |
| 1154 | // To statically initialize the tables of variable length, we need a flexible |
| 1155 | // array member, and we need to compile in gnu99 mode (constant initialization |
| 1156 | // of flexible array members is a GNU extension, not in C99 unfortunately. |
| 1157 | _upb_FastTable_Entry fasttable[]; |
| 1158 | }; |
| 1159 | |
| 1160 | #ifdef __cplusplus |
| 1161 | extern "C" { |
| 1162 | #endif |
| 1163 | |
| 1164 | // A MiniTable for an empty message, used for unlinked sub-messages. |
| 1165 | extern const struct upb_MiniTable _kUpb_MiniTable_Empty; |
| 1166 | |
| 1167 | // Computes a bitmask in which the |l->required_count| lowest bits are set, |
| 1168 | // except that we skip the lowest bit (because upb never uses hasbit 0). |
| 1169 | // |
| 1170 | // Sample output: |
| 1171 | // requiredmask(1) => 0b10 (0x2) |
| 1172 | // requiredmask(5) => 0b111110 (0x3e) |
| 1173 | UPB_INLINE uint64_t upb_MiniTable_requiredmask(const struct upb_MiniTable* l) { |
| 1174 | int n = l->required_count; |
| 1175 | assert(0 < n && n <= 63); |
| 1176 | return ((1ULL << n) - 1) << 1; |
| 1177 | } |
| 1178 | |
| 1179 | #ifdef __cplusplus |
| 1180 | } /* extern "C" */ |
| 1181 | #endif |
| 1182 | |
| 1183 | |
| 1184 | #endif /* UPB_MINI_TABLE_INTERNAL_MESSAGE_H_ */ |
Protobuf Team Bot | 473d20d | 2023-09-15 22:27:16 +0000 | [diff] [blame] | 1185 | #ifndef UPB_MINI_TABLE_INTERNAL_SUB_H_ |
| 1186 | #define UPB_MINI_TABLE_INTERNAL_SUB_H_ |
| 1187 | |
| 1188 | |
| 1189 | union upb_MiniTableSub { |
| 1190 | const struct upb_MiniTable* submsg; |
| 1191 | const struct upb_MiniTableEnum* subenum; |
| 1192 | }; |
| 1193 | |
| 1194 | #endif /* UPB_MINI_TABLE_INTERNAL_SUB_H_ */ |
| 1195 | |
| 1196 | // Must be last. |
| 1197 | |
| 1198 | #ifdef __cplusplus |
| 1199 | extern "C" { |
| 1200 | #endif |
| 1201 | |
| 1202 | typedef struct upb_MiniTableField upb_MiniTableField; |
| 1203 | |
| 1204 | UPB_API_INLINE upb_FieldType |
| 1205 | upb_MiniTableField_Type(const upb_MiniTableField* field) { |
| 1206 | if (field->mode & kUpb_LabelFlags_IsAlternate) { |
| 1207 | if (field->UPB_PRIVATE(descriptortype) == kUpb_FieldType_Int32) { |
| 1208 | return kUpb_FieldType_Enum; |
| 1209 | } else if (field->UPB_PRIVATE(descriptortype) == kUpb_FieldType_Bytes) { |
| 1210 | return kUpb_FieldType_String; |
| 1211 | } else { |
| 1212 | UPB_ASSERT(false); |
| 1213 | } |
| 1214 | } |
| 1215 | return (upb_FieldType)field->UPB_PRIVATE(descriptortype); |
| 1216 | } |
| 1217 | |
| 1218 | UPB_API_INLINE upb_CType upb_MiniTableField_CType(const upb_MiniTableField* f) { |
Protobuf Team Bot | 7c68721 | 2023-11-14 03:01:42 +0000 | [diff] [blame] | 1219 | return upb_FieldType_CType(upb_MiniTableField_Type(f)); |
Protobuf Team Bot | 473d20d | 2023-09-15 22:27:16 +0000 | [diff] [blame] | 1220 | } |
| 1221 | |
| 1222 | UPB_API_INLINE bool upb_MiniTableField_IsExtension( |
| 1223 | const upb_MiniTableField* field) { |
| 1224 | return field->mode & kUpb_LabelFlags_IsExtension; |
| 1225 | } |
| 1226 | |
| 1227 | UPB_API_INLINE bool upb_MiniTableField_IsClosedEnum( |
| 1228 | const upb_MiniTableField* field) { |
| 1229 | return field->UPB_PRIVATE(descriptortype) == kUpb_FieldType_Enum; |
| 1230 | } |
| 1231 | |
| 1232 | UPB_API_INLINE bool upb_MiniTableField_HasPresence( |
| 1233 | const upb_MiniTableField* field) { |
| 1234 | if (upb_MiniTableField_IsExtension(field)) { |
| 1235 | return !upb_IsRepeatedOrMap(field); |
| 1236 | } else { |
| 1237 | return field->presence != 0; |
| 1238 | } |
| 1239 | } |
| 1240 | |
| 1241 | #ifdef __cplusplus |
| 1242 | } /* extern "C" */ |
| 1243 | #endif |
| 1244 | |
| 1245 | |
| 1246 | #endif /* UPB_MINI_TABLE_FIELD_H_ */ |
| 1247 | |
| 1248 | // Must be last. |
| 1249 | |
| 1250 | #ifdef __cplusplus |
| 1251 | extern "C" { |
| 1252 | #endif |
| 1253 | |
| 1254 | typedef struct upb_MiniTable upb_MiniTable; |
| 1255 | |
| 1256 | UPB_API const upb_MiniTableField* upb_MiniTable_FindFieldByNumber( |
| 1257 | const upb_MiniTable* table, uint32_t number); |
| 1258 | |
| 1259 | UPB_API_INLINE const upb_MiniTableField* upb_MiniTable_GetFieldByIndex( |
| 1260 | const upb_MiniTable* t, uint32_t index) { |
| 1261 | return &t->fields[index]; |
| 1262 | } |
| 1263 | |
| 1264 | // Returns the MiniTable for this message field. If the field is unlinked, |
| 1265 | // returns NULL. |
| 1266 | UPB_API_INLINE const upb_MiniTable* upb_MiniTable_GetSubMessageTable( |
| 1267 | const upb_MiniTable* mini_table, const upb_MiniTableField* field) { |
| 1268 | UPB_ASSERT(upb_MiniTableField_CType(field) == kUpb_CType_Message); |
| 1269 | const upb_MiniTable* ret = |
| 1270 | mini_table->subs[field->UPB_PRIVATE(submsg_index)].submsg; |
| 1271 | UPB_ASSUME(ret); |
| 1272 | return ret == &_kUpb_MiniTable_Empty ? NULL : ret; |
| 1273 | } |
| 1274 | |
| 1275 | // Returns the MiniTableEnum for this enum field. If the field is unlinked, |
| 1276 | // returns NULL. |
| 1277 | UPB_API_INLINE const upb_MiniTableEnum* upb_MiniTable_GetSubEnumTable( |
| 1278 | const upb_MiniTable* mini_table, const upb_MiniTableField* field) { |
| 1279 | UPB_ASSERT(upb_MiniTableField_CType(field) == kUpb_CType_Enum); |
| 1280 | return mini_table->subs[field->UPB_PRIVATE(submsg_index)].subenum; |
| 1281 | } |
| 1282 | |
| 1283 | // Returns true if this MiniTable field is linked to a MiniTable for the |
| 1284 | // sub-message. |
| 1285 | UPB_API_INLINE bool upb_MiniTable_MessageFieldIsLinked( |
| 1286 | const upb_MiniTable* mini_table, const upb_MiniTableField* field) { |
| 1287 | return upb_MiniTable_GetSubMessageTable(mini_table, field) != NULL; |
| 1288 | } |
| 1289 | |
| 1290 | // If this field is in a oneof, returns the first field in the oneof. |
| 1291 | // |
| 1292 | // Otherwise returns NULL. |
| 1293 | // |
| 1294 | // Usage: |
| 1295 | // const upb_MiniTableField* field = upb_MiniTable_GetOneof(m, f); |
| 1296 | // do { |
| 1297 | // .. |
| 1298 | // } while (upb_MiniTable_NextOneofField(m, &field); |
| 1299 | // |
| 1300 | const upb_MiniTableField* upb_MiniTable_GetOneof(const upb_MiniTable* m, |
| 1301 | const upb_MiniTableField* f); |
| 1302 | |
| 1303 | // Iterates to the next field in the oneof. If this is the last field in the |
| 1304 | // oneof, returns false. The ordering of fields in the oneof is not |
| 1305 | // guaranteed. |
| 1306 | // REQUIRES: |f| is the field initialized by upb_MiniTable_GetOneof and updated |
| 1307 | // by prior upb_MiniTable_NextOneofField calls. |
| 1308 | bool upb_MiniTable_NextOneofField(const upb_MiniTable* m, |
| 1309 | const upb_MiniTableField** f); |
| 1310 | |
| 1311 | #ifdef __cplusplus |
| 1312 | } /* extern "C" */ |
| 1313 | #endif |
| 1314 | |
| 1315 | |
| 1316 | #endif /* UPB_MINI_TABLE_MESSAGE_H_ */ |
| 1317 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1318 | // Must be last. |
| 1319 | |
| 1320 | #ifdef __cplusplus |
| 1321 | extern "C" { |
| 1322 | #endif |
| 1323 | |
| 1324 | // 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] | 1325 | UPB_API upb_Message* upb_Message_New(const upb_MiniTable* mini_table, |
| 1326 | upb_Arena* arena); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1327 | |
| 1328 | // Adds unknown data (serialized protobuf data) to the given message. |
| 1329 | // The data is copied into the message instance. |
| 1330 | void upb_Message_AddUnknown(upb_Message* msg, const char* data, size_t len, |
| 1331 | upb_Arena* arena); |
| 1332 | |
| 1333 | // Returns a reference to the message's unknown data. |
| 1334 | const char* upb_Message_GetUnknown(const upb_Message* msg, size_t* len); |
| 1335 | |
| 1336 | // Removes partial unknown data from message. |
| 1337 | void upb_Message_DeleteUnknown(upb_Message* msg, const char* data, size_t len); |
| 1338 | |
| 1339 | // Returns the number of extensions present in this message. |
| 1340 | size_t upb_Message_ExtensionCount(const upb_Message* msg); |
| 1341 | |
| 1342 | #ifdef __cplusplus |
| 1343 | } /* extern "C" */ |
| 1344 | #endif |
| 1345 | |
| 1346 | |
| 1347 | #endif /* UPB_MESSAGE_MESSAGE_H_ */ |
| 1348 | |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 1349 | #ifndef UPB_MINI_TABLE_EXTENSION_H_ |
| 1350 | #define UPB_MINI_TABLE_EXTENSION_H_ |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1351 | |
| 1352 | |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 1353 | #ifndef UPB_MINI_TABLE_INTERNAL_EXTENSION_H_ |
| 1354 | #define UPB_MINI_TABLE_INTERNAL_EXTENSION_H_ |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1355 | |
| 1356 | |
| 1357 | // Must be last. |
| 1358 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1359 | struct upb_MiniTableExtension { |
Deanna Garcia | 59cfc2f | 2023-01-31 13:19:28 -0800 | [diff] [blame] | 1360 | // 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] | 1361 | struct upb_MiniTableField field; |
Deanna Garcia | 59cfc2f | 2023-01-31 13:19:28 -0800 | [diff] [blame] | 1362 | |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 1363 | const struct upb_MiniTable* extendee; |
| 1364 | union upb_MiniTableSub sub; // NULL unless submessage or proto2 enum |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1365 | }; |
| 1366 | |
| 1367 | |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 1368 | #endif /* UPB_MINI_TABLE_INTERNAL_EXTENSION_H_ */ |
| 1369 | |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 1370 | typedef struct upb_MiniTableExtension upb_MiniTableExtension; |
| 1371 | |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 1372 | #endif /* UPB_MINI_TABLE_EXTENSION_H_ */ |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1373 | |
| 1374 | // Must be last. |
| 1375 | |
| 1376 | // The internal representation of an extension is self-describing: it contains |
| 1377 | // enough information that we can serialize it to binary format without needing |
| 1378 | // to look it up in a upb_ExtensionRegistry. |
| 1379 | // |
| 1380 | // This representation allocates 16 bytes to data on 64-bit platforms. |
| 1381 | // This is rather wasteful for scalars (in the extreme case of bool, |
| 1382 | // it wastes 15 bytes). We accept this because we expect messages to be |
| 1383 | // the most common extension type. |
| 1384 | typedef struct { |
| 1385 | const upb_MiniTableExtension* ext; |
| 1386 | union { |
| 1387 | upb_StringView str; |
| 1388 | void* ptr; |
| 1389 | char scalar_data[8]; |
| 1390 | } data; |
| 1391 | } upb_Message_Extension; |
| 1392 | |
| 1393 | #ifdef __cplusplus |
| 1394 | extern "C" { |
| 1395 | #endif |
| 1396 | |
| 1397 | // Adds the given extension data to the given message. |
| 1398 | // |ext| is copied into the message instance. |
| 1399 | // This logically replaces any previously-added extension with this number. |
| 1400 | upb_Message_Extension* _upb_Message_GetOrCreateExtension( |
| 1401 | upb_Message* msg, const upb_MiniTableExtension* ext, upb_Arena* arena); |
| 1402 | |
| 1403 | // Returns an array of extensions for this message. |
| 1404 | // Note: the array is ordered in reverse relative to the order of creation. |
| 1405 | const upb_Message_Extension* _upb_Message_Getexts(const upb_Message* msg, |
| 1406 | size_t* count); |
| 1407 | |
| 1408 | // Returns an extension for the given field number, or NULL if no extension |
| 1409 | // exists for this field number. |
| 1410 | const upb_Message_Extension* _upb_Message_Getext( |
| 1411 | const upb_Message* msg, const upb_MiniTableExtension* ext); |
| 1412 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1413 | #ifdef __cplusplus |
| 1414 | } /* extern "C" */ |
| 1415 | #endif |
| 1416 | |
| 1417 | |
Adam Cozzette | 8059da2 | 2023-08-16 07:57:14 -0700 | [diff] [blame] | 1418 | #endif /* UPB_MESSAGE_INTERNAL_EXTENSION_H_ */ |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1419 | |
Protobuf Team Bot | 376ba2f | 2023-09-29 22:17:43 +0000 | [diff] [blame] | 1420 | // EVERYTHING BELOW THIS LINE IS INTERNAL - DO NOT USE ///////////////////////// |
| 1421 | |
| 1422 | #ifndef UPB_COLLECTIONS_INTERNAL_MAP_H_ |
| 1423 | #define UPB_COLLECTIONS_INTERNAL_MAP_H_ |
| 1424 | |
| 1425 | |
| 1426 | #ifndef UPB_HASH_STR_TABLE_H_ |
| 1427 | #define UPB_HASH_STR_TABLE_H_ |
| 1428 | |
| 1429 | |
| 1430 | /* |
| 1431 | * upb_table |
| 1432 | * |
| 1433 | * This header is INTERNAL-ONLY! Its interfaces are not public or stable! |
| 1434 | * This file defines very fast int->upb_value (inttable) and string->upb_value |
| 1435 | * (strtable) hash tables. |
| 1436 | * |
| 1437 | * The table uses chained scatter with Brent's variation (inspired by the Lua |
| 1438 | * implementation of hash tables). The hash function for strings is Austin |
| 1439 | * Appleby's "MurmurHash." |
| 1440 | * |
| 1441 | * The inttable uses uintptr_t as its key, which guarantees it can be used to |
| 1442 | * store pointers or integers of at least 32 bits (upb isn't really useful on |
| 1443 | * systems where sizeof(void*) < 4). |
| 1444 | * |
| 1445 | * The table must be homogeneous (all values of the same type). In debug |
| 1446 | * mode, we check this on insert and lookup. |
| 1447 | */ |
| 1448 | |
| 1449 | #ifndef UPB_HASH_COMMON_H_ |
| 1450 | #define UPB_HASH_COMMON_H_ |
| 1451 | |
| 1452 | #include <string.h> |
| 1453 | |
| 1454 | |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 1455 | // Must be last. |
| 1456 | |
| 1457 | #ifdef __cplusplus |
| 1458 | extern "C" { |
| 1459 | #endif |
| 1460 | |
Protobuf Team Bot | 376ba2f | 2023-09-29 22:17:43 +0000 | [diff] [blame] | 1461 | /* upb_value ******************************************************************/ |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 1462 | |
| 1463 | typedef struct { |
Protobuf Team Bot | 376ba2f | 2023-09-29 22:17:43 +0000 | [diff] [blame] | 1464 | uint64_t val; |
| 1465 | } upb_value; |
| 1466 | |
| 1467 | UPB_INLINE void _upb_value_setval(upb_value* v, uint64_t val) { v->val = val; } |
| 1468 | |
| 1469 | /* For each value ctype, define the following set of functions: |
| 1470 | * |
| 1471 | * // Get/set an int32 from a upb_value. |
| 1472 | * int32_t upb_value_getint32(upb_value val); |
| 1473 | * void upb_value_setint32(upb_value *val, int32_t cval); |
| 1474 | * |
| 1475 | * // Construct a new upb_value from an int32. |
| 1476 | * upb_value upb_value_int32(int32_t val); */ |
| 1477 | #define FUNCS(name, membername, type_t, converter) \ |
| 1478 | UPB_INLINE void upb_value_set##name(upb_value* val, type_t cval) { \ |
| 1479 | val->val = (converter)cval; \ |
| 1480 | } \ |
| 1481 | UPB_INLINE upb_value upb_value_##name(type_t val) { \ |
| 1482 | upb_value ret; \ |
| 1483 | upb_value_set##name(&ret, val); \ |
| 1484 | return ret; \ |
| 1485 | } \ |
| 1486 | UPB_INLINE type_t upb_value_get##name(upb_value val) { \ |
| 1487 | return (type_t)(converter)val.val; \ |
| 1488 | } |
| 1489 | |
| 1490 | FUNCS(int32, int32, int32_t, int32_t) |
| 1491 | FUNCS(int64, int64, int64_t, int64_t) |
| 1492 | FUNCS(uint32, uint32, uint32_t, uint32_t) |
| 1493 | FUNCS(uint64, uint64, uint64_t, uint64_t) |
| 1494 | FUNCS(bool, _bool, bool, bool) |
| 1495 | FUNCS(cstr, cstr, char*, uintptr_t) |
| 1496 | FUNCS(uintptr, uptr, uintptr_t, uintptr_t) |
| 1497 | FUNCS(ptr, ptr, void*, uintptr_t) |
| 1498 | FUNCS(constptr, constptr, const void*, uintptr_t) |
| 1499 | |
| 1500 | #undef FUNCS |
| 1501 | |
| 1502 | UPB_INLINE void upb_value_setfloat(upb_value* val, float cval) { |
| 1503 | memcpy(&val->val, &cval, sizeof(cval)); |
| 1504 | } |
| 1505 | |
| 1506 | UPB_INLINE void upb_value_setdouble(upb_value* val, double cval) { |
| 1507 | memcpy(&val->val, &cval, sizeof(cval)); |
| 1508 | } |
| 1509 | |
| 1510 | UPB_INLINE upb_value upb_value_float(float cval) { |
| 1511 | upb_value ret; |
| 1512 | upb_value_setfloat(&ret, cval); |
| 1513 | return ret; |
| 1514 | } |
| 1515 | |
| 1516 | UPB_INLINE upb_value upb_value_double(double cval) { |
| 1517 | upb_value ret; |
| 1518 | upb_value_setdouble(&ret, cval); |
| 1519 | return ret; |
| 1520 | } |
| 1521 | |
| 1522 | /* upb_tabkey *****************************************************************/ |
| 1523 | |
| 1524 | /* Either: |
| 1525 | * 1. an actual integer key, or |
| 1526 | * 2. a pointer to a string prefixed by its uint32_t length, owned by us. |
| 1527 | * |
| 1528 | * ...depending on whether this is a string table or an int table. We would |
| 1529 | * make this a union of those two types, but C89 doesn't support statically |
| 1530 | * initializing a non-first union member. */ |
| 1531 | typedef uintptr_t upb_tabkey; |
| 1532 | |
| 1533 | UPB_INLINE char* upb_tabstr(upb_tabkey key, uint32_t* len) { |
| 1534 | char* mem = (char*)key; |
| 1535 | if (len) memcpy(len, mem, sizeof(*len)); |
| 1536 | return mem + sizeof(*len); |
| 1537 | } |
| 1538 | |
| 1539 | UPB_INLINE upb_StringView upb_tabstrview(upb_tabkey key) { |
| 1540 | upb_StringView ret; |
| 1541 | uint32_t len; |
| 1542 | ret.data = upb_tabstr(key, &len); |
| 1543 | ret.size = len; |
| 1544 | return ret; |
| 1545 | } |
| 1546 | |
| 1547 | /* upb_tabval *****************************************************************/ |
| 1548 | |
| 1549 | typedef struct upb_tabval { |
| 1550 | uint64_t val; |
| 1551 | } upb_tabval; |
| 1552 | |
| 1553 | #define UPB_TABVALUE_EMPTY_INIT \ |
| 1554 | { -1 } |
| 1555 | |
| 1556 | /* upb_table ******************************************************************/ |
| 1557 | |
| 1558 | typedef struct _upb_tabent { |
| 1559 | upb_tabkey key; |
| 1560 | upb_tabval val; |
| 1561 | |
| 1562 | /* Internal chaining. This is const so we can create static initializers for |
| 1563 | * tables. We cast away const sometimes, but *only* when the containing |
| 1564 | * upb_table is known to be non-const. This requires a bit of care, but |
| 1565 | * the subtlety is confined to table.c. */ |
| 1566 | const struct _upb_tabent* next; |
| 1567 | } upb_tabent; |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 1568 | |
| 1569 | typedef struct { |
Protobuf Team Bot | 376ba2f | 2023-09-29 22:17:43 +0000 | [diff] [blame] | 1570 | size_t count; /* Number of entries in the hash part. */ |
| 1571 | uint32_t mask; /* Mask to turn hash value -> bucket. */ |
| 1572 | uint32_t max_count; /* Max count before we hit our load limit. */ |
| 1573 | uint8_t size_lg2; /* Size of the hashtable part is 2^size_lg2 entries. */ |
| 1574 | upb_tabent* entries; |
| 1575 | } upb_table; |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 1576 | |
Protobuf Team Bot | 376ba2f | 2023-09-29 22:17:43 +0000 | [diff] [blame] | 1577 | UPB_INLINE size_t upb_table_size(const upb_table* t) { |
| 1578 | return t->size_lg2 ? 1 << t->size_lg2 : 0; |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 1579 | } |
| 1580 | |
Protobuf Team Bot | 376ba2f | 2023-09-29 22:17:43 +0000 | [diff] [blame] | 1581 | // Internal-only functions, in .h file only out of necessity. |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 1582 | |
Protobuf Team Bot | 376ba2f | 2023-09-29 22:17:43 +0000 | [diff] [blame] | 1583 | UPB_INLINE bool upb_tabent_isempty(const upb_tabent* e) { return e->key == 0; } |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 1584 | |
Protobuf Team Bot | 376ba2f | 2023-09-29 22:17:43 +0000 | [diff] [blame] | 1585 | uint32_t _upb_Hash(const void* p, size_t n, uint64_t seed); |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 1586 | |
| 1587 | #ifdef __cplusplus |
| 1588 | } /* extern "C" */ |
| 1589 | #endif |
| 1590 | |
| 1591 | |
Protobuf Team Bot | 376ba2f | 2023-09-29 22:17:43 +0000 | [diff] [blame] | 1592 | #endif /* UPB_HASH_COMMON_H_ */ |
Adam Cozzette | 8059da2 | 2023-08-16 07:57:14 -0700 | [diff] [blame] | 1593 | |
| 1594 | // Must be last. |
| 1595 | |
Protobuf Team Bot | 376ba2f | 2023-09-29 22:17:43 +0000 | [diff] [blame] | 1596 | typedef struct { |
| 1597 | upb_table t; |
| 1598 | } upb_strtable; |
| 1599 | |
Adam Cozzette | 8059da2 | 2023-08-16 07:57:14 -0700 | [diff] [blame] | 1600 | #ifdef __cplusplus |
| 1601 | extern "C" { |
| 1602 | #endif |
| 1603 | |
Protobuf Team Bot | 376ba2f | 2023-09-29 22:17:43 +0000 | [diff] [blame] | 1604 | // Initialize a table. If memory allocation failed, false is returned and |
| 1605 | // the table is uninitialized. |
| 1606 | bool upb_strtable_init(upb_strtable* table, size_t expected_size, upb_Arena* a); |
| 1607 | |
| 1608 | // Returns the number of values in the table. |
| 1609 | UPB_INLINE size_t upb_strtable_count(const upb_strtable* t) { |
| 1610 | return t->t.count; |
Adam Cozzette | 8059da2 | 2023-08-16 07:57:14 -0700 | [diff] [blame] | 1611 | } |
| 1612 | |
Protobuf Team Bot | 376ba2f | 2023-09-29 22:17:43 +0000 | [diff] [blame] | 1613 | void upb_strtable_clear(upb_strtable* t); |
| 1614 | |
| 1615 | // Inserts the given key into the hashtable with the given value. |
| 1616 | // The key must not already exist in the hash table. The key is not required |
| 1617 | // to be NULL-terminated, and the table will make an internal copy of the key. |
| 1618 | // |
| 1619 | // If a table resize was required but memory allocation failed, false is |
| 1620 | // returned and the table is unchanged. */ |
| 1621 | bool upb_strtable_insert(upb_strtable* t, const char* key, size_t len, |
| 1622 | upb_value val, upb_Arena* a); |
| 1623 | |
| 1624 | // Looks up key in this table, returning "true" if the key was found. |
| 1625 | // If v is non-NULL, copies the value for this key into *v. |
| 1626 | bool upb_strtable_lookup2(const upb_strtable* t, const char* key, size_t len, |
| 1627 | upb_value* v); |
| 1628 | |
| 1629 | // For NULL-terminated strings. |
| 1630 | UPB_INLINE bool upb_strtable_lookup(const upb_strtable* t, const char* key, |
| 1631 | upb_value* v) { |
| 1632 | return upb_strtable_lookup2(t, key, strlen(key), v); |
| 1633 | } |
| 1634 | |
| 1635 | // Removes an item from the table. Returns true if the remove was successful, |
| 1636 | // and stores the removed item in *val if non-NULL. |
| 1637 | bool upb_strtable_remove2(upb_strtable* t, const char* key, size_t len, |
| 1638 | upb_value* val); |
| 1639 | |
| 1640 | UPB_INLINE bool upb_strtable_remove(upb_strtable* t, const char* key, |
| 1641 | upb_value* v) { |
| 1642 | return upb_strtable_remove2(t, key, strlen(key), v); |
| 1643 | } |
| 1644 | |
| 1645 | // Exposed for testing only. |
| 1646 | bool upb_strtable_resize(upb_strtable* t, size_t size_lg2, upb_Arena* a); |
| 1647 | |
| 1648 | /* Iteration over strtable: |
| 1649 | * |
| 1650 | * intptr_t iter = UPB_STRTABLE_BEGIN; |
| 1651 | * upb_StringView key; |
| 1652 | * upb_value val; |
| 1653 | * while (upb_strtable_next2(t, &key, &val, &iter)) { |
| 1654 | * // ... |
| 1655 | * } |
| 1656 | */ |
| 1657 | |
| 1658 | #define UPB_STRTABLE_BEGIN -1 |
| 1659 | |
| 1660 | bool upb_strtable_next2(const upb_strtable* t, upb_StringView* key, |
| 1661 | upb_value* val, intptr_t* iter); |
| 1662 | void upb_strtable_removeiter(upb_strtable* t, intptr_t* iter); |
| 1663 | void upb_strtable_setentryvalue(upb_strtable* t, intptr_t iter, upb_value v); |
| 1664 | |
| 1665 | /* DEPRECATED iterators, slated for removal. |
| 1666 | * |
| 1667 | * Iterators for string tables. We are subject to some kind of unusual |
| 1668 | * design constraints: |
| 1669 | * |
| 1670 | * For high-level languages: |
| 1671 | * - we must be able to guarantee that we don't crash or corrupt memory even if |
| 1672 | * the program accesses an invalidated iterator. |
| 1673 | * |
| 1674 | * For C++11 range-based for: |
| 1675 | * - iterators must be copyable |
| 1676 | * - iterators must be comparable |
| 1677 | * - it must be possible to construct an "end" value. |
| 1678 | * |
| 1679 | * Iteration order is undefined. |
| 1680 | * |
| 1681 | * Modifying the table invalidates iterators. upb_{str,int}table_done() is |
| 1682 | * guaranteed to work even on an invalidated iterator, as long as the table it |
| 1683 | * is iterating over has not been freed. Calling next() or accessing data from |
| 1684 | * an invalidated iterator yields unspecified elements from the table, but it is |
| 1685 | * guaranteed not to crash and to return real table elements (except when done() |
| 1686 | * is true). */ |
| 1687 | /* upb_strtable_iter **********************************************************/ |
| 1688 | |
| 1689 | /* upb_strtable_iter i; |
| 1690 | * upb_strtable_begin(&i, t); |
| 1691 | * for(; !upb_strtable_done(&i); upb_strtable_next(&i)) { |
| 1692 | * const char *key = upb_strtable_iter_key(&i); |
| 1693 | * const upb_value val = upb_strtable_iter_value(&i); |
| 1694 | * // ... |
| 1695 | * } |
| 1696 | */ |
| 1697 | |
| 1698 | typedef struct { |
| 1699 | const upb_strtable* t; |
| 1700 | size_t index; |
| 1701 | } upb_strtable_iter; |
| 1702 | |
| 1703 | UPB_INLINE const upb_tabent* str_tabent(const upb_strtable_iter* i) { |
| 1704 | return &i->t->t.entries[i->index]; |
| 1705 | } |
| 1706 | |
| 1707 | void upb_strtable_begin(upb_strtable_iter* i, const upb_strtable* t); |
| 1708 | void upb_strtable_next(upb_strtable_iter* i); |
| 1709 | bool upb_strtable_done(const upb_strtable_iter* i); |
| 1710 | upb_StringView upb_strtable_iter_key(const upb_strtable_iter* i); |
| 1711 | upb_value upb_strtable_iter_value(const upb_strtable_iter* i); |
| 1712 | void upb_strtable_iter_setdone(upb_strtable_iter* i); |
| 1713 | bool upb_strtable_iter_isequal(const upb_strtable_iter* i1, |
| 1714 | const upb_strtable_iter* i2); |
Adam Cozzette | 8059da2 | 2023-08-16 07:57:14 -0700 | [diff] [blame] | 1715 | |
| 1716 | #ifdef __cplusplus |
| 1717 | } /* extern "C" */ |
| 1718 | #endif |
| 1719 | |
| 1720 | |
Protobuf Team Bot | 376ba2f | 2023-09-29 22:17:43 +0000 | [diff] [blame] | 1721 | #endif /* UPB_HASH_STR_TABLE_H_ */ |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 1722 | |
Protobuf Team Bot | 376ba2f | 2023-09-29 22:17:43 +0000 | [diff] [blame] | 1723 | #ifndef UPB_MESSAGE_MAP_H_ |
| 1724 | #define UPB_MESSAGE_MAP_H_ |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 1725 | |
Protobuf Team Bot | 376ba2f | 2023-09-29 22:17:43 +0000 | [diff] [blame] | 1726 | #include <stddef.h> |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 1727 | |
| 1728 | |
| 1729 | // Must be last. |
| 1730 | |
Protobuf Team Bot | 376ba2f | 2023-09-29 22:17:43 +0000 | [diff] [blame] | 1731 | typedef struct upb_Map upb_Map; |
| 1732 | |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 1733 | #ifdef __cplusplus |
| 1734 | extern "C" { |
| 1735 | #endif |
| 1736 | |
Protobuf Team Bot | 376ba2f | 2023-09-29 22:17:43 +0000 | [diff] [blame] | 1737 | // Creates a new map on the given arena with the given key/value size. |
| 1738 | UPB_API upb_Map* upb_Map_New(upb_Arena* a, upb_CType key_type, |
| 1739 | upb_CType value_type); |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 1740 | |
Protobuf Team Bot | 376ba2f | 2023-09-29 22:17:43 +0000 | [diff] [blame] | 1741 | // Returns the number of entries in the map. |
| 1742 | UPB_API size_t upb_Map_Size(const upb_Map* map); |
| 1743 | |
| 1744 | // Stores a value for the given key into |*val| (or the zero value if the key is |
| 1745 | // not present). Returns whether the key was present. The |val| pointer may be |
| 1746 | // NULL, in which case the function tests whether the given key is present. |
| 1747 | UPB_API bool upb_Map_Get(const upb_Map* map, upb_MessageValue key, |
| 1748 | upb_MessageValue* val); |
| 1749 | |
| 1750 | // Removes all entries in the map. |
| 1751 | UPB_API void upb_Map_Clear(upb_Map* map); |
| 1752 | |
| 1753 | typedef enum { |
| 1754 | kUpb_MapInsertStatus_Inserted = 0, |
| 1755 | kUpb_MapInsertStatus_Replaced = 1, |
| 1756 | kUpb_MapInsertStatus_OutOfMemory = 2, |
| 1757 | } upb_MapInsertStatus; |
| 1758 | |
| 1759 | // Sets the given key to the given value, returning whether the key was inserted |
| 1760 | // or replaced. If the key was inserted, then any existing iterators will be |
| 1761 | // invalidated. |
| 1762 | UPB_API upb_MapInsertStatus upb_Map_Insert(upb_Map* map, upb_MessageValue key, |
| 1763 | upb_MessageValue val, |
| 1764 | upb_Arena* arena); |
| 1765 | |
| 1766 | // Sets the given key to the given value. Returns false if memory allocation |
| 1767 | // failed. If the key is newly inserted, then any existing iterators will be |
| 1768 | // invalidated. |
| 1769 | UPB_API_INLINE bool upb_Map_Set(upb_Map* map, upb_MessageValue key, |
| 1770 | upb_MessageValue val, upb_Arena* arena) { |
| 1771 | return upb_Map_Insert(map, key, val, arena) != |
| 1772 | kUpb_MapInsertStatus_OutOfMemory; |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 1773 | } |
| 1774 | |
Protobuf Team Bot | 376ba2f | 2023-09-29 22:17:43 +0000 | [diff] [blame] | 1775 | // Deletes this key from the table. Returns true if the key was present. |
| 1776 | // If present and |val| is non-NULL, stores the deleted value. |
| 1777 | UPB_API bool upb_Map_Delete(upb_Map* map, upb_MessageValue key, |
| 1778 | upb_MessageValue* val); |
| 1779 | |
| 1780 | // (DEPRECATED and going away soon. Do not use.) |
| 1781 | UPB_INLINE bool upb_Map_Delete2(upb_Map* map, upb_MessageValue key, |
| 1782 | upb_MessageValue* val) { |
| 1783 | return upb_Map_Delete(map, key, val); |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 1784 | } |
| 1785 | |
Protobuf Team Bot | 376ba2f | 2023-09-29 22:17:43 +0000 | [diff] [blame] | 1786 | // Map iteration: |
| 1787 | // |
| 1788 | // size_t iter = kUpb_Map_Begin; |
| 1789 | // upb_MessageValue key, val; |
| 1790 | // while (upb_Map_Next(map, &key, &val, &iter)) { |
| 1791 | // ... |
| 1792 | // } |
| 1793 | |
| 1794 | #define kUpb_Map_Begin ((size_t)-1) |
| 1795 | |
| 1796 | // Advances to the next entry. Returns false if no more entries are present. |
| 1797 | // Otherwise returns true and populates both *key and *value. |
| 1798 | UPB_API bool upb_Map_Next(const upb_Map* map, upb_MessageValue* key, |
| 1799 | upb_MessageValue* val, size_t* iter); |
| 1800 | |
| 1801 | // Sets the value for the entry pointed to by iter. |
| 1802 | // WARNING: this does not currently work for string values! |
| 1803 | UPB_API void upb_Map_SetEntryValue(upb_Map* map, size_t iter, |
| 1804 | upb_MessageValue val); |
| 1805 | |
| 1806 | // DEPRECATED iterator, slated for removal. |
| 1807 | |
| 1808 | /* Map iteration: |
| 1809 | * |
| 1810 | * size_t iter = kUpb_Map_Begin; |
| 1811 | * while (upb_MapIterator_Next(map, &iter)) { |
| 1812 | * upb_MessageValue key = upb_MapIterator_Key(map, iter); |
| 1813 | * upb_MessageValue val = upb_MapIterator_Value(map, iter); |
| 1814 | * } |
| 1815 | */ |
| 1816 | |
| 1817 | // Advances to the next entry. Returns false if no more entries are present. |
| 1818 | UPB_API bool upb_MapIterator_Next(const upb_Map* map, size_t* iter); |
| 1819 | |
| 1820 | // Returns true if the iterator still points to a valid entry, or false if the |
| 1821 | // iterator is past the last element. It is an error to call this function with |
| 1822 | // kUpb_Map_Begin (you must call next() at least once first). |
| 1823 | UPB_API bool upb_MapIterator_Done(const upb_Map* map, size_t iter); |
| 1824 | |
| 1825 | // Returns the key and value for this entry of the map. |
| 1826 | UPB_API upb_MessageValue upb_MapIterator_Key(const upb_Map* map, size_t iter); |
| 1827 | UPB_API upb_MessageValue upb_MapIterator_Value(const upb_Map* map, size_t iter); |
| 1828 | |
| 1829 | #ifdef __cplusplus |
| 1830 | } /* extern "C" */ |
| 1831 | #endif |
| 1832 | |
| 1833 | |
| 1834 | #endif /* UPB_MESSAGE_MAP_H_ */ |
| 1835 | |
| 1836 | // Must be last. |
| 1837 | |
| 1838 | struct upb_Map { |
| 1839 | // Size of key and val, based on the map type. |
| 1840 | // Strings are represented as '0' because they must be handled specially. |
| 1841 | char key_size; |
| 1842 | char val_size; |
| 1843 | |
| 1844 | upb_strtable table; |
| 1845 | }; |
| 1846 | |
| 1847 | #ifdef __cplusplus |
| 1848 | extern "C" { |
| 1849 | #endif |
| 1850 | |
| 1851 | // Converting between internal table representation and user values. |
| 1852 | // |
| 1853 | // _upb_map_tokey() and _upb_map_fromkey() are inverses. |
| 1854 | // _upb_map_tovalue() and _upb_map_fromvalue() are inverses. |
| 1855 | // |
| 1856 | // These functions account for the fact that strings are treated differently |
| 1857 | // from other types when stored in a map. |
| 1858 | |
| 1859 | UPB_INLINE upb_StringView _upb_map_tokey(const void* key, size_t size) { |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 1860 | if (size == UPB_MAPTYPE_STRING) { |
Protobuf Team Bot | 376ba2f | 2023-09-29 22:17:43 +0000 | [diff] [blame] | 1861 | return *(upb_StringView*)key; |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 1862 | } else { |
Protobuf Team Bot | 376ba2f | 2023-09-29 22:17:43 +0000 | [diff] [blame] | 1863 | return upb_StringView_FromDataAndSize((const char*)key, size); |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 1864 | } |
| 1865 | } |
| 1866 | |
Protobuf Team Bot | 376ba2f | 2023-09-29 22:17:43 +0000 | [diff] [blame] | 1867 | UPB_INLINE void _upb_map_fromkey(upb_StringView key, void* out, size_t size) { |
| 1868 | if (size == UPB_MAPTYPE_STRING) { |
| 1869 | memcpy(out, &key, sizeof(key)); |
| 1870 | } else { |
| 1871 | memcpy(out, key.data, size); |
| 1872 | } |
| 1873 | } |
| 1874 | |
| 1875 | UPB_INLINE bool _upb_map_tovalue(const void* val, size_t size, |
| 1876 | upb_value* msgval, upb_Arena* a) { |
| 1877 | if (size == UPB_MAPTYPE_STRING) { |
| 1878 | upb_StringView* strp = (upb_StringView*)upb_Arena_Malloc(a, sizeof(*strp)); |
| 1879 | if (!strp) return false; |
| 1880 | *strp = *(upb_StringView*)val; |
| 1881 | *msgval = upb_value_ptr(strp); |
| 1882 | } else { |
| 1883 | memcpy(msgval, val, size); |
| 1884 | } |
| 1885 | return true; |
| 1886 | } |
| 1887 | |
| 1888 | UPB_INLINE void _upb_map_fromvalue(upb_value val, void* out, size_t size) { |
| 1889 | if (size == UPB_MAPTYPE_STRING) { |
| 1890 | const upb_StringView* strp = (const upb_StringView*)upb_value_getptr(val); |
| 1891 | memcpy(out, strp, sizeof(upb_StringView)); |
| 1892 | } else { |
| 1893 | memcpy(out, &val, size); |
| 1894 | } |
| 1895 | } |
| 1896 | |
| 1897 | UPB_INLINE void* _upb_map_next(const upb_Map* map, size_t* iter) { |
| 1898 | upb_strtable_iter it; |
| 1899 | it.t = &map->table; |
| 1900 | it.index = *iter; |
| 1901 | upb_strtable_next(&it); |
| 1902 | *iter = it.index; |
| 1903 | if (upb_strtable_done(&it)) return NULL; |
| 1904 | return (void*)str_tabent(&it); |
| 1905 | } |
| 1906 | |
| 1907 | UPB_INLINE void _upb_Map_Clear(upb_Map* map) { |
| 1908 | upb_strtable_clear(&map->table); |
| 1909 | } |
| 1910 | |
| 1911 | UPB_INLINE bool _upb_Map_Delete(upb_Map* map, const void* key, size_t key_size, |
| 1912 | upb_value* val) { |
| 1913 | upb_StringView k = _upb_map_tokey(key, key_size); |
| 1914 | return upb_strtable_remove2(&map->table, k.data, k.size, val); |
| 1915 | } |
| 1916 | |
| 1917 | UPB_INLINE bool _upb_Map_Get(const upb_Map* map, const void* key, |
| 1918 | size_t key_size, void* val, size_t val_size) { |
| 1919 | upb_value tabval; |
| 1920 | upb_StringView k = _upb_map_tokey(key, key_size); |
| 1921 | bool ret = upb_strtable_lookup2(&map->table, k.data, k.size, &tabval); |
| 1922 | if (ret && val) { |
| 1923 | _upb_map_fromvalue(tabval, val, val_size); |
| 1924 | } |
| 1925 | return ret; |
| 1926 | } |
| 1927 | |
| 1928 | UPB_INLINE upb_MapInsertStatus _upb_Map_Insert(upb_Map* map, const void* key, |
| 1929 | size_t key_size, void* val, |
| 1930 | size_t val_size, upb_Arena* a) { |
| 1931 | upb_StringView strkey = _upb_map_tokey(key, key_size); |
| 1932 | upb_value tabval = {0}; |
| 1933 | if (!_upb_map_tovalue(val, val_size, &tabval, a)) { |
| 1934 | return kUpb_MapInsertStatus_OutOfMemory; |
| 1935 | } |
| 1936 | |
| 1937 | // TODO: add overwrite operation to minimize number of lookups. |
| 1938 | bool removed = |
| 1939 | upb_strtable_remove2(&map->table, strkey.data, strkey.size, NULL); |
| 1940 | if (!upb_strtable_insert(&map->table, strkey.data, strkey.size, tabval, a)) { |
| 1941 | return kUpb_MapInsertStatus_OutOfMemory; |
| 1942 | } |
| 1943 | return removed ? kUpb_MapInsertStatus_Replaced |
| 1944 | : kUpb_MapInsertStatus_Inserted; |
| 1945 | } |
| 1946 | |
| 1947 | UPB_INLINE size_t _upb_Map_Size(const upb_Map* map) { |
| 1948 | return map->table.t.count; |
| 1949 | } |
| 1950 | |
| 1951 | // Strings/bytes are special-cased in maps. |
| 1952 | extern char _upb_Map_CTypeSizeTable[12]; |
| 1953 | |
| 1954 | UPB_INLINE size_t _upb_Map_CTypeSize(upb_CType ctype) { |
| 1955 | return _upb_Map_CTypeSizeTable[ctype]; |
| 1956 | } |
| 1957 | |
| 1958 | // Creates a new map on the given arena with this key/value type. |
| 1959 | upb_Map* _upb_Map_New(upb_Arena* a, size_t key_size, size_t value_size); |
| 1960 | |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 1961 | #ifdef __cplusplus |
| 1962 | } /* extern "C" */ |
| 1963 | #endif |
| 1964 | |
| 1965 | |
Protobuf Team Bot | 376ba2f | 2023-09-29 22:17:43 +0000 | [diff] [blame] | 1966 | #endif /* UPB_COLLECTIONS_INTERNAL_MAP_H_ */ |
Adam Cozzette | 8059da2 | 2023-08-16 07:57:14 -0700 | [diff] [blame] | 1967 | |
Sandy Zhang | e3b0943 | 2023-08-07 09:30:02 -0700 | [diff] [blame] | 1968 | /* |
| 1969 | ** Our memory representation for parsing tables and messages themselves. |
| 1970 | ** Functions in this file are used by generated code and possibly reflection. |
| 1971 | ** |
| 1972 | ** The definitions in this file are internal to upb. |
| 1973 | **/ |
| 1974 | |
| 1975 | #ifndef UPB_MESSAGE_INTERNAL_H_ |
| 1976 | #define UPB_MESSAGE_INTERNAL_H_ |
| 1977 | |
| 1978 | #include <stdlib.h> |
| 1979 | #include <string.h> |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 1980 | |
| 1981 | |
Protobuf Team Bot | 376ba2f | 2023-09-29 22:17:43 +0000 | [diff] [blame] | 1982 | #ifndef UPB_MINI_TABLE_INTERNAL_TYPES_H_ |
| 1983 | #define UPB_MINI_TABLE_INTERNAL_TYPES_H_ |
| 1984 | |
| 1985 | typedef struct upb_Message_InternalData upb_Message_InternalData; |
| 1986 | |
| 1987 | typedef struct { |
| 1988 | union { |
| 1989 | upb_Message_InternalData* internal; |
| 1990 | |
| 1991 | // Force 8-byte alignment, since the data members may contain members that |
| 1992 | // require 8-byte alignment. |
| 1993 | double d; |
| 1994 | }; |
| 1995 | } upb_Message_Internal; |
| 1996 | |
| 1997 | #endif // UPB_MINI_TABLE_INTERNAL_TYPES_H_ |
| 1998 | |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 1999 | #ifndef UPB_MINI_TABLE_EXTENSION_REGISTRY_H_ |
| 2000 | #define UPB_MINI_TABLE_EXTENSION_REGISTRY_H_ |
| 2001 | |
| 2002 | |
| 2003 | // Must be last. |
| 2004 | |
| 2005 | #ifdef __cplusplus |
| 2006 | extern "C" { |
| 2007 | #endif |
| 2008 | |
| 2009 | /* Extension registry: a dynamic data structure that stores a map of: |
| 2010 | * (upb_MiniTable, number) -> extension info |
| 2011 | * |
| 2012 | * upb_decode() uses upb_ExtensionRegistry to look up extensions while parsing |
| 2013 | * binary format. |
| 2014 | * |
| 2015 | * upb_ExtensionRegistry is part of the mini-table (msglayout) family of |
| 2016 | * objects. Like all mini-table objects, it is suitable for reflection-less |
| 2017 | * builds that do not want to expose names into the binary. |
| 2018 | * |
| 2019 | * Unlike most mini-table types, upb_ExtensionRegistry requires dynamic memory |
| 2020 | * allocation and dynamic initialization: |
| 2021 | * * If reflection is being used, then upb_DefPool will construct an appropriate |
| 2022 | * upb_ExtensionRegistry automatically. |
| 2023 | * * For a mini-table only build, the user must manually construct the |
| 2024 | * upb_ExtensionRegistry and populate it with all of the extensions the user |
| 2025 | * cares about. |
| 2026 | * * A third alternative is to manually unpack relevant extensions after the |
| 2027 | * main parse is complete, similar to how Any works. This is perhaps the |
| 2028 | * nicest solution from the perspective of reducing dependencies, avoiding |
| 2029 | * dynamic memory allocation, and avoiding the need to parse uninteresting |
| 2030 | * extensions. The downsides are: |
| 2031 | * (1) parse errors are not caught during the main parse |
| 2032 | * (2) the CPU hit of parsing comes during access, which could cause an |
| 2033 | * undesirable stutter in application performance. |
| 2034 | * |
| 2035 | * Users cannot directly get or put into this map. Users can only add the |
| 2036 | * extensions from a generated module and pass the extension registry to the |
| 2037 | * binary decoder. |
| 2038 | * |
| 2039 | * A upb_DefPool provides a upb_ExtensionRegistry, so any users who use |
| 2040 | * reflection do not need to populate a upb_ExtensionRegistry directly. |
| 2041 | */ |
| 2042 | |
| 2043 | typedef struct upb_ExtensionRegistry upb_ExtensionRegistry; |
| 2044 | |
| 2045 | // Creates a upb_ExtensionRegistry in the given arena. |
| 2046 | // The arena must outlive any use of the extreg. |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2047 | UPB_API upb_ExtensionRegistry* upb_ExtensionRegistry_New(upb_Arena* arena); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 2048 | |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 2049 | UPB_API bool upb_ExtensionRegistry_Add(upb_ExtensionRegistry* r, |
| 2050 | const upb_MiniTableExtension* e); |
| 2051 | |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 2052 | // Adds the given extension info for the array |e| of size |count| into the |
| 2053 | // registry. If there are any errors, the entire array is backed out. |
| 2054 | // The extensions must outlive the registry. |
| 2055 | // Possible errors include OOM or an extension number that already exists. |
Protobuf Team Bot | 986cbb6 | 2023-09-19 15:03:51 +0000 | [diff] [blame] | 2056 | // 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] | 2057 | bool upb_ExtensionRegistry_AddArray(upb_ExtensionRegistry* r, |
| 2058 | const upb_MiniTableExtension** e, |
| 2059 | size_t count); |
| 2060 | |
| 2061 | // Looks up the extension (if any) defined for message type |t| and field |
| 2062 | // number |num|. Returns the extension if found, otherwise NULL. |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 2063 | UPB_API const upb_MiniTableExtension* upb_ExtensionRegistry_Lookup( |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 2064 | const upb_ExtensionRegistry* r, const upb_MiniTable* t, uint32_t num); |
| 2065 | |
| 2066 | #ifdef __cplusplus |
| 2067 | } /* extern "C" */ |
| 2068 | #endif |
| 2069 | |
| 2070 | |
| 2071 | #endif /* UPB_MINI_TABLE_EXTENSION_REGISTRY_H_ */ |
| 2072 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2073 | // Must be last. |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 2074 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2075 | #ifdef __cplusplus |
| 2076 | extern "C" { |
| 2077 | #endif |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 2078 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2079 | extern const float kUpb_FltInfinity; |
| 2080 | extern const double kUpb_Infinity; |
| 2081 | extern const double kUpb_NaN; |
| 2082 | |
| 2083 | /* Internal members of a upb_Message that track unknown fields and/or |
| 2084 | * extensions. We can change this without breaking binary compatibility. We put |
| 2085 | * these before the user's data. The user's upb_Message* points after the |
| 2086 | * upb_Message_Internal. */ |
| 2087 | |
Protobuf Team Bot | dcc1f61 | 2023-09-05 21:56:25 +0000 | [diff] [blame] | 2088 | struct upb_Message_InternalData { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2089 | /* Total size of this structure, including the data that follows. |
| 2090 | * Must be aligned to 8, which is alignof(upb_Message_Extension) */ |
| 2091 | uint32_t size; |
| 2092 | |
| 2093 | /* Offsets relative to the beginning of this structure. |
| 2094 | * |
| 2095 | * Unknown data grows forward from the beginning to unknown_end. |
| 2096 | * Extension data grows backward from size to ext_begin. |
| 2097 | * When the two meet, we're out of data and have to realloc. |
| 2098 | * |
| 2099 | * If we imagine that the final member of this struct is: |
| 2100 | * char data[size - overhead]; // overhead = |
| 2101 | * sizeof(upb_Message_InternalData) |
| 2102 | * |
| 2103 | * Then we have: |
| 2104 | * unknown data: data[0 .. (unknown_end - overhead)] |
| 2105 | * extensions data: data[(ext_begin - overhead) .. (size - overhead)] */ |
| 2106 | uint32_t unknown_end; |
| 2107 | uint32_t ext_begin; |
| 2108 | /* Data follows, as if there were an array: |
| 2109 | * char data[size - sizeof(upb_Message_InternalData)]; */ |
Protobuf Team Bot | dcc1f61 | 2023-09-05 21:56:25 +0000 | [diff] [blame] | 2110 | }; |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2111 | |
| 2112 | /* Maps upb_CType -> memory size. */ |
| 2113 | extern char _upb_CTypeo_size[12]; |
| 2114 | |
| 2115 | UPB_INLINE size_t upb_msg_sizeof(const upb_MiniTable* t) { |
| 2116 | return t->size + sizeof(upb_Message_Internal); |
| 2117 | } |
| 2118 | |
| 2119 | // Inline version upb_Message_New(), for internal use. |
| 2120 | UPB_INLINE upb_Message* _upb_Message_New(const upb_MiniTable* mini_table, |
| 2121 | upb_Arena* arena) { |
| 2122 | size_t size = upb_msg_sizeof(mini_table); |
| 2123 | void* mem = upb_Arena_Malloc(arena, size + sizeof(upb_Message_Internal)); |
| 2124 | if (UPB_UNLIKELY(!mem)) return NULL; |
| 2125 | upb_Message* msg = UPB_PTR_AT(mem, sizeof(upb_Message_Internal), upb_Message); |
| 2126 | memset(mem, 0, size); |
| 2127 | return msg; |
| 2128 | } |
| 2129 | |
| 2130 | UPB_INLINE upb_Message_Internal* upb_Message_Getinternal( |
| 2131 | const upb_Message* msg) { |
| 2132 | ptrdiff_t size = sizeof(upb_Message_Internal); |
| 2133 | return (upb_Message_Internal*)((char*)msg - size); |
| 2134 | } |
| 2135 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2136 | // Discards the unknown fields for this message only. |
| 2137 | void _upb_Message_DiscardUnknown_shallow(upb_Message* msg); |
| 2138 | |
| 2139 | // Adds unknown data (serialized protobuf data) to the given message. |
| 2140 | // The data is copied into the message instance. |
| 2141 | bool _upb_Message_AddUnknown(upb_Message* msg, const char* data, size_t len, |
| 2142 | upb_Arena* arena); |
| 2143 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2144 | #ifdef __cplusplus |
| 2145 | } /* extern "C" */ |
| 2146 | #endif |
| 2147 | |
| 2148 | |
| 2149 | #endif /* UPB_MESSAGE_INTERNAL_H_ */ |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 2150 | |
Protobuf Team Bot | 7c68721 | 2023-11-14 03:01:42 +0000 | [diff] [blame] | 2151 | #ifndef UPB_MESSAGE_INTERNAL_SIZE_LOG2_H_ |
| 2152 | #define UPB_MESSAGE_INTERNAL_SIZE_LOG2_H_ |
| 2153 | |
| 2154 | #include <stddef.h> |
| 2155 | #include <stdint.h> |
| 2156 | |
| 2157 | |
| 2158 | // Must be last. |
| 2159 | |
| 2160 | #ifdef __cplusplus |
| 2161 | extern "C" { |
| 2162 | #endif |
| 2163 | |
| 2164 | // Return the log2 of the storage size in bytes for a upb_CType |
| 2165 | UPB_INLINE int upb_SizeLog2_CType(upb_CType c_type) { |
| 2166 | static const int8_t size[] = { |
| 2167 | 0, // kUpb_CType_Bool |
| 2168 | 2, // kUpb_CType_Float |
| 2169 | 2, // kUpb_CType_Int32 |
| 2170 | 2, // kUpb_CType_UInt32 |
| 2171 | 2, // kUpb_CType_Enum |
| 2172 | UPB_SIZE(2, 3), // kUpb_CType_Message |
| 2173 | 3, // kUpb_CType_Double |
| 2174 | 3, // kUpb_CType_Int64 |
| 2175 | 3, // kUpb_CType_UInt64 |
| 2176 | UPB_SIZE(3, 4), // kUpb_CType_String |
| 2177 | UPB_SIZE(3, 4), // kUpb_CType_Bytes |
| 2178 | }; |
| 2179 | |
| 2180 | // -1 here because the enum is one-based but the table is zero-based. |
| 2181 | return size[c_type - 1]; |
| 2182 | } |
| 2183 | |
| 2184 | // Return the log2 of the storage size in bytes for a upb_FieldType |
| 2185 | UPB_INLINE int upb_SizeLog2_FieldType(upb_FieldType field_type) { |
| 2186 | static const int8_t size[] = { |
| 2187 | 3, // kUpb_FieldType_Double |
| 2188 | 2, // kUpb_FieldType_Float |
| 2189 | 3, // kUpb_FieldType_Int64 |
| 2190 | 3, // kUpb_FieldType_UInt64 |
| 2191 | 2, // kUpb_FieldType_Int32 |
| 2192 | 3, // kUpb_FieldType_Fixed64 |
| 2193 | 2, // kUpb_FieldType_Fixed32 |
| 2194 | 0, // kUpb_FieldType_Bool |
| 2195 | UPB_SIZE(3, 4), // kUpb_FieldType_String |
| 2196 | UPB_SIZE(2, 3), // kUpb_FieldType_Group |
| 2197 | UPB_SIZE(2, 3), // kUpb_FieldType_Message |
| 2198 | UPB_SIZE(3, 4), // kUpb_FieldType_Bytes |
| 2199 | 2, // kUpb_FieldType_UInt32 |
| 2200 | 2, // kUpb_FieldType_Enum |
| 2201 | 2, // kUpb_FieldType_SFixed32 |
| 2202 | 3, // kUpb_FieldType_SFixed64 |
| 2203 | 2, // kUpb_FieldType_SInt32 |
| 2204 | 3, // kUpb_FieldType_SInt64 |
| 2205 | }; |
| 2206 | |
| 2207 | // -1 here because the enum is one-based but the table is zero-based. |
| 2208 | return size[field_type - 1]; |
| 2209 | } |
| 2210 | |
| 2211 | #ifdef __cplusplus |
| 2212 | } /* extern "C" */ |
| 2213 | #endif |
| 2214 | |
| 2215 | |
| 2216 | #endif /* UPB_MESSAGE_INTERNAL_SIZE_LOG2_H_ */ |
| 2217 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2218 | // Must be last. |
| 2219 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 2220 | #if defined(__GNUC__) && !defined(__clang__) |
| 2221 | // GCC raises incorrect warnings in these functions. It thinks that we are |
| 2222 | // overrunning buffers, but we carefully write the functions in this file to |
| 2223 | // guarantee that this is impossible. GCC gets this wrong due it its failure |
| 2224 | // to perform constant propagation as we expect: |
| 2225 | // - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108217 |
| 2226 | // - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108226 |
| 2227 | // |
| 2228 | // Unfortunately this also indicates that GCC is not optimizing away the |
| 2229 | // switch() in cases where it should be, compromising the performance. |
| 2230 | #pragma GCC diagnostic push |
| 2231 | #pragma GCC diagnostic ignored "-Warray-bounds" |
| 2232 | #pragma GCC diagnostic ignored "-Wstringop-overflow" |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 2233 | #if __GNUC__ >= 11 |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 2234 | #pragma GCC diagnostic ignored "-Wstringop-overread" |
| 2235 | #endif |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 2236 | #endif |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 2237 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2238 | #ifdef __cplusplus |
| 2239 | extern "C" { |
| 2240 | #endif |
| 2241 | |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 2242 | // LINT.IfChange(presence_logic) |
| 2243 | |
| 2244 | // Hasbit access /////////////////////////////////////////////////////////////// |
| 2245 | |
| 2246 | UPB_INLINE size_t _upb_hasbit_ofs(size_t idx) { return idx / 8; } |
| 2247 | |
| 2248 | UPB_INLINE char _upb_hasbit_mask(size_t idx) { return 1 << (idx % 8); } |
| 2249 | |
| 2250 | UPB_INLINE bool _upb_hasbit(const upb_Message* msg, size_t idx) { |
| 2251 | return (*UPB_PTR_AT(msg, _upb_hasbit_ofs(idx), const char) & |
| 2252 | _upb_hasbit_mask(idx)) != 0; |
| 2253 | } |
| 2254 | |
| 2255 | UPB_INLINE void _upb_sethas(const upb_Message* msg, size_t idx) { |
| 2256 | (*UPB_PTR_AT(msg, _upb_hasbit_ofs(idx), char)) |= _upb_hasbit_mask(idx); |
| 2257 | } |
| 2258 | |
| 2259 | UPB_INLINE void _upb_clearhas(const upb_Message* msg, size_t idx) { |
| 2260 | (*UPB_PTR_AT(msg, _upb_hasbit_ofs(idx), char)) &= ~_upb_hasbit_mask(idx); |
| 2261 | } |
| 2262 | |
| 2263 | UPB_INLINE size_t _upb_Message_Hasidx(const upb_MiniTableField* f) { |
| 2264 | UPB_ASSERT(f->presence > 0); |
| 2265 | return f->presence; |
| 2266 | } |
| 2267 | |
| 2268 | UPB_INLINE bool _upb_hasbit_field(const upb_Message* msg, |
| 2269 | const upb_MiniTableField* f) { |
| 2270 | return _upb_hasbit(msg, _upb_Message_Hasidx(f)); |
| 2271 | } |
| 2272 | |
| 2273 | UPB_INLINE void _upb_sethas_field(const upb_Message* msg, |
| 2274 | const upb_MiniTableField* f) { |
| 2275 | _upb_sethas(msg, _upb_Message_Hasidx(f)); |
| 2276 | } |
| 2277 | |
| 2278 | // Oneof case access /////////////////////////////////////////////////////////// |
| 2279 | |
| 2280 | UPB_INLINE size_t _upb_oneofcase_ofs(const upb_MiniTableField* f) { |
| 2281 | UPB_ASSERT(f->presence < 0); |
| 2282 | return ~(ptrdiff_t)f->presence; |
| 2283 | } |
| 2284 | |
| 2285 | UPB_INLINE uint32_t* _upb_oneofcase_field(upb_Message* msg, |
| 2286 | const upb_MiniTableField* f) { |
| 2287 | return UPB_PTR_AT(msg, _upb_oneofcase_ofs(f), uint32_t); |
| 2288 | } |
| 2289 | |
| 2290 | UPB_INLINE uint32_t _upb_getoneofcase_field(const upb_Message* msg, |
| 2291 | const upb_MiniTableField* f) { |
| 2292 | return *_upb_oneofcase_field((upb_Message*)msg, f); |
| 2293 | } |
| 2294 | |
| 2295 | // LINT.ThenChange(GoogleInternalName2) |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 2296 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2297 | UPB_INLINE bool _upb_MiniTableField_InOneOf(const upb_MiniTableField* field) { |
| 2298 | return field->presence < 0; |
| 2299 | } |
| 2300 | |
| 2301 | UPB_INLINE void* _upb_MiniTableField_GetPtr(upb_Message* msg, |
| 2302 | const upb_MiniTableField* field) { |
| 2303 | return (char*)msg + field->offset; |
| 2304 | } |
| 2305 | |
| 2306 | UPB_INLINE const void* _upb_MiniTableField_GetConstPtr( |
| 2307 | const upb_Message* msg, const upb_MiniTableField* field) { |
| 2308 | return (char*)msg + field->offset; |
| 2309 | } |
| 2310 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2311 | UPB_INLINE void _upb_Message_SetPresence(upb_Message* msg, |
| 2312 | const upb_MiniTableField* field) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2313 | if (field->presence > 0) { |
| 2314 | _upb_sethas_field(msg, field); |
| 2315 | } else if (_upb_MiniTableField_InOneOf(field)) { |
| 2316 | *_upb_oneofcase_field(msg, field) = field->number; |
| 2317 | } |
| 2318 | } |
| 2319 | |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 2320 | UPB_INLINE bool _upb_MiniTable_ValueIsNonZero(const void* default_val, |
| 2321 | const upb_MiniTableField* field) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2322 | char zero[16] = {0}; |
| 2323 | switch (_upb_MiniTableField_GetRep(field)) { |
| 2324 | case kUpb_FieldRep_1Byte: |
| 2325 | return memcmp(&zero, default_val, 1) != 0; |
| 2326 | case kUpb_FieldRep_4Byte: |
| 2327 | return memcmp(&zero, default_val, 4) != 0; |
| 2328 | case kUpb_FieldRep_8Byte: |
| 2329 | return memcmp(&zero, default_val, 8) != 0; |
| 2330 | case kUpb_FieldRep_StringView: { |
| 2331 | const upb_StringView* sv = (const upb_StringView*)default_val; |
| 2332 | return sv->size != 0; |
| 2333 | } |
| 2334 | } |
| 2335 | UPB_UNREACHABLE(); |
| 2336 | } |
| 2337 | |
| 2338 | UPB_INLINE void _upb_MiniTable_CopyFieldData(void* to, const void* from, |
| 2339 | const upb_MiniTableField* field) { |
| 2340 | switch (_upb_MiniTableField_GetRep(field)) { |
| 2341 | case kUpb_FieldRep_1Byte: |
| 2342 | memcpy(to, from, 1); |
| 2343 | return; |
| 2344 | case kUpb_FieldRep_4Byte: |
| 2345 | memcpy(to, from, 4); |
| 2346 | return; |
| 2347 | case kUpb_FieldRep_8Byte: |
| 2348 | memcpy(to, from, 8); |
| 2349 | return; |
| 2350 | case kUpb_FieldRep_StringView: { |
| 2351 | memcpy(to, from, sizeof(upb_StringView)); |
| 2352 | return; |
| 2353 | } |
| 2354 | } |
| 2355 | UPB_UNREACHABLE(); |
| 2356 | } |
| 2357 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 2358 | UPB_INLINE size_t |
| 2359 | _upb_MiniTable_ElementSizeLg2(const upb_MiniTableField* field) { |
Protobuf Team Bot | 7c68721 | 2023-11-14 03:01:42 +0000 | [diff] [blame] | 2360 | return upb_SizeLog2_FieldType( |
| 2361 | (upb_FieldType)field->UPB_PRIVATE(descriptortype)); |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 2362 | } |
| 2363 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2364 | // Here we define universal getter/setter functions for message fields. |
| 2365 | // These look very branchy and inefficient, but as long as the MiniTableField |
| 2366 | // values are known at compile time, all the branches are optimized away and |
| 2367 | // we are left with ideal code. This can happen either through through |
| 2368 | // literals or UPB_ASSUME(): |
| 2369 | // |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 2370 | // // Via struct literals. |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2371 | // bool FooMessage_set_bool_field(const upb_Message* msg, bool val) { |
| 2372 | // const upb_MiniTableField field = {1, 0, 0, /* etc... */}; |
| 2373 | // // All value in "field" are compile-time known. |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2374 | // _upb_Message_SetNonExtensionField(msg, &field, &value); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2375 | // } |
| 2376 | // |
| 2377 | // // Via UPB_ASSUME(). |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2378 | // UPB_INLINE bool upb_Message_SetBool(upb_Message* msg, |
| 2379 | // const upb_MiniTableField* field, |
| 2380 | // bool value, upb_Arena* a) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2381 | // UPB_ASSUME(field->UPB_PRIVATE(descriptortype) == kUpb_FieldType_Bool); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2382 | // UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
| 2383 | // UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_1Byte); |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2384 | // _upb_Message_SetField(msg, field, &value, a); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2385 | // } |
| 2386 | // |
| 2387 | // As a result, we can use these universal getters/setters for *all* message |
| 2388 | // accessors: generated code, MiniTable accessors, and reflection. The only |
| 2389 | // 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] | 2390 | // about how they read/write the message data, for efficiency. |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2391 | // |
| 2392 | // These functions work on both extensions and non-extensions. If the field |
| 2393 | // of a setter is known to be a non-extension, the arena may be NULL and the |
| 2394 | // returned bool value may be ignored since it will always succeed. |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2395 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2396 | UPB_INLINE bool _upb_Message_HasExtensionField( |
| 2397 | const upb_Message* msg, const upb_MiniTableExtension* ext) { |
| 2398 | UPB_ASSERT(upb_MiniTableField_HasPresence(&ext->field)); |
| 2399 | return _upb_Message_Getext(msg, ext) != NULL; |
| 2400 | } |
| 2401 | |
| 2402 | UPB_INLINE bool _upb_Message_HasNonExtensionField( |
| 2403 | const upb_Message* msg, const upb_MiniTableField* field) { |
| 2404 | UPB_ASSERT(upb_MiniTableField_HasPresence(field)); |
| 2405 | UPB_ASSUME(!upb_MiniTableField_IsExtension(field)); |
| 2406 | if (_upb_MiniTableField_InOneOf(field)) { |
| 2407 | return _upb_getoneofcase_field(msg, field) == field->number; |
| 2408 | } else { |
| 2409 | return _upb_hasbit_field(msg, field); |
| 2410 | } |
| 2411 | } |
| 2412 | |
| 2413 | static UPB_FORCEINLINE void _upb_Message_GetNonExtensionField( |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2414 | const upb_Message* msg, const upb_MiniTableField* field, |
| 2415 | const void* default_val, void* val) { |
| 2416 | UPB_ASSUME(!upb_MiniTableField_IsExtension(field)); |
| 2417 | if ((_upb_MiniTableField_InOneOf(field) || |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 2418 | _upb_MiniTable_ValueIsNonZero(default_val, field)) && |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2419 | !_upb_Message_HasNonExtensionField(msg, field)) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2420 | _upb_MiniTable_CopyFieldData(val, default_val, field); |
| 2421 | return; |
| 2422 | } |
| 2423 | _upb_MiniTable_CopyFieldData(val, _upb_MiniTableField_GetConstPtr(msg, field), |
| 2424 | field); |
| 2425 | } |
| 2426 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2427 | UPB_INLINE void _upb_Message_GetExtensionField( |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2428 | const upb_Message* msg, const upb_MiniTableExtension* mt_ext, |
| 2429 | const void* default_val, void* val) { |
| 2430 | UPB_ASSUME(upb_MiniTableField_IsExtension(&mt_ext->field)); |
| 2431 | const upb_Message_Extension* ext = _upb_Message_Getext(msg, mt_ext); |
| 2432 | if (ext) { |
| 2433 | _upb_MiniTable_CopyFieldData(val, &ext->data, &mt_ext->field); |
| 2434 | } else { |
| 2435 | _upb_MiniTable_CopyFieldData(val, default_val, &mt_ext->field); |
| 2436 | } |
| 2437 | } |
| 2438 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2439 | UPB_INLINE void _upb_Message_GetField(const upb_Message* msg, |
| 2440 | const upb_MiniTableField* field, |
| 2441 | const void* default_val, void* val) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2442 | if (upb_MiniTableField_IsExtension(field)) { |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2443 | _upb_Message_GetExtensionField(msg, (upb_MiniTableExtension*)field, |
| 2444 | default_val, val); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2445 | } else { |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2446 | _upb_Message_GetNonExtensionField(msg, field, default_val, val); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2447 | } |
| 2448 | } |
| 2449 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2450 | UPB_INLINE void _upb_Message_SetNonExtensionField( |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2451 | upb_Message* msg, const upb_MiniTableField* field, const void* val) { |
| 2452 | UPB_ASSUME(!upb_MiniTableField_IsExtension(field)); |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2453 | _upb_Message_SetPresence(msg, field); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2454 | _upb_MiniTable_CopyFieldData(_upb_MiniTableField_GetPtr(msg, field), val, |
| 2455 | field); |
| 2456 | } |
| 2457 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2458 | UPB_INLINE bool _upb_Message_SetExtensionField( |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2459 | upb_Message* msg, const upb_MiniTableExtension* mt_ext, const void* val, |
| 2460 | upb_Arena* a) { |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2461 | UPB_ASSERT(a); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2462 | upb_Message_Extension* ext = |
| 2463 | _upb_Message_GetOrCreateExtension(msg, mt_ext, a); |
| 2464 | if (!ext) return false; |
| 2465 | _upb_MiniTable_CopyFieldData(&ext->data, val, &mt_ext->field); |
| 2466 | return true; |
| 2467 | } |
| 2468 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2469 | UPB_INLINE bool _upb_Message_SetField(upb_Message* msg, |
| 2470 | const upb_MiniTableField* field, |
| 2471 | const void* val, upb_Arena* a) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2472 | if (upb_MiniTableField_IsExtension(field)) { |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2473 | const upb_MiniTableExtension* ext = (const upb_MiniTableExtension*)field; |
| 2474 | return _upb_Message_SetExtensionField(msg, ext, val, a); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2475 | } else { |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2476 | _upb_Message_SetNonExtensionField(msg, field, val); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2477 | return true; |
| 2478 | } |
| 2479 | } |
| 2480 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2481 | UPB_INLINE void _upb_Message_ClearExtensionField( |
| 2482 | upb_Message* msg, const upb_MiniTableExtension* ext_l) { |
| 2483 | upb_Message_Internal* in = upb_Message_Getinternal(msg); |
| 2484 | if (!in->internal) return; |
| 2485 | const upb_Message_Extension* base = |
| 2486 | UPB_PTR_AT(in->internal, in->internal->ext_begin, upb_Message_Extension); |
| 2487 | upb_Message_Extension* ext = |
| 2488 | (upb_Message_Extension*)_upb_Message_Getext(msg, ext_l); |
| 2489 | if (ext) { |
| 2490 | *ext = *base; |
| 2491 | in->internal->ext_begin += sizeof(upb_Message_Extension); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 2492 | } |
| 2493 | } |
| 2494 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2495 | UPB_INLINE void _upb_Message_ClearNonExtensionField( |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 2496 | upb_Message* msg, const upb_MiniTableField* field) { |
| 2497 | if (field->presence > 0) { |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 2498 | _upb_clearhas(msg, _upb_Message_Hasidx(field)); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 2499 | } else if (_upb_MiniTableField_InOneOf(field)) { |
| 2500 | uint32_t* oneof_case = _upb_oneofcase_field(msg, field); |
| 2501 | if (*oneof_case != field->number) return; |
| 2502 | *oneof_case = 0; |
| 2503 | } |
| 2504 | const char zeros[16] = {0}; |
| 2505 | _upb_MiniTable_CopyFieldData(_upb_MiniTableField_GetPtr(msg, field), zeros, |
| 2506 | field); |
| 2507 | } |
| 2508 | |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 2509 | UPB_INLINE void _upb_Message_AssertMapIsUntagged( |
| 2510 | const upb_Message* msg, const upb_MiniTableField* field) { |
Adam Cozzette | 7d5592e | 2023-08-23 12:15:26 -0700 | [diff] [blame] | 2511 | UPB_UNUSED(msg); |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 2512 | _upb_MiniTableField_CheckIsMap(field); |
| 2513 | #ifndef NDEBUG |
| 2514 | upb_TaggedMessagePtr default_val = 0; |
| 2515 | upb_TaggedMessagePtr tagged; |
| 2516 | _upb_Message_GetNonExtensionField(msg, field, &default_val, &tagged); |
| 2517 | UPB_ASSERT(!upb_TaggedMessagePtr_IsEmpty(tagged)); |
| 2518 | #endif |
| 2519 | } |
| 2520 | |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 2521 | UPB_INLINE upb_Map* _upb_Message_GetOrCreateMutableMap( |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 2522 | upb_Message* msg, const upb_MiniTableField* field, size_t key_size, |
| 2523 | size_t val_size, upb_Arena* arena) { |
| 2524 | _upb_MiniTableField_CheckIsMap(field); |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 2525 | _upb_Message_AssertMapIsUntagged(msg, field); |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 2526 | upb_Map* map = NULL; |
| 2527 | upb_Map* default_map_value = NULL; |
| 2528 | _upb_Message_GetNonExtensionField(msg, field, &default_map_value, &map); |
| 2529 | if (!map) { |
| 2530 | map = _upb_Map_New(arena, key_size, val_size); |
| 2531 | // Check again due to: https://godbolt.org/z/7WfaoKG1r |
| 2532 | _upb_MiniTableField_CheckIsMap(field); |
| 2533 | _upb_Message_SetNonExtensionField(msg, field, &map); |
| 2534 | } |
| 2535 | return map; |
| 2536 | } |
| 2537 | |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2538 | #ifdef __cplusplus |
| 2539 | } /* extern "C" */ |
| 2540 | #endif |
| 2541 | |
| 2542 | #if defined(__GNUC__) && !defined(__clang__) |
| 2543 | #pragma GCC diagnostic pop |
| 2544 | #endif |
| 2545 | |
| 2546 | |
Sandy Zhang | e3b0943 | 2023-08-07 09:30:02 -0700 | [diff] [blame] | 2547 | #endif // UPB_MESSAGE_INTERNAL_ACCESSORS_H_ |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2548 | |
Protobuf Team Bot | 376ba2f | 2023-09-29 22:17:43 +0000 | [diff] [blame] | 2549 | #ifndef UPB_MESSAGE_INTERNAL_ARRAY_H_ |
| 2550 | #define UPB_MESSAGE_INTERNAL_ARRAY_H_ |
| 2551 | |
| 2552 | #include <string.h> |
| 2553 | |
| 2554 | |
| 2555 | // Must be last. |
| 2556 | |
| 2557 | #ifdef __cplusplus |
| 2558 | extern "C" { |
| 2559 | #endif |
| 2560 | |
| 2561 | // LINT.IfChange(struct_definition) |
| 2562 | // Our internal representation for repeated fields. |
| 2563 | struct upb_Array { |
| 2564 | uintptr_t data; /* Tagged ptr: low 3 bits of ptr are lg2(elem size). */ |
| 2565 | size_t size; /* The number of elements in the array. */ |
| 2566 | size_t capacity; /* Allocated storage. Measured in elements. */ |
| 2567 | }; |
| 2568 | // LINT.ThenChange(GoogleInternalName1) |
| 2569 | |
| 2570 | UPB_INLINE size_t _upb_Array_ElementSizeLg2(const upb_Array* arr) { |
| 2571 | size_t ret = arr->data & 7; |
| 2572 | UPB_ASSERT(ret <= 4); |
| 2573 | return ret; |
| 2574 | } |
| 2575 | |
| 2576 | UPB_INLINE const void* _upb_array_constptr(const upb_Array* arr) { |
| 2577 | _upb_Array_ElementSizeLg2(arr); // Check assertion. |
| 2578 | return (void*)(arr->data & ~(uintptr_t)7); |
| 2579 | } |
| 2580 | |
| 2581 | UPB_INLINE uintptr_t _upb_array_tagptr(void* ptr, int elem_size_lg2) { |
| 2582 | UPB_ASSERT(elem_size_lg2 <= 4); |
| 2583 | return (uintptr_t)ptr | elem_size_lg2; |
| 2584 | } |
| 2585 | |
| 2586 | UPB_INLINE void* _upb_array_ptr(upb_Array* arr) { |
| 2587 | return (void*)_upb_array_constptr(arr); |
| 2588 | } |
| 2589 | |
| 2590 | UPB_INLINE uintptr_t _upb_tag_arrptr(void* ptr, int elem_size_lg2) { |
| 2591 | UPB_ASSERT(elem_size_lg2 <= 4); |
| 2592 | UPB_ASSERT(((uintptr_t)ptr & 7) == 0); |
| 2593 | return (uintptr_t)ptr | (unsigned)elem_size_lg2; |
| 2594 | } |
| 2595 | |
Protobuf Team Bot | 376ba2f | 2023-09-29 22:17:43 +0000 | [diff] [blame] | 2596 | UPB_INLINE upb_Array* _upb_Array_New(upb_Arena* a, size_t init_capacity, |
| 2597 | int elem_size_lg2) { |
| 2598 | UPB_ASSERT(elem_size_lg2 <= 4); |
| 2599 | const size_t arr_size = UPB_ALIGN_UP(sizeof(upb_Array), UPB_MALLOC_ALIGN); |
| 2600 | const size_t bytes = arr_size + (init_capacity << elem_size_lg2); |
| 2601 | upb_Array* arr = (upb_Array*)upb_Arena_Malloc(a, bytes); |
| 2602 | if (!arr) return NULL; |
| 2603 | arr->data = _upb_tag_arrptr(UPB_PTR_AT(arr, arr_size, void), elem_size_lg2); |
| 2604 | arr->size = 0; |
| 2605 | arr->capacity = init_capacity; |
| 2606 | return arr; |
| 2607 | } |
| 2608 | |
| 2609 | // Resizes the capacity of the array to be at least min_size. |
| 2610 | bool _upb_array_realloc(upb_Array* arr, size_t min_size, upb_Arena* arena); |
| 2611 | |
| 2612 | UPB_INLINE bool _upb_array_reserve(upb_Array* arr, size_t size, |
| 2613 | upb_Arena* arena) { |
| 2614 | if (arr->capacity < size) return _upb_array_realloc(arr, size, arena); |
| 2615 | return true; |
| 2616 | } |
| 2617 | |
| 2618 | // Resize without initializing new elements. |
| 2619 | UPB_INLINE bool _upb_Array_ResizeUninitialized(upb_Array* arr, size_t size, |
| 2620 | upb_Arena* arena) { |
| 2621 | UPB_ASSERT(size <= arr->size || arena); // Allow NULL arena when shrinking. |
| 2622 | if (!_upb_array_reserve(arr, size, arena)) return false; |
| 2623 | arr->size = size; |
| 2624 | return true; |
| 2625 | } |
| 2626 | |
| 2627 | // This function is intended for situations where elem_size is compile-time |
| 2628 | // constant or a known expression of the form (1 << lg2), so that the expression |
| 2629 | // i*elem_size does not result in an actual multiplication. |
| 2630 | UPB_INLINE void _upb_Array_Set(upb_Array* arr, size_t i, const void* data, |
| 2631 | size_t elem_size) { |
| 2632 | UPB_ASSERT(i < arr->size); |
| 2633 | UPB_ASSERT(elem_size == 1U << _upb_Array_ElementSizeLg2(arr)); |
| 2634 | char* arr_data = (char*)_upb_array_ptr(arr); |
| 2635 | memcpy(arr_data + (i * elem_size), data, elem_size); |
| 2636 | } |
| 2637 | |
| 2638 | UPB_INLINE void _upb_array_detach(const void* msg, size_t ofs) { |
| 2639 | *UPB_PTR_AT(msg, ofs, upb_Array*) = NULL; |
| 2640 | } |
| 2641 | |
| 2642 | #ifdef __cplusplus |
| 2643 | } /* extern "C" */ |
| 2644 | #endif |
| 2645 | |
| 2646 | |
| 2647 | #endif /* UPB_MESSAGE_INTERNAL_ARRAY_H_ */ |
| 2648 | |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2649 | // Must be last. |
| 2650 | |
| 2651 | #ifdef __cplusplus |
| 2652 | extern "C" { |
| 2653 | #endif |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2654 | |
| 2655 | UPB_API_INLINE void upb_Message_ClearField(upb_Message* msg, |
| 2656 | const upb_MiniTableField* field) { |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 2657 | if (upb_MiniTableField_IsExtension(field)) { |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2658 | const upb_MiniTableExtension* ext = (const upb_MiniTableExtension*)field; |
| 2659 | _upb_Message_ClearExtensionField(msg, ext); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 2660 | } else { |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2661 | _upb_Message_ClearNonExtensionField(msg, field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 2662 | } |
| 2663 | } |
| 2664 | |
Jie Luo | f36a5c6 | 2023-05-23 17:56:18 -0700 | [diff] [blame] | 2665 | UPB_API_INLINE void upb_Message_Clear(upb_Message* msg, |
| 2666 | const upb_MiniTable* l) { |
| 2667 | // Note: Can't use UPB_PTR_AT() here because we are doing pointer subtraction. |
| 2668 | char* mem = (char*)msg - sizeof(upb_Message_Internal); |
| 2669 | memset(mem, 0, upb_msg_sizeof(l)); |
| 2670 | } |
| 2671 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2672 | UPB_API_INLINE bool upb_Message_HasField(const upb_Message* msg, |
| 2673 | const upb_MiniTableField* field) { |
| 2674 | if (upb_MiniTableField_IsExtension(field)) { |
| 2675 | const upb_MiniTableExtension* ext = (const upb_MiniTableExtension*)field; |
| 2676 | return _upb_Message_HasExtensionField(msg, ext); |
| 2677 | } else { |
| 2678 | return _upb_Message_HasNonExtensionField(msg, field); |
| 2679 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 2680 | } |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2681 | |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 2682 | UPB_API_INLINE uint32_t upb_Message_WhichOneofFieldNumber( |
| 2683 | const upb_Message* message, const upb_MiniTableField* oneof_field) { |
| 2684 | UPB_ASSUME(_upb_MiniTableField_InOneOf(oneof_field)); |
| 2685 | return _upb_getoneofcase_field(message, oneof_field); |
| 2686 | } |
| 2687 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2688 | UPB_API_INLINE bool upb_Message_GetBool(const upb_Message* msg, |
| 2689 | const upb_MiniTableField* field, |
| 2690 | bool default_val) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2691 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Bool); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2692 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_1Byte); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2693 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2694 | bool ret; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2695 | _upb_Message_GetField(msg, field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2696 | return ret; |
| 2697 | } |
| 2698 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2699 | UPB_API_INLINE bool upb_Message_SetBool(upb_Message* msg, |
| 2700 | const upb_MiniTableField* field, |
| 2701 | bool value, upb_Arena* a) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2702 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Bool); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2703 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_1Byte); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2704 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2705 | return _upb_Message_SetField(msg, field, &value, a); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2706 | } |
| 2707 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2708 | UPB_API_INLINE int32_t upb_Message_GetInt32(const upb_Message* msg, |
| 2709 | const upb_MiniTableField* field, |
| 2710 | int32_t default_val) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2711 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Int32 || |
| 2712 | upb_MiniTableField_CType(field) == kUpb_CType_Enum); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2713 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2714 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2715 | int32_t ret; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2716 | _upb_Message_GetField(msg, field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2717 | return ret; |
| 2718 | } |
| 2719 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2720 | UPB_API_INLINE bool upb_Message_SetInt32(upb_Message* msg, |
| 2721 | const upb_MiniTableField* field, |
| 2722 | int32_t value, upb_Arena* a) { |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 2723 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Int32 || |
| 2724 | upb_MiniTableField_CType(field) == kUpb_CType_Enum); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2725 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2726 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2727 | return _upb_Message_SetField(msg, field, &value, a); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2728 | } |
| 2729 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2730 | UPB_API_INLINE uint32_t upb_Message_GetUInt32(const upb_Message* msg, |
| 2731 | const upb_MiniTableField* field, |
| 2732 | uint32_t default_val) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2733 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_UInt32); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2734 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2735 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2736 | uint32_t ret; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2737 | _upb_Message_GetField(msg, field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2738 | return ret; |
| 2739 | } |
| 2740 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2741 | UPB_API_INLINE bool upb_Message_SetUInt32(upb_Message* msg, |
| 2742 | const upb_MiniTableField* field, |
| 2743 | uint32_t value, upb_Arena* a) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2744 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_UInt32); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2745 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2746 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2747 | return _upb_Message_SetField(msg, field, &value, a); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2748 | } |
| 2749 | |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 2750 | UPB_API_INLINE void upb_Message_SetClosedEnum( |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 2751 | upb_Message* msg, const upb_MiniTable* msg_mini_table, |
| 2752 | const upb_MiniTableField* field, int32_t value) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2753 | UPB_ASSERT(upb_MiniTableField_IsClosedEnum(field)); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2754 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2755 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2756 | UPB_ASSERT(upb_MiniTableEnum_CheckValue( |
| 2757 | upb_MiniTable_GetSubEnumTable(msg_mini_table, field), value)); |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2758 | _upb_Message_SetNonExtensionField(msg, field, &value); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2759 | } |
| 2760 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2761 | UPB_API_INLINE int64_t upb_Message_GetInt64(const upb_Message* msg, |
| 2762 | const upb_MiniTableField* field, |
| 2763 | uint64_t default_val) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2764 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Int64); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2765 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_8Byte); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2766 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2767 | int64_t ret; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2768 | _upb_Message_GetField(msg, field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2769 | return ret; |
| 2770 | } |
| 2771 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2772 | UPB_API_INLINE bool upb_Message_SetInt64(upb_Message* msg, |
| 2773 | const upb_MiniTableField* field, |
| 2774 | int64_t value, upb_Arena* a) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2775 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Int64); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2776 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_8Byte); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2777 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2778 | return _upb_Message_SetField(msg, field, &value, a); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2779 | } |
| 2780 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2781 | UPB_API_INLINE uint64_t upb_Message_GetUInt64(const upb_Message* msg, |
| 2782 | const upb_MiniTableField* field, |
| 2783 | uint64_t default_val) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2784 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_UInt64); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2785 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_8Byte); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2786 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2787 | uint64_t ret; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2788 | _upb_Message_GetField(msg, field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2789 | return ret; |
| 2790 | } |
| 2791 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2792 | UPB_API_INLINE bool upb_Message_SetUInt64(upb_Message* msg, |
| 2793 | const upb_MiniTableField* field, |
| 2794 | uint64_t value, upb_Arena* a) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2795 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_UInt64); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2796 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_8Byte); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2797 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2798 | return _upb_Message_SetField(msg, field, &value, a); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2799 | } |
| 2800 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2801 | UPB_API_INLINE float upb_Message_GetFloat(const upb_Message* msg, |
| 2802 | const upb_MiniTableField* field, |
| 2803 | float default_val) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2804 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Float); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2805 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2806 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2807 | float ret; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2808 | _upb_Message_GetField(msg, field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2809 | return ret; |
| 2810 | } |
| 2811 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2812 | UPB_API_INLINE bool upb_Message_SetFloat(upb_Message* msg, |
| 2813 | const upb_MiniTableField* field, |
| 2814 | float value, upb_Arena* a) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2815 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Float); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2816 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2817 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2818 | return _upb_Message_SetField(msg, field, &value, a); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2819 | } |
| 2820 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2821 | UPB_API_INLINE double upb_Message_GetDouble(const upb_Message* msg, |
| 2822 | const upb_MiniTableField* field, |
| 2823 | double default_val) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2824 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Double); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2825 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_8Byte); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2826 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2827 | double ret; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2828 | _upb_Message_GetField(msg, field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2829 | return ret; |
| 2830 | } |
| 2831 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2832 | UPB_API_INLINE bool upb_Message_SetDouble(upb_Message* msg, |
| 2833 | const upb_MiniTableField* field, |
| 2834 | double value, upb_Arena* a) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2835 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Double); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2836 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_8Byte); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2837 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2838 | return _upb_Message_SetField(msg, field, &value, a); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2839 | } |
| 2840 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 2841 | UPB_API_INLINE upb_StringView |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2842 | upb_Message_GetString(const upb_Message* msg, const upb_MiniTableField* field, |
| 2843 | upb_StringView def_val) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2844 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_String || |
| 2845 | upb_MiniTableField_CType(field) == kUpb_CType_Bytes); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2846 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_StringView); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2847 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2848 | upb_StringView ret; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2849 | _upb_Message_GetField(msg, field, &def_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2850 | return ret; |
| 2851 | } |
| 2852 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2853 | UPB_API_INLINE bool upb_Message_SetString(upb_Message* msg, |
| 2854 | const upb_MiniTableField* field, |
| 2855 | upb_StringView value, upb_Arena* a) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2856 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_String || |
| 2857 | upb_MiniTableField_CType(field) == kUpb_CType_Bytes); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2858 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_StringView); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2859 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2860 | return _upb_Message_SetField(msg, field, &value, a); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2861 | } |
| 2862 | |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 2863 | UPB_API_INLINE upb_TaggedMessagePtr upb_Message_GetTaggedMessagePtr( |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2864 | const upb_Message* msg, const upb_MiniTableField* field, |
| 2865 | upb_Message* default_val) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2866 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Message); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2867 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == |
| 2868 | UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte)); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2869 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 2870 | upb_TaggedMessagePtr tagged; |
| 2871 | _upb_Message_GetNonExtensionField(msg, field, &default_val, &tagged); |
| 2872 | return tagged; |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2873 | } |
| 2874 | |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 2875 | UPB_API_INLINE const upb_Message* upb_Message_GetMessage( |
| 2876 | const upb_Message* msg, const upb_MiniTableField* field, |
| 2877 | upb_Message* default_val) { |
| 2878 | upb_TaggedMessagePtr tagged = |
| 2879 | upb_Message_GetTaggedMessagePtr(msg, field, default_val); |
| 2880 | return upb_TaggedMessagePtr_GetNonEmptyMessage(tagged); |
| 2881 | } |
| 2882 | |
| 2883 | // For internal use only; users cannot set tagged messages because only the |
| 2884 | // parser and the message copier are allowed to directly create an empty |
| 2885 | // message. |
| 2886 | UPB_API_INLINE void _upb_Message_SetTaggedMessagePtr( |
| 2887 | upb_Message* msg, const upb_MiniTable* mini_table, |
| 2888 | const upb_MiniTableField* field, upb_TaggedMessagePtr sub_message) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2889 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Message); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2890 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == |
| 2891 | UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte)); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2892 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 2893 | UPB_ASSERT(mini_table->subs[field->UPB_PRIVATE(submsg_index)].submsg); |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2894 | _upb_Message_SetNonExtensionField(msg, field, &sub_message); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2895 | } |
| 2896 | |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 2897 | UPB_API_INLINE void upb_Message_SetMessage(upb_Message* msg, |
| 2898 | const upb_MiniTable* mini_table, |
| 2899 | const upb_MiniTableField* field, |
| 2900 | upb_Message* sub_message) { |
| 2901 | _upb_Message_SetTaggedMessagePtr( |
| 2902 | msg, mini_table, field, _upb_TaggedMessagePtr_Pack(sub_message, false)); |
| 2903 | } |
| 2904 | |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 2905 | UPB_API_INLINE upb_Message* upb_Message_GetOrCreateMutableMessage( |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2906 | upb_Message* msg, const upb_MiniTable* mini_table, |
| 2907 | const upb_MiniTableField* field, upb_Arena* arena) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2908 | UPB_ASSERT(arena); |
| 2909 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Message); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2910 | upb_Message* sub_message = *UPB_PTR_AT(msg, field->offset, upb_Message*); |
| 2911 | if (!sub_message) { |
| 2912 | const upb_MiniTable* sub_mini_table = |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 2913 | mini_table->subs[field->UPB_PRIVATE(submsg_index)].submsg; |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2914 | UPB_ASSERT(sub_mini_table); |
| 2915 | sub_message = _upb_Message_New(sub_mini_table, arena); |
| 2916 | *UPB_PTR_AT(msg, field->offset, upb_Message*) = sub_message; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2917 | _upb_Message_SetPresence(msg, field); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2918 | } |
| 2919 | return sub_message; |
| 2920 | } |
| 2921 | |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 2922 | UPB_API_INLINE const upb_Array* upb_Message_GetArray( |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2923 | const upb_Message* msg, const upb_MiniTableField* field) { |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 2924 | _upb_MiniTableField_CheckIsArray(field); |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 2925 | upb_Array* ret; |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2926 | const upb_Array* default_val = NULL; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2927 | _upb_Message_GetNonExtensionField(msg, field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2928 | return ret; |
| 2929 | } |
| 2930 | |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 2931 | UPB_API_INLINE upb_Array* upb_Message_GetMutableArray( |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2932 | upb_Message* msg, const upb_MiniTableField* field) { |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 2933 | _upb_MiniTableField_CheckIsArray(field); |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 2934 | return (upb_Array*)upb_Message_GetArray(msg, field); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2935 | } |
| 2936 | |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 2937 | UPB_API_INLINE upb_Array* upb_Message_GetOrCreateMutableArray( |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 2938 | upb_Message* msg, const upb_MiniTableField* field, upb_Arena* arena) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2939 | UPB_ASSERT(arena); |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 2940 | _upb_MiniTableField_CheckIsArray(field); |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 2941 | upb_Array* array = upb_Message_GetMutableArray(msg, field); |
| 2942 | if (!array) { |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 2943 | array = _upb_Array_New(arena, 4, _upb_MiniTable_ElementSizeLg2(field)); |
| 2944 | // Check again due to: https://godbolt.org/z/7WfaoKG1r |
| 2945 | _upb_MiniTableField_CheckIsArray(field); |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 2946 | _upb_Message_SetField(msg, field, &array, arena); |
| 2947 | } |
| 2948 | return array; |
| 2949 | } |
| 2950 | |
Jie Luo | f36a5c6 | 2023-05-23 17:56:18 -0700 | [diff] [blame] | 2951 | UPB_API_INLINE void* upb_Message_ResizeArrayUninitialized( |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 2952 | upb_Message* msg, const upb_MiniTableField* field, size_t size, |
| 2953 | upb_Arena* arena) { |
| 2954 | _upb_MiniTableField_CheckIsArray(field); |
| 2955 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, field, arena); |
| 2956 | if (!arr || !_upb_Array_ResizeUninitialized(arr, size, arena)) return NULL; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 2957 | return _upb_array_ptr(arr); |
| 2958 | } |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2959 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 2960 | UPB_API_INLINE const upb_Map* upb_Message_GetMap( |
| 2961 | const upb_Message* msg, const upb_MiniTableField* field) { |
| 2962 | _upb_MiniTableField_CheckIsMap(field); |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 2963 | _upb_Message_AssertMapIsUntagged(msg, field); |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 2964 | upb_Map* ret; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 2965 | const upb_Map* default_val = NULL; |
| 2966 | _upb_Message_GetNonExtensionField(msg, field, &default_val, &ret); |
| 2967 | return ret; |
| 2968 | } |
| 2969 | |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 2970 | UPB_API_INLINE upb_Map* upb_Message_GetMutableMap( |
| 2971 | upb_Message* msg, const upb_MiniTableField* field) { |
| 2972 | return (upb_Map*)upb_Message_GetMap(msg, field); |
| 2973 | } |
| 2974 | |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 2975 | UPB_API_INLINE upb_Map* upb_Message_GetOrCreateMutableMap( |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 2976 | upb_Message* msg, const upb_MiniTable* map_entry_mini_table, |
| 2977 | const upb_MiniTableField* field, upb_Arena* arena) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2978 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Message); |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 2979 | const upb_MiniTableField* map_entry_key_field = |
| 2980 | &map_entry_mini_table->fields[0]; |
| 2981 | const upb_MiniTableField* map_entry_value_field = |
| 2982 | &map_entry_mini_table->fields[1]; |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 2983 | return _upb_Message_GetOrCreateMutableMap( |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 2984 | msg, field, |
| 2985 | _upb_Map_CTypeSize(upb_MiniTableField_CType(map_entry_key_field)), |
| 2986 | _upb_Map_CTypeSize(upb_MiniTableField_CType(map_entry_value_field)), |
| 2987 | arena); |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 2988 | } |
| 2989 | |
| 2990 | // Updates a map entry given an entry message. |
| 2991 | upb_MapInsertStatus upb_Message_InsertMapEntry(upb_Map* map, |
| 2992 | const upb_MiniTable* mini_table, |
| 2993 | const upb_MiniTableField* field, |
| 2994 | upb_Message* map_entry_message, |
| 2995 | upb_Arena* arena); |
| 2996 | |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 2997 | // Compares two messages by serializing them and calling memcmp(). |
| 2998 | bool upb_Message_IsExactlyEqual(const upb_Message* m1, const upb_Message* m2, |
| 2999 | const upb_MiniTable* layout); |
| 3000 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 3001 | #ifdef __cplusplus |
| 3002 | } /* extern "C" */ |
| 3003 | #endif |
| 3004 | |
| 3005 | |
| 3006 | #endif // UPB_MESSAGE_ACCESSORS_H_ |
| 3007 | |
Protobuf Team Bot | 376ba2f | 2023-09-29 22:17:43 +0000 | [diff] [blame] | 3008 | // These functions are only used by generated code. |
| 3009 | |
| 3010 | #ifndef UPB_MESSAGE_MAP_GENCODE_UTIL_H_ |
| 3011 | #define UPB_MESSAGE_MAP_GENCODE_UTIL_H_ |
| 3012 | |
| 3013 | |
| 3014 | // Must be last. |
| 3015 | |
| 3016 | #ifdef __cplusplus |
| 3017 | extern "C" { |
| 3018 | #endif |
| 3019 | |
| 3020 | // Message map operations, these get the map from the message first. |
| 3021 | |
| 3022 | UPB_INLINE void _upb_msg_map_key(const void* msg, void* key, size_t size) { |
| 3023 | const upb_tabent* ent = (const upb_tabent*)msg; |
| 3024 | uint32_t u32len; |
| 3025 | upb_StringView k; |
| 3026 | k.data = upb_tabstr(ent->key, &u32len); |
| 3027 | k.size = u32len; |
| 3028 | _upb_map_fromkey(k, key, size); |
| 3029 | } |
| 3030 | |
| 3031 | UPB_INLINE void _upb_msg_map_value(const void* msg, void* val, size_t size) { |
| 3032 | const upb_tabent* ent = (const upb_tabent*)msg; |
| 3033 | upb_value v = {ent->val.val}; |
| 3034 | _upb_map_fromvalue(v, val, size); |
| 3035 | } |
| 3036 | |
| 3037 | UPB_INLINE void _upb_msg_map_set_value(void* msg, const void* val, |
| 3038 | size_t size) { |
| 3039 | upb_tabent* ent = (upb_tabent*)msg; |
| 3040 | // This is like _upb_map_tovalue() except the entry already exists |
| 3041 | // so we can reuse the allocated upb_StringView for string fields. |
| 3042 | if (size == UPB_MAPTYPE_STRING) { |
| 3043 | upb_StringView* strp = (upb_StringView*)(uintptr_t)ent->val.val; |
| 3044 | memcpy(strp, val, sizeof(*strp)); |
| 3045 | } else { |
| 3046 | memcpy(&ent->val.val, val, size); |
| 3047 | } |
| 3048 | } |
| 3049 | |
| 3050 | #ifdef __cplusplus |
| 3051 | } /* extern "C" */ |
| 3052 | #endif |
| 3053 | |
| 3054 | |
| 3055 | #endif /* UPB_MESSAGE_MAP_GENCODE_UTIL_H_ */ |
| 3056 | |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 3057 | #ifndef UPB_MINI_TABLE_DECODE_H_ |
| 3058 | #define UPB_MINI_TABLE_DECODE_H_ |
| 3059 | |
| 3060 | |
| 3061 | #ifndef UPB_MINI_TABLE_SUB_H_ |
| 3062 | #define UPB_MINI_TABLE_SUB_H_ |
| 3063 | |
| 3064 | |
| 3065 | typedef union upb_MiniTableSub upb_MiniTableSub; |
| 3066 | |
| 3067 | #endif /* UPB_MINI_TABLE_INTERNAL_SUB_H_ */ |
| 3068 | |
| 3069 | // Export the newer headers, for legacy users. New users should include the |
| 3070 | // more specific headers directly. |
| 3071 | // IWYU pragma: begin_exports |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 3072 | #ifndef UPB_MINI_DESCRIPTOR_BUILD_ENUM_H_ |
| 3073 | #define UPB_MINI_DESCRIPTOR_BUILD_ENUM_H_ |
| 3074 | |
| 3075 | |
| 3076 | // Must be last. |
| 3077 | |
| 3078 | #ifdef __cplusplus |
| 3079 | extern "C" { |
| 3080 | #endif |
| 3081 | |
| 3082 | // Builds a upb_MiniTableEnum from an enum MiniDescriptor. The MiniDescriptor |
| 3083 | // must be for an enum, not a message. |
| 3084 | UPB_API upb_MiniTableEnum* upb_MiniDescriptor_BuildEnum(const char* data, |
| 3085 | size_t len, |
| 3086 | upb_Arena* arena, |
| 3087 | upb_Status* status); |
| 3088 | |
Protobuf Team Bot | 986cbb6 | 2023-09-19 15:03:51 +0000 | [diff] [blame] | 3089 | // TODO: Deprecated name; update callers. |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 3090 | UPB_API_INLINE upb_MiniTableEnum* upb_MiniTableEnum_Build(const char* data, |
| 3091 | size_t len, |
| 3092 | upb_Arena* arena, |
| 3093 | upb_Status* status) { |
| 3094 | return upb_MiniDescriptor_BuildEnum(data, len, arena, status); |
| 3095 | } |
| 3096 | |
| 3097 | #ifdef __cplusplus |
| 3098 | } /* extern "C" */ |
| 3099 | #endif |
| 3100 | |
| 3101 | |
| 3102 | #endif // UPB_MINI_DESCRIPTOR_BUILD_ENUM_H_ |
| 3103 | |
| 3104 | // Functions for linking MiniTables together once they are built from a |
| 3105 | // MiniDescriptor. |
| 3106 | // |
| 3107 | // These functions have names like upb_MiniTable_Link() because they operate on |
| 3108 | // MiniTables. We put them here, rather than in the mini_table/ directory, |
| 3109 | // because they are only needed when building MiniTables from MiniDescriptors. |
| 3110 | // The interfaces in mini_table/ assume that MiniTables are immutable. |
| 3111 | |
| 3112 | #ifndef UPB_MINI_DESCRIPTOR_LINK_H_ |
| 3113 | #define UPB_MINI_DESCRIPTOR_LINK_H_ |
| 3114 | |
| 3115 | |
| 3116 | // Must be last. |
| 3117 | |
| 3118 | #ifdef __cplusplus |
| 3119 | extern "C" { |
| 3120 | #endif |
| 3121 | |
| 3122 | // Links a sub-message field to a MiniTable for that sub-message. If a |
| 3123 | // sub-message field is not linked, it will be treated as an unknown field |
| 3124 | // during parsing, and setting the field will not be allowed. It is possible |
| 3125 | // to link the message field later, at which point it will no longer be treated |
| 3126 | // as unknown. However there is no synchronization for this operation, which |
| 3127 | // means parallel mutation requires external synchronization. |
| 3128 | // Returns success/failure. |
| 3129 | UPB_API bool upb_MiniTable_SetSubMessage(upb_MiniTable* table, |
| 3130 | upb_MiniTableField* field, |
| 3131 | const upb_MiniTable* sub); |
| 3132 | |
| 3133 | // Links an enum field to a MiniTable for that enum. |
| 3134 | // All enum fields must be linked prior to parsing. |
| 3135 | // Returns success/failure. |
| 3136 | UPB_API bool upb_MiniTable_SetSubEnum(upb_MiniTable* table, |
| 3137 | upb_MiniTableField* field, |
| 3138 | const upb_MiniTableEnum* sub); |
| 3139 | |
| 3140 | // Returns a list of fields that require linking at runtime, to connect the |
| 3141 | // MiniTable to its sub-messages and sub-enums. The list of fields will be |
| 3142 | // written to the `subs` array, which must have been allocated by the caller |
| 3143 | // and must be large enough to hold a list of all fields in the message. |
| 3144 | // |
| 3145 | // The order of the fields returned by this function is significant: it matches |
| 3146 | // the order expected by upb_MiniTable_Link() below. |
| 3147 | // |
| 3148 | // The return value packs the sub-message count and sub-enum count into a single |
| 3149 | // integer like so: |
| 3150 | // return (msg_count << 16) | enum_count; |
| 3151 | UPB_API uint32_t upb_MiniTable_GetSubList(const upb_MiniTable* mt, |
| 3152 | const upb_MiniTableField** subs); |
| 3153 | |
| 3154 | // Links a message to its sub-messages and sub-enums. The caller must pass |
| 3155 | // arrays of sub-tables and sub-enums, in the same length and order as is |
| 3156 | // returned by upb_MiniTable_GetSubList() above. However, individual elements |
| 3157 | // of the sub_tables may be NULL if those sub-messages were tree shaken. |
| 3158 | // |
| 3159 | // Returns false if either array is too short, or if any of the tables fails |
| 3160 | // to link. |
| 3161 | UPB_API bool upb_MiniTable_Link(upb_MiniTable* mt, |
| 3162 | const upb_MiniTable** sub_tables, |
| 3163 | size_t sub_table_count, |
| 3164 | const upb_MiniTableEnum** sub_enums, |
| 3165 | size_t sub_enum_count); |
| 3166 | |
| 3167 | #ifdef __cplusplus |
| 3168 | } /* extern "C" */ |
| 3169 | #endif |
| 3170 | |
| 3171 | |
| 3172 | #endif // UPB_MINI_DESCRIPTOR_LINK_H_ |
| 3173 | // IWYU pragma: end_exports |
| 3174 | |
| 3175 | // Must be last. |
| 3176 | |
| 3177 | typedef enum { |
| 3178 | kUpb_MiniTablePlatform_32Bit, |
| 3179 | kUpb_MiniTablePlatform_64Bit, |
| 3180 | kUpb_MiniTablePlatform_Native = |
| 3181 | UPB_SIZE(kUpb_MiniTablePlatform_32Bit, kUpb_MiniTablePlatform_64Bit), |
| 3182 | } upb_MiniTablePlatform; |
| 3183 | |
| 3184 | #ifdef __cplusplus |
| 3185 | extern "C" { |
| 3186 | #endif |
| 3187 | |
| 3188 | // Builds a mini table from the data encoded in the buffer [data, len]. If any |
| 3189 | // errors occur, returns NULL and sets a status message. In the success case, |
| 3190 | // the caller must call upb_MiniTable_SetSub*() for all message or proto2 enum |
| 3191 | // fields to link the table to the appropriate sub-tables. |
| 3192 | upb_MiniTable* _upb_MiniTable_Build(const char* data, size_t len, |
| 3193 | upb_MiniTablePlatform platform, |
| 3194 | upb_Arena* arena, upb_Status* status); |
| 3195 | |
| 3196 | UPB_API_INLINE upb_MiniTable* upb_MiniTable_Build(const char* data, size_t len, |
| 3197 | upb_Arena* arena, |
| 3198 | upb_Status* status) { |
| 3199 | return _upb_MiniTable_Build(data, len, kUpb_MiniTablePlatform_Native, arena, |
| 3200 | status); |
| 3201 | } |
| 3202 | |
| 3203 | // Initializes a MiniTableExtension buffer that has already been allocated. |
| 3204 | // This is needed by upb_FileDef and upb_MessageDef, which allocate all of the |
| 3205 | // extensions together in a single contiguous array. |
| 3206 | const char* _upb_MiniTableExtension_Init(const char* data, size_t len, |
| 3207 | upb_MiniTableExtension* ext, |
| 3208 | const upb_MiniTable* extendee, |
| 3209 | upb_MiniTableSub sub, |
| 3210 | upb_MiniTablePlatform platform, |
| 3211 | upb_Status* status); |
| 3212 | |
| 3213 | UPB_API_INLINE const char* upb_MiniTableExtension_Init( |
| 3214 | const char* data, size_t len, upb_MiniTableExtension* ext, |
| 3215 | const upb_MiniTable* extendee, upb_MiniTableSub sub, upb_Status* status) { |
| 3216 | return _upb_MiniTableExtension_Init(data, len, ext, extendee, sub, |
| 3217 | kUpb_MiniTablePlatform_Native, status); |
| 3218 | } |
| 3219 | |
| 3220 | UPB_API upb_MiniTableExtension* _upb_MiniTableExtension_Build( |
| 3221 | const char* data, size_t len, const upb_MiniTable* extendee, |
| 3222 | upb_MiniTableSub sub, upb_MiniTablePlatform platform, upb_Arena* arena, |
| 3223 | upb_Status* status); |
| 3224 | |
| 3225 | UPB_API_INLINE upb_MiniTableExtension* upb_MiniTableExtension_Build( |
| 3226 | const char* data, size_t len, const upb_MiniTable* extendee, |
| 3227 | upb_Arena* arena, upb_Status* status) { |
| 3228 | upb_MiniTableSub sub; |
| 3229 | sub.submsg = NULL; |
| 3230 | return _upb_MiniTableExtension_Build( |
| 3231 | data, len, extendee, sub, kUpb_MiniTablePlatform_Native, arena, status); |
| 3232 | } |
| 3233 | |
| 3234 | UPB_API_INLINE upb_MiniTableExtension* upb_MiniTableExtension_BuildMessage( |
| 3235 | const char* data, size_t len, const upb_MiniTable* extendee, |
| 3236 | upb_MiniTable* submsg, upb_Arena* arena, upb_Status* status) { |
| 3237 | upb_MiniTableSub sub; |
| 3238 | sub.submsg = submsg; |
| 3239 | return _upb_MiniTableExtension_Build( |
| 3240 | data, len, extendee, sub, kUpb_MiniTablePlatform_Native, arena, status); |
| 3241 | } |
| 3242 | |
| 3243 | UPB_API_INLINE upb_MiniTableExtension* upb_MiniTableExtension_BuildEnum( |
| 3244 | const char* data, size_t len, const upb_MiniTable* extendee, |
| 3245 | upb_MiniTableEnum* subenum, upb_Arena* arena, upb_Status* status) { |
| 3246 | upb_MiniTableSub sub; |
| 3247 | sub.subenum = subenum; |
| 3248 | return _upb_MiniTableExtension_Build( |
| 3249 | data, len, extendee, sub, kUpb_MiniTablePlatform_Native, arena, status); |
| 3250 | } |
| 3251 | |
| 3252 | // Like upb_MiniTable_Build(), but the user provides a buffer of layout data so |
| 3253 | // it can be reused from call to call, avoiding repeated realloc()/free(). |
| 3254 | // |
| 3255 | // The caller owns `*buf` both before and after the call, and must free() it |
| 3256 | // when it is no longer in use. The function will realloc() `*buf` as |
| 3257 | // necessary, updating `*size` accordingly. |
| 3258 | upb_MiniTable* upb_MiniTable_BuildWithBuf(const char* data, size_t len, |
| 3259 | upb_MiniTablePlatform platform, |
| 3260 | upb_Arena* arena, void** buf, |
| 3261 | size_t* buf_size, upb_Status* status); |
| 3262 | |
| 3263 | #ifdef __cplusplus |
| 3264 | } /* extern "C" */ |
| 3265 | #endif |
| 3266 | |
| 3267 | |
| 3268 | #endif /* UPB_MINI_TABLE_DECODE_H_ */ |
| 3269 | |
| 3270 | #ifndef UPB_MINI_TABLE_FILE_H_ |
| 3271 | #define UPB_MINI_TABLE_FILE_H_ |
| 3272 | |
| 3273 | |
| 3274 | #ifndef UPB_MINI_TABLE_INTERNAL_FILE_H_ |
| 3275 | #define UPB_MINI_TABLE_INTERNAL_FILE_H_ |
| 3276 | |
| 3277 | |
| 3278 | // Must be last. |
| 3279 | |
| 3280 | struct upb_MiniTableFile { |
Sandy Zhang | e3b0943 | 2023-08-07 09:30:02 -0700 | [diff] [blame] | 3281 | const struct upb_MiniTable** msgs; |
| 3282 | const struct upb_MiniTableEnum** enums; |
| 3283 | const struct upb_MiniTableExtension** exts; |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 3284 | int msg_count; |
| 3285 | int enum_count; |
| 3286 | int ext_count; |
| 3287 | }; |
| 3288 | |
| 3289 | |
| 3290 | #endif /* UPB_MINI_TABLE_INTERNAL_FILE_H_ */ |
| 3291 | |
| 3292 | typedef struct upb_MiniTableFile upb_MiniTableFile; |
| 3293 | |
| 3294 | #endif /* UPB_MINI_TABLE_FILE_H_ */ |
| 3295 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 3296 | // upb_decode: parsing into a upb_Message using a upb_MiniTable. |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3297 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 3298 | #ifndef UPB_WIRE_DECODE_H_ |
| 3299 | #define UPB_WIRE_DECODE_H_ |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3300 | |
Protobuf Team Bot | 743bf92 | 2023-09-14 01:12:11 +0000 | [diff] [blame] | 3301 | #include <stddef.h> |
| 3302 | #include <stdint.h> |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3303 | |
Adam Cozzette | 7d5592e | 2023-08-23 12:15:26 -0700 | [diff] [blame] | 3304 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3305 | // Must be last. |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3306 | |
| 3307 | #ifdef __cplusplus |
| 3308 | extern "C" { |
| 3309 | #endif |
| 3310 | |
| 3311 | enum { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3312 | /* If set, strings will alias the input buffer instead of copying into the |
| 3313 | * arena. */ |
| 3314 | kUpb_DecodeOption_AliasString = 1, |
| 3315 | |
| 3316 | /* If set, the parse will return failure if any message is missing any |
| 3317 | * required fields when the message data ends. The parse will still continue, |
| 3318 | * and the failure will only be reported at the end. |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3319 | * |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3320 | * IMPORTANT CAVEATS: |
| 3321 | * |
| 3322 | * 1. This can throw a false positive failure if an incomplete message is seen |
| 3323 | * on the wire but is later completed when the sub-message occurs again. |
| 3324 | * For this reason, a second pass is required to verify a failure, to be |
| 3325 | * truly robust. |
| 3326 | * |
| 3327 | * 2. This can return a false success if you are decoding into a message that |
| 3328 | * already has some sub-message fields present. If the sub-message does |
| 3329 | * not occur in the binary payload, we will never visit it and discover the |
| 3330 | * incomplete sub-message. For this reason, this check is only useful for |
| 3331 | * implemting ParseFromString() semantics. For MergeFromString(), a |
| 3332 | * post-parse validation step will always be necessary. */ |
| 3333 | kUpb_DecodeOption_CheckRequired = 2, |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 3334 | |
| 3335 | /* EXPERIMENTAL: |
| 3336 | * |
| 3337 | * If set, the parser will allow parsing of sub-message fields that were not |
| 3338 | * previously linked using upb_MiniTable_SetSubMessage(). The data will be |
| 3339 | * parsed into an internal "empty" message type that cannot be accessed |
| 3340 | * directly, but can be later promoted into the true message type if the |
| 3341 | * sub-message fields are linked at a later time. |
| 3342 | * |
| 3343 | * Users should set this option if they intend to perform dynamic tree shaking |
| 3344 | * and promoting using the interfaces in message/promote.h. If this option is |
| 3345 | * enabled, it is important that the resulting messages are only accessed by |
| 3346 | * code that is aware of promotion rules: |
| 3347 | * |
| 3348 | * 1. Message pointers in upb_Message, upb_Array, and upb_Map are represented |
| 3349 | * by a tagged pointer upb_TaggedMessagePointer. The tag indicates whether |
| 3350 | * the message uses the internal "empty" type. |
| 3351 | * |
| 3352 | * 2. Any code *reading* these message pointers must test whether the "empty" |
| 3353 | * tag bit is set, using the interfaces in mini_table/types.h. However |
| 3354 | * writing of message pointers should always use plain upb_Message*, since |
| 3355 | * users are not allowed to create "empty" messages. |
| 3356 | * |
| 3357 | * 3. It is always safe to test whether a field is present or test the array |
| 3358 | * length; these interfaces will reflect that empty messages are present, |
| 3359 | * even though their data cannot be accessed without promoting first. |
| 3360 | * |
| 3361 | * 4. If a message pointer is indeed tagged as empty, the message may not be |
| 3362 | * accessed directly, only promoted through the interfaces in |
| 3363 | * message/promote.h. |
| 3364 | * |
| 3365 | * 5. Tagged/empty messages may never be created by the user. They may only |
| 3366 | * be created by the parser or the message-copying logic in message/copy.h. |
| 3367 | */ |
| 3368 | kUpb_DecodeOption_ExperimentalAllowUnlinked = 4, |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3369 | }; |
| 3370 | |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 3371 | UPB_INLINE uint32_t upb_DecodeOptions_MaxDepth(uint16_t depth) { |
| 3372 | return (uint32_t)depth << 16; |
| 3373 | } |
| 3374 | |
| 3375 | UPB_INLINE uint16_t upb_DecodeOptions_GetMaxDepth(uint32_t options) { |
| 3376 | return options >> 16; |
| 3377 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3378 | |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 3379 | // Enforce an upper bound on recursion depth. |
| 3380 | 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] | 3381 | uint32_t max_depth = upb_DecodeOptions_GetMaxDepth(decode_options); |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 3382 | if (max_depth > limit) max_depth = limit; |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 3383 | return upb_DecodeOptions_MaxDepth(max_depth) | (decode_options & 0xffff); |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 3384 | } |
| 3385 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3386 | typedef enum { |
| 3387 | kUpb_DecodeStatus_Ok = 0, |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 3388 | kUpb_DecodeStatus_Malformed = 1, // Wire format was corrupt |
| 3389 | kUpb_DecodeStatus_OutOfMemory = 2, // Arena alloc failed |
| 3390 | kUpb_DecodeStatus_BadUtf8 = 3, // String field had bad UTF-8 |
| 3391 | kUpb_DecodeStatus_MaxDepthExceeded = |
| 3392 | 4, // Exceeded upb_DecodeOptions_MaxDepth |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3393 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3394 | // kUpb_DecodeOption_CheckRequired failed (see above), but the parse otherwise |
| 3395 | // succeeded. |
| 3396 | kUpb_DecodeStatus_MissingRequired = 5, |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 3397 | |
| 3398 | // Unlinked sub-message field was present, but |
| 3399 | // kUpb_DecodeOptions_ExperimentalAllowUnlinked was not specified in the list |
| 3400 | // of options. |
| 3401 | kUpb_DecodeStatus_UnlinkedSubMessage = 6, |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3402 | } upb_DecodeStatus; |
| 3403 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 3404 | UPB_API upb_DecodeStatus upb_Decode(const char* buf, size_t size, |
| 3405 | upb_Message* msg, const upb_MiniTable* l, |
| 3406 | const upb_ExtensionRegistry* extreg, |
| 3407 | int options, upb_Arena* arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3408 | |
| 3409 | #ifdef __cplusplus |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 3410 | } /* extern "C" */ |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3411 | #endif |
| 3412 | |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 3413 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 3414 | #endif /* UPB_WIRE_DECODE_H_ */ |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3415 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3416 | // These are the specialized field parser functions for the fast parser. |
| 3417 | // Generated tables will refer to these by name. |
| 3418 | // |
| 3419 | // The function names are encoded with names like: |
| 3420 | // |
| 3421 | // // 123 4 |
| 3422 | // upb_pss_1bt(); // Parse singular string, 1 byte tag. |
| 3423 | // |
| 3424 | // In position 1: |
| 3425 | // - 'p' for parse, most function use this |
| 3426 | // - 'c' for copy, for when we are copying strings instead of aliasing |
| 3427 | // |
| 3428 | // In position 2 (cardinality): |
| 3429 | // - 's' for singular, with or without hasbit |
| 3430 | // - 'o' for oneof |
| 3431 | // - 'r' for non-packed repeated |
| 3432 | // - 'p' for packed repeated |
| 3433 | // |
| 3434 | // In position 3 (type): |
| 3435 | // - 'b1' for bool |
| 3436 | // - 'v4' for 4-byte varint |
| 3437 | // - 'v8' for 8-byte varint |
| 3438 | // - 'z4' for zig-zag-encoded 4-byte varint |
| 3439 | // - 'z8' for zig-zag-encoded 8-byte varint |
| 3440 | // - 'f4' for 4-byte fixed |
| 3441 | // - 'f8' for 8-byte fixed |
| 3442 | // - 'm' for sub-message |
| 3443 | // - 's' for string (validate UTF-8) |
| 3444 | // - 'b' for bytes |
| 3445 | // |
| 3446 | // In position 4 (tag length): |
| 3447 | // - '1' for one-byte tags (field numbers 1-15) |
| 3448 | // - '2' for two-byte tags (field numbers 16-2048) |
| 3449 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 3450 | #ifndef UPB_WIRE_DECODE_FAST_H_ |
| 3451 | #define UPB_WIRE_DECODE_FAST_H_ |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3452 | |
| 3453 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3454 | // Must be last. |
| 3455 | |
| 3456 | #ifdef __cplusplus |
| 3457 | extern "C" { |
| 3458 | #endif |
| 3459 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 3460 | struct upb_Decoder; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3461 | |
| 3462 | // The fallback, generic parsing function that can handle any field type. |
| 3463 | // 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] | 3464 | const char* _upb_FastDecoder_DecodeGeneric(struct upb_Decoder* d, |
| 3465 | const char* ptr, upb_Message* msg, |
| 3466 | intptr_t table, uint64_t hasbits, |
| 3467 | uint64_t data); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3468 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 3469 | #define UPB_PARSE_PARAMS \ |
| 3470 | 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] | 3471 | uint64_t hasbits, uint64_t data |
| 3472 | |
| 3473 | /* primitive fields ***********************************************************/ |
| 3474 | |
| 3475 | #define F(card, type, valbytes, tagbytes) \ |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 3476 | const char* upb_p##card##type##valbytes##_##tagbytes##bt(UPB_PARSE_PARAMS); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3477 | |
| 3478 | #define TYPES(card, tagbytes) \ |
| 3479 | F(card, b, 1, tagbytes) \ |
| 3480 | F(card, v, 4, tagbytes) \ |
| 3481 | F(card, v, 8, tagbytes) \ |
| 3482 | F(card, z, 4, tagbytes) \ |
| 3483 | F(card, z, 8, tagbytes) \ |
| 3484 | F(card, f, 4, tagbytes) \ |
| 3485 | F(card, f, 8, tagbytes) |
| 3486 | |
| 3487 | #define TAGBYTES(card) \ |
| 3488 | TYPES(card, 1) \ |
| 3489 | TYPES(card, 2) |
| 3490 | |
| 3491 | TAGBYTES(s) |
| 3492 | TAGBYTES(o) |
| 3493 | TAGBYTES(r) |
| 3494 | TAGBYTES(p) |
| 3495 | |
| 3496 | #undef F |
| 3497 | #undef TYPES |
| 3498 | #undef TAGBYTES |
| 3499 | |
| 3500 | /* string fields **************************************************************/ |
| 3501 | |
| 3502 | #define F(card, tagbytes, type) \ |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 3503 | const char* upb_p##card##type##_##tagbytes##bt(UPB_PARSE_PARAMS); \ |
| 3504 | const char* upb_c##card##type##_##tagbytes##bt(UPB_PARSE_PARAMS); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3505 | |
| 3506 | #define UTF8(card, tagbytes) \ |
| 3507 | F(card, tagbytes, s) \ |
| 3508 | F(card, tagbytes, b) |
| 3509 | |
| 3510 | #define TAGBYTES(card) \ |
| 3511 | UTF8(card, 1) \ |
| 3512 | UTF8(card, 2) |
| 3513 | |
| 3514 | TAGBYTES(s) |
| 3515 | TAGBYTES(o) |
| 3516 | TAGBYTES(r) |
| 3517 | |
| 3518 | #undef F |
| 3519 | #undef TAGBYTES |
| 3520 | |
| 3521 | /* sub-message fields *********************************************************/ |
| 3522 | |
| 3523 | #define F(card, tagbytes, size_ceil, ceil_arg) \ |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 3524 | 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] | 3525 | |
| 3526 | #define SIZES(card, tagbytes) \ |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 3527 | F(card, tagbytes, 64, 64) \ |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3528 | F(card, tagbytes, 128, 128) \ |
| 3529 | F(card, tagbytes, 192, 192) \ |
| 3530 | F(card, tagbytes, 256, 256) \ |
| 3531 | F(card, tagbytes, max, -1) |
| 3532 | |
| 3533 | #define TAGBYTES(card) \ |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 3534 | SIZES(card, 1) \ |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3535 | SIZES(card, 2) |
| 3536 | |
| 3537 | TAGBYTES(s) |
| 3538 | TAGBYTES(o) |
| 3539 | TAGBYTES(r) |
| 3540 | |
| 3541 | #undef TAGBYTES |
| 3542 | #undef SIZES |
| 3543 | #undef F |
| 3544 | |
| 3545 | #undef UPB_PARSE_PARAMS |
| 3546 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3547 | #ifdef __cplusplus |
| 3548 | } /* extern "C" */ |
| 3549 | #endif |
| 3550 | |
| 3551 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 3552 | #endif /* UPB_WIRE_DECODE_FAST_H_ */ |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 3553 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 3554 | // upb_Encode: parsing from a upb_Message using a upb_MiniTable. |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3555 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 3556 | #ifndef UPB_WIRE_ENCODE_H_ |
| 3557 | #define UPB_WIRE_ENCODE_H_ |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3558 | |
Protobuf Team Bot | 743bf92 | 2023-09-14 01:12:11 +0000 | [diff] [blame] | 3559 | #include <stddef.h> |
| 3560 | #include <stdint.h> |
| 3561 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3562 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3563 | // Must be last. |
| 3564 | |
| 3565 | #ifdef __cplusplus |
| 3566 | extern "C" { |
| 3567 | #endif |
| 3568 | |
| 3569 | enum { |
| 3570 | /* If set, the results of serializing will be deterministic across all |
| 3571 | * instances of this binary. There are no guarantees across different |
| 3572 | * binary builds. |
| 3573 | * |
| 3574 | * If your proto contains maps, the encoder will need to malloc()/free() |
| 3575 | * memory during encode. */ |
| 3576 | kUpb_EncodeOption_Deterministic = 1, |
| 3577 | |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 3578 | // When set, unknown fields are not printed. |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3579 | kUpb_EncodeOption_SkipUnknown = 2, |
| 3580 | |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 3581 | // When set, the encode will fail if any required fields are missing. |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3582 | kUpb_EncodeOption_CheckRequired = 4, |
| 3583 | }; |
| 3584 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3585 | typedef enum { |
| 3586 | kUpb_EncodeStatus_Ok = 0, |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 3587 | kUpb_EncodeStatus_OutOfMemory = 1, // Arena alloc failed |
| 3588 | kUpb_EncodeStatus_MaxDepthExceeded = 2, |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3589 | |
| 3590 | // kUpb_EncodeOption_CheckRequired failed but the parse otherwise succeeded. |
| 3591 | kUpb_EncodeStatus_MissingRequired = 3, |
| 3592 | } upb_EncodeStatus; |
| 3593 | |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 3594 | UPB_INLINE uint32_t upb_EncodeOptions_MaxDepth(uint16_t depth) { |
| 3595 | return (uint32_t)depth << 16; |
| 3596 | } |
| 3597 | |
| 3598 | UPB_INLINE uint16_t upb_EncodeOptions_GetMaxDepth(uint32_t options) { |
| 3599 | return options >> 16; |
| 3600 | } |
| 3601 | |
| 3602 | // Enforce an upper bound on recursion depth. |
| 3603 | UPB_INLINE int upb_Encode_LimitDepth(uint32_t encode_options, uint32_t limit) { |
| 3604 | uint32_t max_depth = upb_EncodeOptions_GetMaxDepth(encode_options); |
| 3605 | if (max_depth > limit) max_depth = limit; |
| 3606 | return upb_EncodeOptions_MaxDepth(max_depth) | (encode_options & 0xffff); |
| 3607 | } |
| 3608 | |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 3609 | UPB_API upb_EncodeStatus upb_Encode(const void* msg, const upb_MiniTable* l, |
| 3610 | int options, upb_Arena* arena, char** buf, |
| 3611 | size_t* size); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3612 | |
| 3613 | #ifdef __cplusplus |
| 3614 | } /* extern "C" */ |
| 3615 | #endif |
| 3616 | |
| 3617 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 3618 | #endif /* UPB_WIRE_ENCODE_H_ */ |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 3619 | // IWYU pragma: end_exports |
| 3620 | |
| 3621 | #endif // UPB_GENERATED_CODE_SUPPORT_H_ |
Protobuf Team Bot | 0cb912c | 2023-09-28 20:14:04 +0000 | [diff] [blame] | 3622 | /* This file was generated by upb_generator from the input file: |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 3623 | * |
| 3624 | * google/protobuf/descriptor.proto |
| 3625 | * |
| 3626 | * Do not edit -- your changes will be discarded when the file is |
| 3627 | * regenerated. */ |
| 3628 | |
Protobuf Team Bot | d11eb71 | 2023-09-15 00:25:33 +0000 | [diff] [blame] | 3629 | #ifndef GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_MINITABLE_H_ |
| 3630 | #define GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_MINITABLE_H_ |
| 3631 | |
| 3632 | |
| 3633 | // Must be last. |
| 3634 | |
| 3635 | #ifdef __cplusplus |
| 3636 | extern "C" { |
| 3637 | #endif |
| 3638 | |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 3639 | extern const upb_MiniTable google__protobuf__FileDescriptorSet_msg_init; |
| 3640 | extern const upb_MiniTable google__protobuf__FileDescriptorProto_msg_init; |
| 3641 | extern const upb_MiniTable google__protobuf__DescriptorProto_msg_init; |
| 3642 | extern const upb_MiniTable google__protobuf__DescriptorProto__ExtensionRange_msg_init; |
| 3643 | extern const upb_MiniTable google__protobuf__DescriptorProto__ReservedRange_msg_init; |
| 3644 | extern const upb_MiniTable google__protobuf__ExtensionRangeOptions_msg_init; |
| 3645 | extern const upb_MiniTable google__protobuf__ExtensionRangeOptions__Declaration_msg_init; |
| 3646 | extern const upb_MiniTable google__protobuf__FieldDescriptorProto_msg_init; |
| 3647 | extern const upb_MiniTable google__protobuf__OneofDescriptorProto_msg_init; |
| 3648 | extern const upb_MiniTable google__protobuf__EnumDescriptorProto_msg_init; |
| 3649 | extern const upb_MiniTable google__protobuf__EnumDescriptorProto__EnumReservedRange_msg_init; |
| 3650 | extern const upb_MiniTable google__protobuf__EnumValueDescriptorProto_msg_init; |
| 3651 | extern const upb_MiniTable google__protobuf__ServiceDescriptorProto_msg_init; |
| 3652 | extern const upb_MiniTable google__protobuf__MethodDescriptorProto_msg_init; |
| 3653 | extern const upb_MiniTable google__protobuf__FileOptions_msg_init; |
| 3654 | extern const upb_MiniTable google__protobuf__MessageOptions_msg_init; |
| 3655 | extern const upb_MiniTable google__protobuf__FieldOptions_msg_init; |
| 3656 | extern const upb_MiniTable google__protobuf__FieldOptions__EditionDefault_msg_init; |
| 3657 | extern const upb_MiniTable google__protobuf__OneofOptions_msg_init; |
| 3658 | extern const upb_MiniTable google__protobuf__EnumOptions_msg_init; |
| 3659 | extern const upb_MiniTable google__protobuf__EnumValueOptions_msg_init; |
| 3660 | extern const upb_MiniTable google__protobuf__ServiceOptions_msg_init; |
| 3661 | extern const upb_MiniTable google__protobuf__MethodOptions_msg_init; |
| 3662 | extern const upb_MiniTable google__protobuf__UninterpretedOption_msg_init; |
| 3663 | extern const upb_MiniTable google__protobuf__UninterpretedOption__NamePart_msg_init; |
| 3664 | extern const upb_MiniTable google__protobuf__FeatureSet_msg_init; |
| 3665 | extern const upb_MiniTable google__protobuf__FeatureSetDefaults_msg_init; |
| 3666 | extern const upb_MiniTable google__protobuf__FeatureSetDefaults__FeatureSetEditionDefault_msg_init; |
| 3667 | extern const upb_MiniTable google__protobuf__SourceCodeInfo_msg_init; |
| 3668 | extern const upb_MiniTable google__protobuf__SourceCodeInfo__Location_msg_init; |
| 3669 | extern const upb_MiniTable google__protobuf__GeneratedCodeInfo_msg_init; |
| 3670 | extern const upb_MiniTable google__protobuf__GeneratedCodeInfo__Annotation_msg_init; |
Protobuf Team Bot | d11eb71 | 2023-09-15 00:25:33 +0000 | [diff] [blame] | 3671 | |
| 3672 | extern const upb_MiniTableEnum google_protobuf_Edition_enum_init; |
| 3673 | extern const upb_MiniTableEnum google_protobuf_ExtensionRangeOptions_VerificationState_enum_init; |
| 3674 | extern const upb_MiniTableEnum google_protobuf_FeatureSet_EnumType_enum_init; |
| 3675 | extern const upb_MiniTableEnum google_protobuf_FeatureSet_FieldPresence_enum_init; |
| 3676 | extern const upb_MiniTableEnum google_protobuf_FeatureSet_JsonFormat_enum_init; |
| 3677 | extern const upb_MiniTableEnum google_protobuf_FeatureSet_MessageEncoding_enum_init; |
| 3678 | extern const upb_MiniTableEnum google_protobuf_FeatureSet_RepeatedFieldEncoding_enum_init; |
Protobuf Team Bot | 6112795 | 2023-09-26 20:07:33 +0000 | [diff] [blame] | 3679 | extern const upb_MiniTableEnum google_protobuf_FeatureSet_Utf8Validation_enum_init; |
Protobuf Team Bot | d11eb71 | 2023-09-15 00:25:33 +0000 | [diff] [blame] | 3680 | extern const upb_MiniTableEnum google_protobuf_FieldDescriptorProto_Label_enum_init; |
| 3681 | extern const upb_MiniTableEnum google_protobuf_FieldDescriptorProto_Type_enum_init; |
| 3682 | extern const upb_MiniTableEnum google_protobuf_FieldOptions_CType_enum_init; |
| 3683 | extern const upb_MiniTableEnum google_protobuf_FieldOptions_JSType_enum_init; |
| 3684 | extern const upb_MiniTableEnum google_protobuf_FieldOptions_OptionRetention_enum_init; |
| 3685 | extern const upb_MiniTableEnum google_protobuf_FieldOptions_OptionTargetType_enum_init; |
| 3686 | extern const upb_MiniTableEnum google_protobuf_FileOptions_OptimizeMode_enum_init; |
| 3687 | extern const upb_MiniTableEnum google_protobuf_GeneratedCodeInfo_Annotation_Semantic_enum_init; |
| 3688 | extern const upb_MiniTableEnum google_protobuf_MethodOptions_IdempotencyLevel_enum_init; |
| 3689 | extern const upb_MiniTableFile google_protobuf_descriptor_proto_upb_file_layout; |
| 3690 | |
| 3691 | #ifdef __cplusplus |
| 3692 | } /* extern "C" */ |
| 3693 | #endif |
| 3694 | |
| 3695 | |
| 3696 | #endif /* GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_MINITABLE_H_ */ |
| 3697 | |
| 3698 | #ifndef UPB_WIRE_EPS_COPY_INPUT_STREAM_H_ |
| 3699 | #define UPB_WIRE_EPS_COPY_INPUT_STREAM_H_ |
| 3700 | |
| 3701 | #include <string.h> |
| 3702 | |
| 3703 | |
| 3704 | // Must be last. |
| 3705 | |
| 3706 | #ifdef __cplusplus |
| 3707 | extern "C" { |
| 3708 | #endif |
| 3709 | |
| 3710 | // The maximum number of bytes a single protobuf field can take up in the |
| 3711 | // wire format. We only want to do one bounds check per field, so the input |
| 3712 | // stream guarantees that after upb_EpsCopyInputStream_IsDone() is called, |
| 3713 | // the decoder can read this many bytes without performing another bounds |
| 3714 | // check. The stream will copy into a patch buffer as necessary to guarantee |
| 3715 | // this invariant. |
| 3716 | #define kUpb_EpsCopyInputStream_SlopBytes 16 |
| 3717 | |
| 3718 | enum { |
| 3719 | kUpb_EpsCopyInputStream_NoAliasing = 0, |
| 3720 | kUpb_EpsCopyInputStream_OnPatch = 1, |
| 3721 | kUpb_EpsCopyInputStream_NoDelta = 2 |
| 3722 | }; |
| 3723 | |
| 3724 | typedef struct { |
| 3725 | const char* end; // Can read up to SlopBytes bytes beyond this. |
| 3726 | const char* limit_ptr; // For bounds checks, = end + UPB_MIN(limit, 0) |
| 3727 | uintptr_t aliasing; |
| 3728 | int limit; // Submessage limit relative to end |
| 3729 | bool error; // To distinguish between EOF and error. |
| 3730 | char patch[kUpb_EpsCopyInputStream_SlopBytes * 2]; |
| 3731 | } upb_EpsCopyInputStream; |
| 3732 | |
| 3733 | // Returns true if the stream is in the error state. A stream enters the error |
| 3734 | // state when the user reads past a limit (caught in IsDone()) or the |
| 3735 | // ZeroCopyInputStream returns an error. |
| 3736 | UPB_INLINE bool upb_EpsCopyInputStream_IsError(upb_EpsCopyInputStream* e) { |
| 3737 | return e->error; |
| 3738 | } |
| 3739 | |
| 3740 | typedef const char* upb_EpsCopyInputStream_BufferFlipCallback( |
| 3741 | upb_EpsCopyInputStream* e, const char* old_end, const char* new_start); |
| 3742 | |
| 3743 | typedef const char* upb_EpsCopyInputStream_IsDoneFallbackFunc( |
| 3744 | upb_EpsCopyInputStream* e, const char* ptr, int overrun); |
| 3745 | |
| 3746 | // Initializes a upb_EpsCopyInputStream using the contents of the buffer |
| 3747 | // [*ptr, size]. Updates `*ptr` as necessary to guarantee that at least |
| 3748 | // kUpb_EpsCopyInputStream_SlopBytes are available to read. |
| 3749 | UPB_INLINE void upb_EpsCopyInputStream_Init(upb_EpsCopyInputStream* e, |
| 3750 | const char** ptr, size_t size, |
| 3751 | bool enable_aliasing) { |
| 3752 | if (size <= kUpb_EpsCopyInputStream_SlopBytes) { |
| 3753 | memset(&e->patch, 0, 32); |
| 3754 | if (size) memcpy(&e->patch, *ptr, size); |
| 3755 | e->aliasing = enable_aliasing ? (uintptr_t)*ptr - (uintptr_t)e->patch |
| 3756 | : kUpb_EpsCopyInputStream_NoAliasing; |
| 3757 | *ptr = e->patch; |
| 3758 | e->end = *ptr + size; |
| 3759 | e->limit = 0; |
| 3760 | } else { |
| 3761 | e->end = *ptr + size - kUpb_EpsCopyInputStream_SlopBytes; |
| 3762 | e->limit = kUpb_EpsCopyInputStream_SlopBytes; |
| 3763 | e->aliasing = enable_aliasing ? kUpb_EpsCopyInputStream_NoDelta |
| 3764 | : kUpb_EpsCopyInputStream_NoAliasing; |
| 3765 | } |
| 3766 | e->limit_ptr = e->end; |
| 3767 | e->error = false; |
| 3768 | } |
| 3769 | |
| 3770 | typedef enum { |
| 3771 | // The current stream position is at a limit. |
| 3772 | kUpb_IsDoneStatus_Done, |
| 3773 | |
| 3774 | // The current stream position is not at a limit. |
| 3775 | kUpb_IsDoneStatus_NotDone, |
| 3776 | |
| 3777 | // The current stream position is not at a limit, and the stream needs to |
| 3778 | // be flipped to a new buffer before more data can be read. |
| 3779 | kUpb_IsDoneStatus_NeedFallback, |
| 3780 | } upb_IsDoneStatus; |
| 3781 | |
| 3782 | // Returns the status of the current stream position. This is a low-level |
| 3783 | // function, it is simpler to call upb_EpsCopyInputStream_IsDone() if possible. |
| 3784 | UPB_INLINE upb_IsDoneStatus upb_EpsCopyInputStream_IsDoneStatus( |
| 3785 | upb_EpsCopyInputStream* e, const char* ptr, int* overrun) { |
| 3786 | *overrun = ptr - e->end; |
| 3787 | if (UPB_LIKELY(ptr < e->limit_ptr)) { |
| 3788 | return kUpb_IsDoneStatus_NotDone; |
| 3789 | } else if (UPB_LIKELY(*overrun == e->limit)) { |
| 3790 | return kUpb_IsDoneStatus_Done; |
| 3791 | } else { |
| 3792 | return kUpb_IsDoneStatus_NeedFallback; |
| 3793 | } |
| 3794 | } |
| 3795 | |
| 3796 | // Returns true if the stream has hit a limit, either the current delimited |
| 3797 | // limit or the overall end-of-stream. As a side effect, this function may flip |
| 3798 | // the pointer to a new buffer if there are less than |
| 3799 | // kUpb_EpsCopyInputStream_SlopBytes of data to be read in the current buffer. |
| 3800 | // |
| 3801 | // Postcondition: if the function returns false, there are at least |
| 3802 | // kUpb_EpsCopyInputStream_SlopBytes of data available to read at *ptr. |
| 3803 | UPB_INLINE bool upb_EpsCopyInputStream_IsDoneWithCallback( |
| 3804 | upb_EpsCopyInputStream* e, const char** ptr, |
| 3805 | upb_EpsCopyInputStream_IsDoneFallbackFunc* func) { |
| 3806 | int overrun; |
| 3807 | switch (upb_EpsCopyInputStream_IsDoneStatus(e, *ptr, &overrun)) { |
| 3808 | case kUpb_IsDoneStatus_Done: |
| 3809 | return true; |
| 3810 | case kUpb_IsDoneStatus_NotDone: |
| 3811 | return false; |
| 3812 | case kUpb_IsDoneStatus_NeedFallback: |
| 3813 | *ptr = func(e, *ptr, overrun); |
| 3814 | return *ptr == NULL; |
| 3815 | } |
| 3816 | UPB_UNREACHABLE(); |
| 3817 | } |
| 3818 | |
| 3819 | const char* _upb_EpsCopyInputStream_IsDoneFallbackNoCallback( |
| 3820 | upb_EpsCopyInputStream* e, const char* ptr, int overrun); |
| 3821 | |
| 3822 | // A simpler version of IsDoneWithCallback() that does not support a buffer flip |
| 3823 | // callback. Useful in cases where we do not need to insert custom logic at |
| 3824 | // every buffer flip. |
| 3825 | // |
| 3826 | // If this returns true, the user must call upb_EpsCopyInputStream_IsError() |
| 3827 | // to distinguish between EOF and error. |
| 3828 | UPB_INLINE bool upb_EpsCopyInputStream_IsDone(upb_EpsCopyInputStream* e, |
| 3829 | const char** ptr) { |
| 3830 | return upb_EpsCopyInputStream_IsDoneWithCallback( |
| 3831 | e, ptr, _upb_EpsCopyInputStream_IsDoneFallbackNoCallback); |
| 3832 | } |
| 3833 | |
| 3834 | // Returns the total number of bytes that are safe to read from the current |
| 3835 | // buffer without reading uninitialized or unallocated memory. |
| 3836 | // |
| 3837 | // Note that this check does not respect any semantic limits on the stream, |
| 3838 | // either limits from PushLimit() or the overall stream end, so some of these |
| 3839 | // bytes may have unpredictable, nonsense values in them. The guarantee is only |
| 3840 | // that the bytes are valid to read from the perspective of the C language |
| 3841 | // (ie. you can read without triggering UBSAN or ASAN). |
| 3842 | UPB_INLINE size_t upb_EpsCopyInputStream_BytesAvailable( |
| 3843 | upb_EpsCopyInputStream* e, const char* ptr) { |
| 3844 | return (e->end - ptr) + kUpb_EpsCopyInputStream_SlopBytes; |
| 3845 | } |
| 3846 | |
| 3847 | // Returns true if the given delimited field size is valid (it does not extend |
| 3848 | // beyond any previously-pushed limits). `ptr` should point to the beginning |
| 3849 | // of the field data, after the delimited size. |
| 3850 | // |
| 3851 | // Note that this does *not* guarantee that all of the data for this field is in |
| 3852 | // the current buffer. |
| 3853 | UPB_INLINE bool upb_EpsCopyInputStream_CheckSize( |
| 3854 | const upb_EpsCopyInputStream* e, const char* ptr, int size) { |
| 3855 | UPB_ASSERT(size >= 0); |
| 3856 | return ptr - e->end + size <= e->limit; |
| 3857 | } |
| 3858 | |
| 3859 | UPB_INLINE bool _upb_EpsCopyInputStream_CheckSizeAvailable( |
| 3860 | upb_EpsCopyInputStream* e, const char* ptr, int size, bool submessage) { |
| 3861 | // This is one extra branch compared to the more normal: |
| 3862 | // return (size_t)(end - ptr) < size; |
| 3863 | // However it is one less computation if we are just about to use "ptr + len": |
| 3864 | // https://godbolt.org/z/35YGPz |
| 3865 | // In microbenchmarks this shows a small improvement. |
| 3866 | uintptr_t uptr = (uintptr_t)ptr; |
| 3867 | uintptr_t uend = (uintptr_t)e->limit_ptr; |
| 3868 | uintptr_t res = uptr + (size_t)size; |
| 3869 | if (!submessage) uend += kUpb_EpsCopyInputStream_SlopBytes; |
| 3870 | // NOTE: this check depends on having a linear address space. This is not |
| 3871 | // technically guaranteed by uintptr_t. |
| 3872 | bool ret = res >= uptr && res <= uend; |
| 3873 | if (size < 0) UPB_ASSERT(!ret); |
| 3874 | return ret; |
| 3875 | } |
| 3876 | |
| 3877 | // Returns true if the given delimited field size is valid (it does not extend |
| 3878 | // beyond any previously-pushed limited) *and* all of the data for this field is |
| 3879 | // available to be read in the current buffer. |
| 3880 | // |
| 3881 | // If the size is negative, this function will always return false. This |
| 3882 | // property can be useful in some cases. |
| 3883 | UPB_INLINE bool upb_EpsCopyInputStream_CheckDataSizeAvailable( |
| 3884 | upb_EpsCopyInputStream* e, const char* ptr, int size) { |
| 3885 | return _upb_EpsCopyInputStream_CheckSizeAvailable(e, ptr, size, false); |
| 3886 | } |
| 3887 | |
| 3888 | // Returns true if the given sub-message size is valid (it does not extend |
| 3889 | // beyond any previously-pushed limited) *and* all of the data for this |
| 3890 | // sub-message is available to be parsed in the current buffer. |
| 3891 | // |
| 3892 | // This implies that all fields from the sub-message can be parsed from the |
| 3893 | // current buffer while maintaining the invariant that we always have at least |
| 3894 | // kUpb_EpsCopyInputStream_SlopBytes of data available past the beginning of |
| 3895 | // any individual field start. |
| 3896 | // |
| 3897 | // If the size is negative, this function will always return false. This |
| 3898 | // property can be useful in some cases. |
| 3899 | UPB_INLINE bool upb_EpsCopyInputStream_CheckSubMessageSizeAvailable( |
| 3900 | upb_EpsCopyInputStream* e, const char* ptr, int size) { |
| 3901 | return _upb_EpsCopyInputStream_CheckSizeAvailable(e, ptr, size, true); |
| 3902 | } |
| 3903 | |
| 3904 | // Returns true if aliasing_enabled=true was passed to |
| 3905 | // upb_EpsCopyInputStream_Init() when this stream was initialized. |
| 3906 | UPB_INLINE bool upb_EpsCopyInputStream_AliasingEnabled( |
| 3907 | upb_EpsCopyInputStream* e) { |
| 3908 | return e->aliasing != kUpb_EpsCopyInputStream_NoAliasing; |
| 3909 | } |
| 3910 | |
| 3911 | // Returns true if aliasing_enabled=true was passed to |
| 3912 | // upb_EpsCopyInputStream_Init() when this stream was initialized *and* we can |
| 3913 | // alias into the region [ptr, size] in an input buffer. |
| 3914 | UPB_INLINE bool upb_EpsCopyInputStream_AliasingAvailable( |
| 3915 | upb_EpsCopyInputStream* e, const char* ptr, size_t size) { |
| 3916 | // When EpsCopyInputStream supports streaming, this will need to become a |
| 3917 | // runtime check. |
| 3918 | return upb_EpsCopyInputStream_CheckDataSizeAvailable(e, ptr, size) && |
| 3919 | e->aliasing >= kUpb_EpsCopyInputStream_NoDelta; |
| 3920 | } |
| 3921 | |
| 3922 | // Returns a pointer into an input buffer that corresponds to the parsing |
| 3923 | // pointer `ptr`. The returned pointer may be the same as `ptr`, but also may |
| 3924 | // be different if we are currently parsing out of the patch buffer. |
| 3925 | // |
| 3926 | // REQUIRES: Aliasing must be available for the given pointer. If the input is a |
| 3927 | // flat buffer and aliasing is enabled, then aliasing will always be available. |
| 3928 | UPB_INLINE const char* upb_EpsCopyInputStream_GetAliasedPtr( |
| 3929 | upb_EpsCopyInputStream* e, const char* ptr) { |
| 3930 | UPB_ASSUME(upb_EpsCopyInputStream_AliasingAvailable(e, ptr, 0)); |
| 3931 | uintptr_t delta = |
| 3932 | e->aliasing == kUpb_EpsCopyInputStream_NoDelta ? 0 : e->aliasing; |
| 3933 | return (const char*)((uintptr_t)ptr + delta); |
| 3934 | } |
| 3935 | |
| 3936 | // Reads string data from the input, aliasing into the input buffer instead of |
| 3937 | // copying. The parsing pointer is passed in `*ptr`, and will be updated if |
| 3938 | // necessary to point to the actual input buffer. Returns the new parsing |
| 3939 | // pointer, which will be advanced past the string data. |
| 3940 | // |
| 3941 | // REQUIRES: Aliasing must be available for this data region (test with |
| 3942 | // upb_EpsCopyInputStream_AliasingAvailable(). |
| 3943 | UPB_INLINE const char* upb_EpsCopyInputStream_ReadStringAliased( |
| 3944 | upb_EpsCopyInputStream* e, const char** ptr, size_t size) { |
| 3945 | UPB_ASSUME(upb_EpsCopyInputStream_AliasingAvailable(e, *ptr, size)); |
| 3946 | const char* ret = *ptr + size; |
| 3947 | *ptr = upb_EpsCopyInputStream_GetAliasedPtr(e, *ptr); |
| 3948 | UPB_ASSUME(ret != NULL); |
| 3949 | return ret; |
| 3950 | } |
| 3951 | |
| 3952 | // Skips `size` bytes of data from the input and returns a pointer past the end. |
| 3953 | // Returns NULL on end of stream or error. |
| 3954 | UPB_INLINE const char* upb_EpsCopyInputStream_Skip(upb_EpsCopyInputStream* e, |
| 3955 | const char* ptr, int size) { |
| 3956 | if (!upb_EpsCopyInputStream_CheckDataSizeAvailable(e, ptr, size)) return NULL; |
| 3957 | return ptr + size; |
| 3958 | } |
| 3959 | |
| 3960 | // Copies `size` bytes of data from the input `ptr` into the buffer `to`, and |
| 3961 | // returns a pointer past the end. Returns NULL on end of stream or error. |
| 3962 | UPB_INLINE const char* upb_EpsCopyInputStream_Copy(upb_EpsCopyInputStream* e, |
| 3963 | const char* ptr, void* to, |
| 3964 | int size) { |
| 3965 | if (!upb_EpsCopyInputStream_CheckDataSizeAvailable(e, ptr, size)) return NULL; |
| 3966 | memcpy(to, ptr, size); |
| 3967 | return ptr + size; |
| 3968 | } |
| 3969 | |
| 3970 | // Reads string data from the stream and advances the pointer accordingly. |
| 3971 | // If aliasing was enabled when the stream was initialized, then the returned |
| 3972 | // pointer will point into the input buffer if possible, otherwise new data |
| 3973 | // will be allocated from arena and copied into. We may be forced to copy even |
| 3974 | // if aliasing was enabled if the input data spans input buffers. |
| 3975 | // |
| 3976 | // Returns NULL if memory allocation failed, or we reached a premature EOF. |
| 3977 | UPB_INLINE const char* upb_EpsCopyInputStream_ReadString( |
| 3978 | upb_EpsCopyInputStream* e, const char** ptr, size_t size, |
| 3979 | upb_Arena* arena) { |
| 3980 | if (upb_EpsCopyInputStream_AliasingAvailable(e, *ptr, size)) { |
| 3981 | return upb_EpsCopyInputStream_ReadStringAliased(e, ptr, size); |
| 3982 | } else { |
| 3983 | // We need to allocate and copy. |
| 3984 | if (!upb_EpsCopyInputStream_CheckDataSizeAvailable(e, *ptr, size)) { |
| 3985 | return NULL; |
| 3986 | } |
| 3987 | UPB_ASSERT(arena); |
| 3988 | char* data = (char*)upb_Arena_Malloc(arena, size); |
| 3989 | if (!data) return NULL; |
| 3990 | const char* ret = upb_EpsCopyInputStream_Copy(e, *ptr, data, size); |
| 3991 | *ptr = data; |
| 3992 | return ret; |
| 3993 | } |
| 3994 | } |
| 3995 | |
| 3996 | UPB_INLINE void _upb_EpsCopyInputStream_CheckLimit(upb_EpsCopyInputStream* e) { |
| 3997 | UPB_ASSERT(e->limit_ptr == e->end + UPB_MIN(0, e->limit)); |
| 3998 | } |
| 3999 | |
| 4000 | // Pushes a limit onto the stack of limits for the current stream. The limit |
| 4001 | // will extend for `size` bytes beyond the position in `ptr`. Future calls to |
| 4002 | // upb_EpsCopyInputStream_IsDone() will return `true` when the stream position |
| 4003 | // reaches this limit. |
| 4004 | // |
| 4005 | // Returns a delta that the caller must store and supply to PopLimit() below. |
| 4006 | UPB_INLINE int upb_EpsCopyInputStream_PushLimit(upb_EpsCopyInputStream* e, |
| 4007 | const char* ptr, int size) { |
| 4008 | int limit = size + (int)(ptr - e->end); |
| 4009 | int delta = e->limit - limit; |
| 4010 | _upb_EpsCopyInputStream_CheckLimit(e); |
| 4011 | UPB_ASSERT(limit <= e->limit); |
| 4012 | e->limit = limit; |
| 4013 | e->limit_ptr = e->end + UPB_MIN(0, limit); |
| 4014 | _upb_EpsCopyInputStream_CheckLimit(e); |
| 4015 | return delta; |
| 4016 | } |
| 4017 | |
| 4018 | // Pops the last limit that was pushed on this stream. This may only be called |
| 4019 | // once IsDone() returns true. The user must pass the delta that was returned |
| 4020 | // from PushLimit(). |
| 4021 | UPB_INLINE void upb_EpsCopyInputStream_PopLimit(upb_EpsCopyInputStream* e, |
| 4022 | const char* ptr, |
| 4023 | int saved_delta) { |
| 4024 | UPB_ASSERT(ptr - e->end == e->limit); |
| 4025 | _upb_EpsCopyInputStream_CheckLimit(e); |
| 4026 | e->limit += saved_delta; |
| 4027 | e->limit_ptr = e->end + UPB_MIN(0, e->limit); |
| 4028 | _upb_EpsCopyInputStream_CheckLimit(e); |
| 4029 | } |
| 4030 | |
| 4031 | UPB_INLINE const char* _upb_EpsCopyInputStream_IsDoneFallbackInline( |
| 4032 | upb_EpsCopyInputStream* e, const char* ptr, int overrun, |
| 4033 | upb_EpsCopyInputStream_BufferFlipCallback* callback) { |
| 4034 | if (overrun < e->limit) { |
| 4035 | // Need to copy remaining data into patch buffer. |
| 4036 | UPB_ASSERT(overrun < kUpb_EpsCopyInputStream_SlopBytes); |
| 4037 | const char* old_end = ptr; |
| 4038 | const char* new_start = &e->patch[0] + overrun; |
| 4039 | memset(e->patch + kUpb_EpsCopyInputStream_SlopBytes, 0, |
| 4040 | kUpb_EpsCopyInputStream_SlopBytes); |
| 4041 | memcpy(e->patch, e->end, kUpb_EpsCopyInputStream_SlopBytes); |
| 4042 | ptr = new_start; |
| 4043 | e->end = &e->patch[kUpb_EpsCopyInputStream_SlopBytes]; |
| 4044 | e->limit -= kUpb_EpsCopyInputStream_SlopBytes; |
| 4045 | e->limit_ptr = e->end + e->limit; |
| 4046 | UPB_ASSERT(ptr < e->limit_ptr); |
| 4047 | if (e->aliasing != kUpb_EpsCopyInputStream_NoAliasing) { |
| 4048 | e->aliasing = (uintptr_t)old_end - (uintptr_t)new_start; |
| 4049 | } |
| 4050 | return callback(e, old_end, new_start); |
| 4051 | } else { |
| 4052 | UPB_ASSERT(overrun > e->limit); |
| 4053 | e->error = true; |
| 4054 | return callback(e, NULL, NULL); |
| 4055 | } |
| 4056 | } |
| 4057 | |
| 4058 | typedef const char* upb_EpsCopyInputStream_ParseDelimitedFunc( |
| 4059 | upb_EpsCopyInputStream* e, const char* ptr, void* ctx); |
| 4060 | |
| 4061 | // Tries to perform a fast-path handling of the given delimited message data. |
| 4062 | // If the sub-message beginning at `*ptr` and extending for `len` is short and |
| 4063 | // fits within this buffer, calls `func` with `ctx` as a parameter, where the |
| 4064 | // pushing and popping of limits is handled automatically and with lower cost |
| 4065 | // than the normal PushLimit()/PopLimit() sequence. |
| 4066 | static UPB_FORCEINLINE bool upb_EpsCopyInputStream_TryParseDelimitedFast( |
| 4067 | upb_EpsCopyInputStream* e, const char** ptr, int len, |
| 4068 | upb_EpsCopyInputStream_ParseDelimitedFunc* func, void* ctx) { |
| 4069 | if (!upb_EpsCopyInputStream_CheckSubMessageSizeAvailable(e, *ptr, len)) { |
| 4070 | return false; |
| 4071 | } |
| 4072 | |
| 4073 | // Fast case: Sub-message is <128 bytes and fits in the current buffer. |
| 4074 | // This means we can preserve limit/limit_ptr verbatim. |
| 4075 | const char* saved_limit_ptr = e->limit_ptr; |
| 4076 | int saved_limit = e->limit; |
| 4077 | e->limit_ptr = *ptr + len; |
| 4078 | e->limit = e->limit_ptr - e->end; |
| 4079 | UPB_ASSERT(e->limit_ptr == e->end + UPB_MIN(0, e->limit)); |
| 4080 | *ptr = func(e, *ptr, ctx); |
| 4081 | e->limit_ptr = saved_limit_ptr; |
| 4082 | e->limit = saved_limit; |
| 4083 | UPB_ASSERT(e->limit_ptr == e->end + UPB_MIN(0, e->limit)); |
| 4084 | return true; |
| 4085 | } |
| 4086 | |
| 4087 | #ifdef __cplusplus |
| 4088 | } /* extern "C" */ |
| 4089 | #endif |
| 4090 | |
| 4091 | |
| 4092 | #endif // UPB_WIRE_EPS_COPY_INPUT_STREAM_H_ |
| 4093 | |
Protobuf Team Bot | 376ba2f | 2023-09-29 22:17:43 +0000 | [diff] [blame] | 4094 | #ifndef UPB_BASE_INTERNAL_LOG2_H_ |
| 4095 | #define UPB_BASE_INTERNAL_LOG2_H_ |
| 4096 | |
| 4097 | // Must be last. |
| 4098 | |
| 4099 | #ifdef __cplusplus |
| 4100 | extern "C" { |
| 4101 | #endif |
| 4102 | |
| 4103 | UPB_INLINE int upb_Log2Ceiling(int x) { |
| 4104 | if (x <= 1) return 0; |
| 4105 | #ifdef __GNUC__ |
| 4106 | return 32 - __builtin_clz(x - 1); |
| 4107 | #else |
| 4108 | int lg2 = 0; |
| 4109 | while ((1 << lg2) < x) lg2++; |
| 4110 | return lg2; |
| 4111 | #endif |
| 4112 | } |
| 4113 | |
| 4114 | UPB_INLINE int upb_Log2CeilingSize(int x) { return 1 << upb_Log2Ceiling(x); } |
| 4115 | |
| 4116 | #ifdef __cplusplus |
| 4117 | } /* extern "C" */ |
| 4118 | #endif |
| 4119 | |
| 4120 | |
| 4121 | #endif /* UPB_BASE_INTERNAL_LOG2_H_ */ |
| 4122 | |
Protobuf Team Bot | d11eb71 | 2023-09-15 00:25:33 +0000 | [diff] [blame] | 4123 | #ifndef UPB_HASH_INT_TABLE_H_ |
| 4124 | #define UPB_HASH_INT_TABLE_H_ |
| 4125 | |
| 4126 | |
| 4127 | // Must be last. |
| 4128 | |
| 4129 | typedef struct { |
| 4130 | upb_table t; // For entries that don't fit in the array part. |
| 4131 | const upb_tabval* array; // Array part of the table. See const note above. |
| 4132 | size_t array_size; // Array part size. |
| 4133 | size_t array_count; // Array part number of elements. |
| 4134 | } upb_inttable; |
| 4135 | |
| 4136 | #ifdef __cplusplus |
| 4137 | extern "C" { |
| 4138 | #endif |
| 4139 | |
| 4140 | // Initialize a table. If memory allocation failed, false is returned and |
| 4141 | // the table is uninitialized. |
| 4142 | bool upb_inttable_init(upb_inttable* table, upb_Arena* a); |
| 4143 | |
| 4144 | // Returns the number of values in the table. |
| 4145 | size_t upb_inttable_count(const upb_inttable* t); |
| 4146 | |
| 4147 | // Inserts the given key into the hashtable with the given value. |
| 4148 | // The key must not already exist in the hash table. |
| 4149 | // The value must not be UINTPTR_MAX. |
| 4150 | // |
| 4151 | // If a table resize was required but memory allocation failed, false is |
| 4152 | // returned and the table is unchanged. |
| 4153 | bool upb_inttable_insert(upb_inttable* t, uintptr_t key, upb_value val, |
| 4154 | upb_Arena* a); |
| 4155 | |
| 4156 | // Looks up key in this table, returning "true" if the key was found. |
| 4157 | // If v is non-NULL, copies the value for this key into *v. |
| 4158 | bool upb_inttable_lookup(const upb_inttable* t, uintptr_t key, upb_value* v); |
| 4159 | |
| 4160 | // Removes an item from the table. Returns true if the remove was successful, |
| 4161 | // and stores the removed item in *val if non-NULL. |
| 4162 | bool upb_inttable_remove(upb_inttable* t, uintptr_t key, upb_value* val); |
| 4163 | |
| 4164 | // Updates an existing entry in an inttable. |
| 4165 | // If the entry does not exist, returns false and does nothing. |
| 4166 | // Unlike insert/remove, this does not invalidate iterators. |
| 4167 | bool upb_inttable_replace(upb_inttable* t, uintptr_t key, upb_value val); |
| 4168 | |
| 4169 | // Optimizes the table for the current set of entries, for both memory use and |
| 4170 | // lookup time. Client should call this after all entries have been inserted; |
| 4171 | // inserting more entries is legal, but will likely require a table resize. |
| 4172 | void upb_inttable_compact(upb_inttable* t, upb_Arena* a); |
| 4173 | |
| 4174 | // Iteration over inttable: |
| 4175 | // |
| 4176 | // intptr_t iter = UPB_INTTABLE_BEGIN; |
| 4177 | // uintptr_t key; |
| 4178 | // upb_value val; |
| 4179 | // while (upb_inttable_next(t, &key, &val, &iter)) { |
| 4180 | // // ... |
| 4181 | // } |
| 4182 | |
| 4183 | #define UPB_INTTABLE_BEGIN -1 |
| 4184 | |
| 4185 | bool upb_inttable_next(const upb_inttable* t, uintptr_t* key, upb_value* val, |
| 4186 | intptr_t* iter); |
| 4187 | void upb_inttable_removeiter(upb_inttable* t, intptr_t* iter); |
| 4188 | |
| 4189 | #ifdef __cplusplus |
| 4190 | } /* extern "C" */ |
| 4191 | #endif |
| 4192 | |
| 4193 | |
| 4194 | #endif /* UPB_HASH_INT_TABLE_H_ */ |
| 4195 | |
| 4196 | #ifndef UPB_JSON_DECODE_H_ |
| 4197 | #define UPB_JSON_DECODE_H_ |
| 4198 | |
| 4199 | |
| 4200 | #ifndef UPB_REFLECTION_DEF_H_ |
| 4201 | #define UPB_REFLECTION_DEF_H_ |
| 4202 | |
| 4203 | // IWYU pragma: begin_exports |
| 4204 | |
Protobuf Team Bot | 0631035 | 2023-09-26 21:54:58 +0000 | [diff] [blame] | 4205 | // IWYU pragma: private, include "upb/reflection/def.h" |
Protobuf Team Bot | d11eb71 | 2023-09-15 00:25:33 +0000 | [diff] [blame] | 4206 | |
| 4207 | #ifndef UPB_REFLECTION_DEF_POOL_H_ |
| 4208 | #define UPB_REFLECTION_DEF_POOL_H_ |
| 4209 | |
| 4210 | |
Protobuf Team Bot | 0631035 | 2023-09-26 21:54:58 +0000 | [diff] [blame] | 4211 | // IWYU pragma: private, include "upb/reflection/def.h" |
Protobuf Team Bot | d11eb71 | 2023-09-15 00:25:33 +0000 | [diff] [blame] | 4212 | |
| 4213 | // Declarations common to all public def types. |
| 4214 | |
| 4215 | #ifndef UPB_REFLECTION_COMMON_H_ |
| 4216 | #define UPB_REFLECTION_COMMON_H_ |
| 4217 | |
| 4218 | // begin:google_only |
| 4219 | // #ifndef UPB_BOOTSTRAP_STAGE0 |
| 4220 | // #include "net/proto2/proto/descriptor.upb.h" |
| 4221 | // #else |
| 4222 | // #include "google/protobuf/descriptor.upb.h" |
| 4223 | // #endif |
| 4224 | // end:google_only |
| 4225 | |
| 4226 | // begin:github_only |
Protobuf Team Bot | 0cb912c | 2023-09-28 20:14:04 +0000 | [diff] [blame] | 4227 | /* This file was generated by upb_generator from the input file: |
Protobuf Team Bot | d11eb71 | 2023-09-15 00:25:33 +0000 | [diff] [blame] | 4228 | * |
| 4229 | * google/protobuf/descriptor.proto |
| 4230 | * |
| 4231 | * Do not edit -- your changes will be discarded when the file is |
| 4232 | * regenerated. */ |
| 4233 | |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 4234 | #ifndef GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_H_ |
| 4235 | #define GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_H_ |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4236 | |
Protobuf Team Bot | 111d655 | 2023-09-15 21:07:08 +0000 | [diff] [blame] | 4237 | |
| 4238 | |
| 4239 | // Must be last. |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4240 | |
| 4241 | #ifdef __cplusplus |
| 4242 | extern "C" { |
| 4243 | #endif |
| 4244 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4245 | typedef struct google_protobuf_FileDescriptorSet google_protobuf_FileDescriptorSet; |
| 4246 | typedef struct google_protobuf_FileDescriptorProto google_protobuf_FileDescriptorProto; |
| 4247 | typedef struct google_protobuf_DescriptorProto google_protobuf_DescriptorProto; |
| 4248 | typedef struct google_protobuf_DescriptorProto_ExtensionRange google_protobuf_DescriptorProto_ExtensionRange; |
| 4249 | typedef struct google_protobuf_DescriptorProto_ReservedRange google_protobuf_DescriptorProto_ReservedRange; |
| 4250 | typedef struct google_protobuf_ExtensionRangeOptions google_protobuf_ExtensionRangeOptions; |
Mike Kruskal | 145900f | 2023-03-27 09:55:52 -0700 | [diff] [blame] | 4251 | typedef struct google_protobuf_ExtensionRangeOptions_Declaration google_protobuf_ExtensionRangeOptions_Declaration; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4252 | typedef struct google_protobuf_FieldDescriptorProto google_protobuf_FieldDescriptorProto; |
| 4253 | typedef struct google_protobuf_OneofDescriptorProto google_protobuf_OneofDescriptorProto; |
| 4254 | typedef struct google_protobuf_EnumDescriptorProto google_protobuf_EnumDescriptorProto; |
| 4255 | typedef struct google_protobuf_EnumDescriptorProto_EnumReservedRange google_protobuf_EnumDescriptorProto_EnumReservedRange; |
| 4256 | typedef struct google_protobuf_EnumValueDescriptorProto google_protobuf_EnumValueDescriptorProto; |
| 4257 | typedef struct google_protobuf_ServiceDescriptorProto google_protobuf_ServiceDescriptorProto; |
| 4258 | typedef struct google_protobuf_MethodDescriptorProto google_protobuf_MethodDescriptorProto; |
| 4259 | typedef struct google_protobuf_FileOptions google_protobuf_FileOptions; |
| 4260 | typedef struct google_protobuf_MessageOptions google_protobuf_MessageOptions; |
| 4261 | typedef struct google_protobuf_FieldOptions google_protobuf_FieldOptions; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 4262 | typedef struct google_protobuf_FieldOptions_EditionDefault google_protobuf_FieldOptions_EditionDefault; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4263 | typedef struct google_protobuf_OneofOptions google_protobuf_OneofOptions; |
| 4264 | typedef struct google_protobuf_EnumOptions google_protobuf_EnumOptions; |
| 4265 | typedef struct google_protobuf_EnumValueOptions google_protobuf_EnumValueOptions; |
| 4266 | typedef struct google_protobuf_ServiceOptions google_protobuf_ServiceOptions; |
| 4267 | typedef struct google_protobuf_MethodOptions google_protobuf_MethodOptions; |
| 4268 | typedef struct google_protobuf_UninterpretedOption google_protobuf_UninterpretedOption; |
| 4269 | typedef struct google_protobuf_UninterpretedOption_NamePart google_protobuf_UninterpretedOption_NamePart; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 4270 | typedef struct google_protobuf_FeatureSet google_protobuf_FeatureSet; |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 4271 | typedef struct google_protobuf_FeatureSetDefaults google_protobuf_FeatureSetDefaults; |
| 4272 | typedef struct google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4273 | typedef struct google_protobuf_SourceCodeInfo google_protobuf_SourceCodeInfo; |
| 4274 | typedef struct google_protobuf_SourceCodeInfo_Location google_protobuf_SourceCodeInfo_Location; |
| 4275 | typedef struct google_protobuf_GeneratedCodeInfo google_protobuf_GeneratedCodeInfo; |
| 4276 | typedef struct google_protobuf_GeneratedCodeInfo_Annotation google_protobuf_GeneratedCodeInfo_Annotation; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4277 | |
| 4278 | typedef enum { |
Protobuf Team Bot | fa98bb3 | 2023-09-01 18:11:09 +0000 | [diff] [blame] | 4279 | google_protobuf_EDITION_UNKNOWN = 0, |
| 4280 | google_protobuf_EDITION_1_TEST_ONLY = 1, |
| 4281 | google_protobuf_EDITION_2_TEST_ONLY = 2, |
Protobuf Team Bot | 6703802 | 2023-10-04 04:14:37 +0000 | [diff] [blame] | 4282 | google_protobuf_EDITION_PROTO2 = 998, |
| 4283 | google_protobuf_EDITION_PROTO3 = 999, |
Protobuf Team Bot | fa98bb3 | 2023-09-01 18:11:09 +0000 | [diff] [blame] | 4284 | google_protobuf_EDITION_2023 = 1000, |
| 4285 | google_protobuf_EDITION_99997_TEST_ONLY = 99997, |
| 4286 | google_protobuf_EDITION_99998_TEST_ONLY = 99998, |
| 4287 | google_protobuf_EDITION_99999_TEST_ONLY = 99999 |
| 4288 | } google_protobuf_Edition; |
| 4289 | |
| 4290 | typedef enum { |
Protobuf Team Bot | 469f027 | 2023-04-21 18:12:45 -0700 | [diff] [blame] | 4291 | google_protobuf_ExtensionRangeOptions_DECLARATION = 0, |
| 4292 | google_protobuf_ExtensionRangeOptions_UNVERIFIED = 1 |
| 4293 | } google_protobuf_ExtensionRangeOptions_VerificationState; |
| 4294 | |
| 4295 | typedef enum { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 4296 | google_protobuf_FeatureSet_ENUM_TYPE_UNKNOWN = 0, |
| 4297 | google_protobuf_FeatureSet_OPEN = 1, |
| 4298 | google_protobuf_FeatureSet_CLOSED = 2 |
| 4299 | } google_protobuf_FeatureSet_EnumType; |
| 4300 | |
| 4301 | typedef enum { |
| 4302 | google_protobuf_FeatureSet_FIELD_PRESENCE_UNKNOWN = 0, |
| 4303 | google_protobuf_FeatureSet_EXPLICIT = 1, |
| 4304 | google_protobuf_FeatureSet_IMPLICIT = 2, |
| 4305 | google_protobuf_FeatureSet_LEGACY_REQUIRED = 3 |
| 4306 | } google_protobuf_FeatureSet_FieldPresence; |
| 4307 | |
| 4308 | typedef enum { |
| 4309 | google_protobuf_FeatureSet_JSON_FORMAT_UNKNOWN = 0, |
| 4310 | google_protobuf_FeatureSet_ALLOW = 1, |
| 4311 | google_protobuf_FeatureSet_LEGACY_BEST_EFFORT = 2 |
| 4312 | } google_protobuf_FeatureSet_JsonFormat; |
| 4313 | |
| 4314 | typedef enum { |
| 4315 | google_protobuf_FeatureSet_MESSAGE_ENCODING_UNKNOWN = 0, |
| 4316 | google_protobuf_FeatureSet_LENGTH_PREFIXED = 1, |
| 4317 | google_protobuf_FeatureSet_DELIMITED = 2 |
| 4318 | } google_protobuf_FeatureSet_MessageEncoding; |
| 4319 | |
| 4320 | typedef enum { |
| 4321 | google_protobuf_FeatureSet_REPEATED_FIELD_ENCODING_UNKNOWN = 0, |
| 4322 | google_protobuf_FeatureSet_PACKED = 1, |
| 4323 | google_protobuf_FeatureSet_EXPANDED = 2 |
| 4324 | } google_protobuf_FeatureSet_RepeatedFieldEncoding; |
| 4325 | |
| 4326 | typedef enum { |
Protobuf Team Bot | 6112795 | 2023-09-26 20:07:33 +0000 | [diff] [blame] | 4327 | google_protobuf_FeatureSet_UTF8_VALIDATION_UNKNOWN = 0, |
Protobuf Team Bot | 4b301ad | 2023-10-14 03:20:44 +0000 | [diff] [blame] | 4328 | google_protobuf_FeatureSet_NONE = 1, |
Protobuf Team Bot | 6112795 | 2023-09-26 20:07:33 +0000 | [diff] [blame] | 4329 | google_protobuf_FeatureSet_VERIFY = 2 |
| 4330 | } google_protobuf_FeatureSet_Utf8Validation; |
| 4331 | |
| 4332 | typedef enum { |
Mike Kruskal | ccbdaa7 | 2023-02-02 20:42:14 -0800 | [diff] [blame] | 4333 | google_protobuf_FieldDescriptorProto_LABEL_OPTIONAL = 1, |
| 4334 | google_protobuf_FieldDescriptorProto_LABEL_REQUIRED = 2, |
| 4335 | google_protobuf_FieldDescriptorProto_LABEL_REPEATED = 3 |
| 4336 | } google_protobuf_FieldDescriptorProto_Label; |
| 4337 | |
| 4338 | typedef enum { |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4339 | google_protobuf_FieldDescriptorProto_TYPE_DOUBLE = 1, |
| 4340 | google_protobuf_FieldDescriptorProto_TYPE_FLOAT = 2, |
| 4341 | google_protobuf_FieldDescriptorProto_TYPE_INT64 = 3, |
| 4342 | google_protobuf_FieldDescriptorProto_TYPE_UINT64 = 4, |
| 4343 | google_protobuf_FieldDescriptorProto_TYPE_INT32 = 5, |
| 4344 | google_protobuf_FieldDescriptorProto_TYPE_FIXED64 = 6, |
| 4345 | google_protobuf_FieldDescriptorProto_TYPE_FIXED32 = 7, |
| 4346 | google_protobuf_FieldDescriptorProto_TYPE_BOOL = 8, |
| 4347 | google_protobuf_FieldDescriptorProto_TYPE_STRING = 9, |
| 4348 | google_protobuf_FieldDescriptorProto_TYPE_GROUP = 10, |
| 4349 | google_protobuf_FieldDescriptorProto_TYPE_MESSAGE = 11, |
| 4350 | google_protobuf_FieldDescriptorProto_TYPE_BYTES = 12, |
| 4351 | google_protobuf_FieldDescriptorProto_TYPE_UINT32 = 13, |
| 4352 | google_protobuf_FieldDescriptorProto_TYPE_ENUM = 14, |
| 4353 | google_protobuf_FieldDescriptorProto_TYPE_SFIXED32 = 15, |
| 4354 | google_protobuf_FieldDescriptorProto_TYPE_SFIXED64 = 16, |
| 4355 | google_protobuf_FieldDescriptorProto_TYPE_SINT32 = 17, |
| 4356 | google_protobuf_FieldDescriptorProto_TYPE_SINT64 = 18 |
| 4357 | } google_protobuf_FieldDescriptorProto_Type; |
| 4358 | |
| 4359 | typedef enum { |
| 4360 | google_protobuf_FieldOptions_STRING = 0, |
| 4361 | google_protobuf_FieldOptions_CORD = 1, |
| 4362 | google_protobuf_FieldOptions_STRING_PIECE = 2 |
| 4363 | } google_protobuf_FieldOptions_CType; |
| 4364 | |
| 4365 | typedef enum { |
| 4366 | google_protobuf_FieldOptions_JS_NORMAL = 0, |
| 4367 | google_protobuf_FieldOptions_JS_STRING = 1, |
| 4368 | google_protobuf_FieldOptions_JS_NUMBER = 2 |
| 4369 | } google_protobuf_FieldOptions_JSType; |
| 4370 | |
| 4371 | typedef enum { |
Adam Cozzette | 90ff32c | 2023-01-21 15:04:56 -0800 | [diff] [blame] | 4372 | google_protobuf_FieldOptions_RETENTION_UNKNOWN = 0, |
| 4373 | google_protobuf_FieldOptions_RETENTION_RUNTIME = 1, |
| 4374 | google_protobuf_FieldOptions_RETENTION_SOURCE = 2 |
| 4375 | } google_protobuf_FieldOptions_OptionRetention; |
| 4376 | |
| 4377 | typedef enum { |
| 4378 | google_protobuf_FieldOptions_TARGET_TYPE_UNKNOWN = 0, |
| 4379 | google_protobuf_FieldOptions_TARGET_TYPE_FILE = 1, |
| 4380 | google_protobuf_FieldOptions_TARGET_TYPE_EXTENSION_RANGE = 2, |
| 4381 | google_protobuf_FieldOptions_TARGET_TYPE_MESSAGE = 3, |
| 4382 | google_protobuf_FieldOptions_TARGET_TYPE_FIELD = 4, |
| 4383 | google_protobuf_FieldOptions_TARGET_TYPE_ONEOF = 5, |
| 4384 | google_protobuf_FieldOptions_TARGET_TYPE_ENUM = 6, |
| 4385 | google_protobuf_FieldOptions_TARGET_TYPE_ENUM_ENTRY = 7, |
| 4386 | google_protobuf_FieldOptions_TARGET_TYPE_SERVICE = 8, |
| 4387 | google_protobuf_FieldOptions_TARGET_TYPE_METHOD = 9 |
| 4388 | } google_protobuf_FieldOptions_OptionTargetType; |
| 4389 | |
| 4390 | typedef enum { |
Mike Kruskal | ccbdaa7 | 2023-02-02 20:42:14 -0800 | [diff] [blame] | 4391 | google_protobuf_FileOptions_SPEED = 1, |
| 4392 | google_protobuf_FileOptions_CODE_SIZE = 2, |
| 4393 | google_protobuf_FileOptions_LITE_RUNTIME = 3 |
| 4394 | } google_protobuf_FileOptions_OptimizeMode; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4395 | |
| 4396 | typedef enum { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4397 | google_protobuf_GeneratedCodeInfo_Annotation_NONE = 0, |
| 4398 | google_protobuf_GeneratedCodeInfo_Annotation_SET = 1, |
| 4399 | google_protobuf_GeneratedCodeInfo_Annotation_ALIAS = 2 |
| 4400 | } google_protobuf_GeneratedCodeInfo_Annotation_Semantic; |
| 4401 | |
Mike Kruskal | ccbdaa7 | 2023-02-02 20:42:14 -0800 | [diff] [blame] | 4402 | typedef enum { |
| 4403 | google_protobuf_MethodOptions_IDEMPOTENCY_UNKNOWN = 0, |
| 4404 | google_protobuf_MethodOptions_NO_SIDE_EFFECTS = 1, |
| 4405 | google_protobuf_MethodOptions_IDEMPOTENT = 2 |
| 4406 | } google_protobuf_MethodOptions_IdempotencyLevel; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4407 | |
Mike Kruskal | ccbdaa7 | 2023-02-02 20:42:14 -0800 | [diff] [blame] | 4408 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4409 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4410 | /* google.protobuf.FileDescriptorSet */ |
| 4411 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4412 | UPB_INLINE google_protobuf_FileDescriptorSet* google_protobuf_FileDescriptorSet_new(upb_Arena* arena) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 4413 | 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] | 4414 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4415 | UPB_INLINE google_protobuf_FileDescriptorSet* google_protobuf_FileDescriptorSet_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 4416 | google_protobuf_FileDescriptorSet* ret = google_protobuf_FileDescriptorSet_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 4417 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 4418 | 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] | 4419 | return NULL; |
| 4420 | } |
| 4421 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4422 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4423 | UPB_INLINE google_protobuf_FileDescriptorSet* google_protobuf_FileDescriptorSet_parse_ex(const char* buf, size_t size, |
| 4424 | const upb_ExtensionRegistry* extreg, |
| 4425 | int options, upb_Arena* arena) { |
| 4426 | google_protobuf_FileDescriptorSet* ret = google_protobuf_FileDescriptorSet_new(arena); |
| 4427 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 4428 | 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] | 4429 | kUpb_DecodeStatus_Ok) { |
| 4430 | return NULL; |
| 4431 | } |
| 4432 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4433 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4434 | 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] | 4435 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 4436 | (void)upb_Encode(msg, &google__protobuf__FileDescriptorSet_msg_init, 0, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4437 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4438 | } |
| 4439 | UPB_INLINE char* google_protobuf_FileDescriptorSet_serialize_ex(const google_protobuf_FileDescriptorSet* msg, int options, |
| 4440 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4441 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 4442 | (void)upb_Encode(msg, &google__protobuf__FileDescriptorSet_msg_init, options, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4443 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4444 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4445 | UPB_INLINE void google_protobuf_FileDescriptorSet_clear_file(google_protobuf_FileDescriptorSet* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4446 | 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] | 4447 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4448 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4449 | 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] | 4450 | 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] | 4451 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4452 | if (arr) { |
| 4453 | if (size) *size = arr->size; |
| 4454 | return (const google_protobuf_FileDescriptorProto* const*)_upb_array_constptr(arr); |
| 4455 | } else { |
| 4456 | if (size) *size = 0; |
| 4457 | return NULL; |
| 4458 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4459 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 4460 | 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] | 4461 | 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] | 4462 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4463 | if (size) { |
| 4464 | *size = arr ? arr->size : 0; |
| 4465 | } |
| 4466 | return arr; |
| 4467 | } |
| 4468 | 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] | 4469 | 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] | 4470 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 4471 | (upb_Message*)msg, &field, arena); |
| 4472 | if (size) { |
| 4473 | *size = arr ? arr->size : 0; |
| 4474 | } |
| 4475 | return arr; |
| 4476 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4477 | UPB_INLINE bool google_protobuf_FileDescriptorSet_has_file(const google_protobuf_FileDescriptorSet* msg) { |
| 4478 | size_t size; |
| 4479 | google_protobuf_FileDescriptorSet_file(msg, &size); |
| 4480 | return size != 0; |
| 4481 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4482 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4483 | 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] | 4484 | 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] | 4485 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 4486 | if (arr) { |
| 4487 | if (size) *size = arr->size; |
| 4488 | return (google_protobuf_FileDescriptorProto**)_upb_array_ptr(arr); |
| 4489 | } else { |
| 4490 | if (size) *size = 0; |
| 4491 | return NULL; |
| 4492 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4493 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4494 | 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] | 4495 | 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] | 4496 | return (google_protobuf_FileDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4497 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4498 | 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] | 4499 | 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] | 4500 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 4501 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 4502 | return NULL; |
| 4503 | } |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 4504 | 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] | 4505 | if (!arr || !sub) return NULL; |
| 4506 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4507 | return sub; |
| 4508 | } |
| 4509 | |
| 4510 | /* google.protobuf.FileDescriptorProto */ |
| 4511 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4512 | UPB_INLINE google_protobuf_FileDescriptorProto* google_protobuf_FileDescriptorProto_new(upb_Arena* arena) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 4513 | 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] | 4514 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4515 | UPB_INLINE google_protobuf_FileDescriptorProto* google_protobuf_FileDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 4516 | google_protobuf_FileDescriptorProto* ret = google_protobuf_FileDescriptorProto_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 4517 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 4518 | 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] | 4519 | return NULL; |
| 4520 | } |
| 4521 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4522 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4523 | UPB_INLINE google_protobuf_FileDescriptorProto* google_protobuf_FileDescriptorProto_parse_ex(const char* buf, size_t size, |
| 4524 | const upb_ExtensionRegistry* extreg, |
| 4525 | int options, upb_Arena* arena) { |
| 4526 | google_protobuf_FileDescriptorProto* ret = google_protobuf_FileDescriptorProto_new(arena); |
| 4527 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 4528 | 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] | 4529 | kUpb_DecodeStatus_Ok) { |
| 4530 | return NULL; |
| 4531 | } |
| 4532 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4533 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4534 | 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] | 4535 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 4536 | (void)upb_Encode(msg, &google__protobuf__FileDescriptorProto_msg_init, 0, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4537 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4538 | } |
| 4539 | UPB_INLINE char* google_protobuf_FileDescriptorProto_serialize_ex(const google_protobuf_FileDescriptorProto* msg, int options, |
| 4540 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4541 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 4542 | (void)upb_Encode(msg, &google__protobuf__FileDescriptorProto_msg_init, options, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4543 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4544 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4545 | 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] | 4546 | 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] | 4547 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4548 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4549 | 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] | 4550 | upb_StringView default_val = upb_StringView_FromString(""); |
| 4551 | upb_StringView ret; |
Protobuf Team Bot | 0e484c7 | 2023-09-06 19:28:27 +0000 | [diff] [blame] | 4552 | 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] | 4553 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 4554 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4555 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4556 | 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] | 4557 | 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] | 4558 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4559 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4560 | 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] | 4561 | 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] | 4562 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4563 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4564 | 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] | 4565 | upb_StringView default_val = upb_StringView_FromString(""); |
| 4566 | upb_StringView ret; |
Protobuf Team Bot | 0e484c7 | 2023-09-06 19:28:27 +0000 | [diff] [blame] | 4567 | 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] | 4568 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 4569 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4570 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4571 | 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] | 4572 | 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] | 4573 | return _upb_Message_HasNonExtensionField(msg, &field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4574 | } |
| 4575 | UPB_INLINE void google_protobuf_FileDescriptorProto_clear_dependency(google_protobuf_FileDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4576 | 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] | 4577 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4578 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4579 | 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] | 4580 | 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] | 4581 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4582 | if (arr) { |
| 4583 | if (size) *size = arr->size; |
| 4584 | return (upb_StringView const*)_upb_array_constptr(arr); |
| 4585 | } else { |
| 4586 | if (size) *size = 0; |
| 4587 | return NULL; |
| 4588 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4589 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 4590 | 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] | 4591 | 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] | 4592 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4593 | if (size) { |
| 4594 | *size = arr ? arr->size : 0; |
| 4595 | } |
| 4596 | return arr; |
| 4597 | } |
| 4598 | 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] | 4599 | 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] | 4600 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 4601 | (upb_Message*)msg, &field, arena); |
| 4602 | if (size) { |
| 4603 | *size = arr ? arr->size : 0; |
| 4604 | } |
| 4605 | return arr; |
| 4606 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4607 | UPB_INLINE bool google_protobuf_FileDescriptorProto_has_dependency(const google_protobuf_FileDescriptorProto* msg) { |
| 4608 | size_t size; |
| 4609 | google_protobuf_FileDescriptorProto_dependency(msg, &size); |
| 4610 | return size != 0; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4611 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4612 | 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] | 4613 | 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] | 4614 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4615 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4616 | 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] | 4617 | 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] | 4618 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4619 | if (arr) { |
| 4620 | if (size) *size = arr->size; |
| 4621 | return (const google_protobuf_DescriptorProto* const*)_upb_array_constptr(arr); |
| 4622 | } else { |
| 4623 | if (size) *size = 0; |
| 4624 | return NULL; |
| 4625 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4626 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 4627 | 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] | 4628 | 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] | 4629 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4630 | if (size) { |
| 4631 | *size = arr ? arr->size : 0; |
| 4632 | } |
| 4633 | return arr; |
| 4634 | } |
| 4635 | 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] | 4636 | 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] | 4637 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 4638 | (upb_Message*)msg, &field, arena); |
| 4639 | if (size) { |
| 4640 | *size = arr ? arr->size : 0; |
| 4641 | } |
| 4642 | return arr; |
| 4643 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4644 | UPB_INLINE bool google_protobuf_FileDescriptorProto_has_message_type(const google_protobuf_FileDescriptorProto* msg) { |
| 4645 | size_t size; |
| 4646 | google_protobuf_FileDescriptorProto_message_type(msg, &size); |
| 4647 | return size != 0; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4648 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4649 | 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] | 4650 | 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] | 4651 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4652 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4653 | 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] | 4654 | 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] | 4655 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4656 | if (arr) { |
| 4657 | if (size) *size = arr->size; |
| 4658 | return (const google_protobuf_EnumDescriptorProto* const*)_upb_array_constptr(arr); |
| 4659 | } else { |
| 4660 | if (size) *size = 0; |
| 4661 | return NULL; |
| 4662 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4663 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 4664 | 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] | 4665 | 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] | 4666 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4667 | if (size) { |
| 4668 | *size = arr ? arr->size : 0; |
| 4669 | } |
| 4670 | return arr; |
| 4671 | } |
| 4672 | 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] | 4673 | 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] | 4674 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 4675 | (upb_Message*)msg, &field, arena); |
| 4676 | if (size) { |
| 4677 | *size = arr ? arr->size : 0; |
| 4678 | } |
| 4679 | return arr; |
| 4680 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4681 | UPB_INLINE bool google_protobuf_FileDescriptorProto_has_enum_type(const google_protobuf_FileDescriptorProto* msg) { |
| 4682 | size_t size; |
| 4683 | google_protobuf_FileDescriptorProto_enum_type(msg, &size); |
| 4684 | return size != 0; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4685 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4686 | UPB_INLINE void google_protobuf_FileDescriptorProto_clear_service(google_protobuf_FileDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4687 | 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] | 4688 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4689 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4690 | 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] | 4691 | 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] | 4692 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4693 | if (arr) { |
| 4694 | if (size) *size = arr->size; |
| 4695 | return (const google_protobuf_ServiceDescriptorProto* const*)_upb_array_constptr(arr); |
| 4696 | } else { |
| 4697 | if (size) *size = 0; |
| 4698 | return NULL; |
| 4699 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4700 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 4701 | 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] | 4702 | 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] | 4703 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4704 | if (size) { |
| 4705 | *size = arr ? arr->size : 0; |
| 4706 | } |
| 4707 | return arr; |
| 4708 | } |
| 4709 | 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] | 4710 | 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] | 4711 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 4712 | (upb_Message*)msg, &field, arena); |
| 4713 | if (size) { |
| 4714 | *size = arr ? arr->size : 0; |
| 4715 | } |
| 4716 | return arr; |
| 4717 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4718 | UPB_INLINE bool google_protobuf_FileDescriptorProto_has_service(const google_protobuf_FileDescriptorProto* msg) { |
| 4719 | size_t size; |
| 4720 | google_protobuf_FileDescriptorProto_service(msg, &size); |
| 4721 | return size != 0; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4722 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4723 | UPB_INLINE void google_protobuf_FileDescriptorProto_clear_extension(google_protobuf_FileDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4724 | 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] | 4725 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4726 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4727 | 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] | 4728 | 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] | 4729 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4730 | if (arr) { |
| 4731 | if (size) *size = arr->size; |
| 4732 | return (const google_protobuf_FieldDescriptorProto* const*)_upb_array_constptr(arr); |
| 4733 | } else { |
| 4734 | if (size) *size = 0; |
| 4735 | return NULL; |
| 4736 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4737 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 4738 | 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] | 4739 | 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] | 4740 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4741 | if (size) { |
| 4742 | *size = arr ? arr->size : 0; |
| 4743 | } |
| 4744 | return arr; |
| 4745 | } |
| 4746 | 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] | 4747 | 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] | 4748 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 4749 | (upb_Message*)msg, &field, arena); |
| 4750 | if (size) { |
| 4751 | *size = arr ? arr->size : 0; |
| 4752 | } |
| 4753 | return arr; |
| 4754 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4755 | UPB_INLINE bool google_protobuf_FileDescriptorProto_has_extension(const google_protobuf_FileDescriptorProto* msg) { |
| 4756 | size_t size; |
| 4757 | google_protobuf_FileDescriptorProto_extension(msg, &size); |
| 4758 | return size != 0; |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4759 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4760 | UPB_INLINE void google_protobuf_FileDescriptorProto_clear_options(google_protobuf_FileDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4761 | 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] | 4762 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4763 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4764 | 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] | 4765 | const google_protobuf_FileOptions* default_val = NULL; |
| 4766 | const google_protobuf_FileOptions* ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4767 | 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] | 4768 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 4769 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4770 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4771 | 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] | 4772 | 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] | 4773 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4774 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4775 | 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] | 4776 | 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] | 4777 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4778 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4779 | 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] | 4780 | const google_protobuf_SourceCodeInfo* default_val = NULL; |
| 4781 | const google_protobuf_SourceCodeInfo* ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4782 | 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] | 4783 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 4784 | return ret; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4785 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4786 | 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] | 4787 | 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] | 4788 | return _upb_Message_HasNonExtensionField(msg, &field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4789 | } |
| 4790 | 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] | 4791 | 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] | 4792 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4793 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4794 | 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] | 4795 | 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] | 4796 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4797 | if (arr) { |
| 4798 | if (size) *size = arr->size; |
| 4799 | return (int32_t const*)_upb_array_constptr(arr); |
| 4800 | } else { |
| 4801 | if (size) *size = 0; |
| 4802 | return NULL; |
| 4803 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4804 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 4805 | 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] | 4806 | 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] | 4807 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4808 | if (size) { |
| 4809 | *size = arr ? arr->size : 0; |
| 4810 | } |
| 4811 | return arr; |
| 4812 | } |
| 4813 | 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] | 4814 | 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] | 4815 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 4816 | (upb_Message*)msg, &field, arena); |
| 4817 | if (size) { |
| 4818 | *size = arr ? arr->size : 0; |
| 4819 | } |
| 4820 | return arr; |
| 4821 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4822 | UPB_INLINE bool google_protobuf_FileDescriptorProto_has_public_dependency(const google_protobuf_FileDescriptorProto* msg) { |
| 4823 | size_t size; |
| 4824 | google_protobuf_FileDescriptorProto_public_dependency(msg, &size); |
| 4825 | return size != 0; |
| 4826 | } |
| 4827 | 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] | 4828 | 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] | 4829 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4830 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4831 | 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] | 4832 | 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] | 4833 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4834 | if (arr) { |
| 4835 | if (size) *size = arr->size; |
| 4836 | return (int32_t const*)_upb_array_constptr(arr); |
| 4837 | } else { |
| 4838 | if (size) *size = 0; |
| 4839 | return NULL; |
| 4840 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4841 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 4842 | 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] | 4843 | 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] | 4844 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4845 | if (size) { |
| 4846 | *size = arr ? arr->size : 0; |
| 4847 | } |
| 4848 | return arr; |
| 4849 | } |
| 4850 | 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] | 4851 | 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] | 4852 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 4853 | (upb_Message*)msg, &field, arena); |
| 4854 | if (size) { |
| 4855 | *size = arr ? arr->size : 0; |
| 4856 | } |
| 4857 | return arr; |
| 4858 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4859 | UPB_INLINE bool google_protobuf_FileDescriptorProto_has_weak_dependency(const google_protobuf_FileDescriptorProto* msg) { |
| 4860 | size_t size; |
| 4861 | google_protobuf_FileDescriptorProto_weak_dependency(msg, &size); |
| 4862 | return size != 0; |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4863 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4864 | 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] | 4865 | 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] | 4866 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4867 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4868 | 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] | 4869 | upb_StringView default_val = upb_StringView_FromString(""); |
| 4870 | upb_StringView ret; |
Protobuf Team Bot | 0e484c7 | 2023-09-06 19:28:27 +0000 | [diff] [blame] | 4871 | 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] | 4872 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 4873 | return ret; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4874 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4875 | 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] | 4876 | 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] | 4877 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4878 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4879 | UPB_INLINE void google_protobuf_FileDescriptorProto_clear_edition(google_protobuf_FileDescriptorProto* msg) { |
Protobuf Team Bot | ab58f8f | 2023-09-26 16:14:19 +0000 | [diff] [blame] | 4880 | const upb_MiniTableField field = {14, UPB_SIZE(40, 4), 6, 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] | 4881 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4882 | } |
Protobuf Team Bot | ab58f8f | 2023-09-26 16:14:19 +0000 | [diff] [blame] | 4883 | UPB_INLINE int32_t google_protobuf_FileDescriptorProto_edition(const google_protobuf_FileDescriptorProto* msg) { |
| 4884 | int32_t default_val = 0; |
| 4885 | int32_t ret; |
| 4886 | const upb_MiniTableField field = {14, UPB_SIZE(40, 4), 6, 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] | 4887 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 4888 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4889 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4890 | UPB_INLINE bool google_protobuf_FileDescriptorProto_has_edition(const google_protobuf_FileDescriptorProto* msg) { |
Protobuf Team Bot | ab58f8f | 2023-09-26 16:14:19 +0000 | [diff] [blame] | 4891 | const upb_MiniTableField field = {14, UPB_SIZE(40, 4), 6, 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] | 4892 | return _upb_Message_HasNonExtensionField(msg, &field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4893 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4894 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4895 | 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] | 4896 | 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] | 4897 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 4898 | } |
| 4899 | 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] | 4900 | 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] | 4901 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 4902 | } |
| 4903 | 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] | 4904 | 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] | 4905 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 4906 | if (arr) { |
| 4907 | if (size) *size = arr->size; |
| 4908 | return (upb_StringView*)_upb_array_ptr(arr); |
| 4909 | } else { |
| 4910 | if (size) *size = 0; |
| 4911 | return NULL; |
| 4912 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4913 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4914 | 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] | 4915 | 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] | 4916 | return (upb_StringView*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4917 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4918 | 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] | 4919 | 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] | 4920 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 4921 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 4922 | return false; |
| 4923 | } |
| 4924 | _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val)); |
| 4925 | return true; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4926 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4927 | 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] | 4928 | 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] | 4929 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 4930 | if (arr) { |
| 4931 | if (size) *size = arr->size; |
| 4932 | return (google_protobuf_DescriptorProto**)_upb_array_ptr(arr); |
| 4933 | } else { |
| 4934 | if (size) *size = 0; |
| 4935 | return NULL; |
| 4936 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4937 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4938 | 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] | 4939 | 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] | 4940 | return (google_protobuf_DescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4941 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4942 | 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] | 4943 | 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] | 4944 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 4945 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 4946 | return NULL; |
| 4947 | } |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 4948 | 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] | 4949 | if (!arr || !sub) return NULL; |
| 4950 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4951 | return sub; |
| 4952 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4953 | 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] | 4954 | 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] | 4955 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 4956 | if (arr) { |
| 4957 | if (size) *size = arr->size; |
| 4958 | return (google_protobuf_EnumDescriptorProto**)_upb_array_ptr(arr); |
| 4959 | } else { |
| 4960 | if (size) *size = 0; |
| 4961 | return NULL; |
| 4962 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4963 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4964 | 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] | 4965 | 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] | 4966 | return (google_protobuf_EnumDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4967 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4968 | 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] | 4969 | 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] | 4970 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 4971 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 4972 | return NULL; |
| 4973 | } |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 4974 | 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] | 4975 | if (!arr || !sub) return NULL; |
| 4976 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4977 | return sub; |
| 4978 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4979 | 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] | 4980 | 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] | 4981 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 4982 | if (arr) { |
| 4983 | if (size) *size = arr->size; |
| 4984 | return (google_protobuf_ServiceDescriptorProto**)_upb_array_ptr(arr); |
| 4985 | } else { |
| 4986 | if (size) *size = 0; |
| 4987 | return NULL; |
| 4988 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4989 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4990 | 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] | 4991 | 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] | 4992 | return (google_protobuf_ServiceDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4993 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4994 | 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] | 4995 | 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] | 4996 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 4997 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 4998 | return NULL; |
| 4999 | } |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 5000 | 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] | 5001 | if (!arr || !sub) return NULL; |
| 5002 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5003 | return sub; |
| 5004 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5005 | 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] | 5006 | 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] | 5007 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 5008 | if (arr) { |
| 5009 | if (size) *size = arr->size; |
| 5010 | return (google_protobuf_FieldDescriptorProto**)_upb_array_ptr(arr); |
| 5011 | } else { |
| 5012 | if (size) *size = 0; |
| 5013 | return NULL; |
| 5014 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5015 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5016 | 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] | 5017 | 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] | 5018 | return (google_protobuf_FieldDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5019 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5020 | 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] | 5021 | 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] | 5022 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 5023 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 5024 | return NULL; |
| 5025 | } |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 5026 | 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] | 5027 | if (!arr || !sub) return NULL; |
| 5028 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5029 | return sub; |
| 5030 | } |
| 5031 | 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] | 5032 | 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] | 5033 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 5034 | } |
| 5035 | 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] | 5036 | struct google_protobuf_FileOptions* sub = (struct google_protobuf_FileOptions*)google_protobuf_FileDescriptorProto_options(msg); |
| 5037 | if (sub == NULL) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 5038 | 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] | 5039 | if (sub) google_protobuf_FileDescriptorProto_set_options(msg, sub); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5040 | } |
| 5041 | return sub; |
| 5042 | } |
| 5043 | 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] | 5044 | 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] | 5045 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 5046 | } |
| 5047 | 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] | 5048 | struct google_protobuf_SourceCodeInfo* sub = (struct google_protobuf_SourceCodeInfo*)google_protobuf_FileDescriptorProto_source_code_info(msg); |
| 5049 | if (sub == NULL) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 5050 | 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] | 5051 | if (sub) google_protobuf_FileDescriptorProto_set_source_code_info(msg, sub); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5052 | } |
| 5053 | return sub; |
| 5054 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5055 | 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] | 5056 | 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] | 5057 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 5058 | if (arr) { |
| 5059 | if (size) *size = arr->size; |
| 5060 | return (int32_t*)_upb_array_ptr(arr); |
| 5061 | } else { |
| 5062 | if (size) *size = 0; |
| 5063 | return NULL; |
| 5064 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5065 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5066 | 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] | 5067 | 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] | 5068 | return (int32_t*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5069 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5070 | 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] | 5071 | 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] | 5072 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 5073 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 5074 | return false; |
| 5075 | } |
| 5076 | _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val)); |
| 5077 | return true; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5078 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5079 | 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] | 5080 | 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] | 5081 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 5082 | if (arr) { |
| 5083 | if (size) *size = arr->size; |
| 5084 | return (int32_t*)_upb_array_ptr(arr); |
| 5085 | } else { |
| 5086 | if (size) *size = 0; |
| 5087 | return NULL; |
| 5088 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5089 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5090 | 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] | 5091 | 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] | 5092 | return (int32_t*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5093 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5094 | 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] | 5095 | 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] | 5096 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 5097 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 5098 | return false; |
| 5099 | } |
| 5100 | _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val)); |
| 5101 | return true; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5102 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5103 | 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] | 5104 | 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] | 5105 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 5106 | } |
Protobuf Team Bot | ab58f8f | 2023-09-26 16:14:19 +0000 | [diff] [blame] | 5107 | UPB_INLINE void google_protobuf_FileDescriptorProto_set_edition(google_protobuf_FileDescriptorProto *msg, int32_t value) { |
| 5108 | const upb_MiniTableField field = {14, UPB_SIZE(40, 4), 6, 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] | 5109 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5110 | } |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 5111 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5112 | /* google.protobuf.DescriptorProto */ |
| 5113 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5114 | UPB_INLINE google_protobuf_DescriptorProto* google_protobuf_DescriptorProto_new(upb_Arena* arena) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 5115 | 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] | 5116 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5117 | UPB_INLINE google_protobuf_DescriptorProto* google_protobuf_DescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 5118 | google_protobuf_DescriptorProto* ret = google_protobuf_DescriptorProto_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 5119 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 5120 | 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] | 5121 | return NULL; |
| 5122 | } |
| 5123 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5124 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5125 | UPB_INLINE google_protobuf_DescriptorProto* google_protobuf_DescriptorProto_parse_ex(const char* buf, size_t size, |
| 5126 | const upb_ExtensionRegistry* extreg, |
| 5127 | int options, upb_Arena* arena) { |
| 5128 | google_protobuf_DescriptorProto* ret = google_protobuf_DescriptorProto_new(arena); |
| 5129 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 5130 | 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] | 5131 | kUpb_DecodeStatus_Ok) { |
| 5132 | return NULL; |
| 5133 | } |
| 5134 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5135 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5136 | 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] | 5137 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 5138 | (void)upb_Encode(msg, &google__protobuf__DescriptorProto_msg_init, 0, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5139 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5140 | } |
| 5141 | UPB_INLINE char* google_protobuf_DescriptorProto_serialize_ex(const google_protobuf_DescriptorProto* msg, int options, |
| 5142 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5143 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 5144 | (void)upb_Encode(msg, &google__protobuf__DescriptorProto_msg_init, options, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5145 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5146 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5147 | UPB_INLINE void google_protobuf_DescriptorProto_clear_name(google_protobuf_DescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5148 | 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] | 5149 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5150 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5151 | 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] | 5152 | upb_StringView default_val = upb_StringView_FromString(""); |
| 5153 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5154 | 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] | 5155 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 5156 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5157 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5158 | 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] | 5159 | 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] | 5160 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5161 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5162 | UPB_INLINE void google_protobuf_DescriptorProto_clear_field(google_protobuf_DescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5163 | 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] | 5164 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5165 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5166 | 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] | 5167 | 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] | 5168 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 5169 | if (arr) { |
| 5170 | if (size) *size = arr->size; |
| 5171 | return (const google_protobuf_FieldDescriptorProto* const*)_upb_array_constptr(arr); |
| 5172 | } else { |
| 5173 | if (size) *size = 0; |
| 5174 | return NULL; |
| 5175 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5176 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 5177 | 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] | 5178 | 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] | 5179 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 5180 | if (size) { |
| 5181 | *size = arr ? arr->size : 0; |
| 5182 | } |
| 5183 | return arr; |
| 5184 | } |
| 5185 | 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] | 5186 | 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] | 5187 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 5188 | (upb_Message*)msg, &field, arena); |
| 5189 | if (size) { |
| 5190 | *size = arr ? arr->size : 0; |
| 5191 | } |
| 5192 | return arr; |
| 5193 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5194 | UPB_INLINE bool google_protobuf_DescriptorProto_has_field(const google_protobuf_DescriptorProto* msg) { |
| 5195 | size_t size; |
| 5196 | google_protobuf_DescriptorProto_field(msg, &size); |
| 5197 | return size != 0; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5198 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5199 | 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] | 5200 | 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] | 5201 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5202 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5203 | 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] | 5204 | 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] | 5205 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 5206 | if (arr) { |
| 5207 | if (size) *size = arr->size; |
| 5208 | return (const google_protobuf_DescriptorProto* const*)_upb_array_constptr(arr); |
| 5209 | } else { |
| 5210 | if (size) *size = 0; |
| 5211 | return NULL; |
| 5212 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5213 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 5214 | 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] | 5215 | 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] | 5216 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 5217 | if (size) { |
| 5218 | *size = arr ? arr->size : 0; |
| 5219 | } |
| 5220 | return arr; |
| 5221 | } |
| 5222 | 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] | 5223 | 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] | 5224 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 5225 | (upb_Message*)msg, &field, arena); |
| 5226 | if (size) { |
| 5227 | *size = arr ? arr->size : 0; |
| 5228 | } |
| 5229 | return arr; |
| 5230 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5231 | UPB_INLINE bool google_protobuf_DescriptorProto_has_nested_type(const google_protobuf_DescriptorProto* msg) { |
| 5232 | size_t size; |
| 5233 | google_protobuf_DescriptorProto_nested_type(msg, &size); |
| 5234 | return size != 0; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5235 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5236 | 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] | 5237 | 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] | 5238 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5239 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5240 | 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] | 5241 | 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] | 5242 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 5243 | if (arr) { |
| 5244 | if (size) *size = arr->size; |
| 5245 | return (const google_protobuf_EnumDescriptorProto* const*)_upb_array_constptr(arr); |
| 5246 | } else { |
| 5247 | if (size) *size = 0; |
| 5248 | return NULL; |
| 5249 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5250 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 5251 | 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] | 5252 | 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] | 5253 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 5254 | if (size) { |
| 5255 | *size = arr ? arr->size : 0; |
| 5256 | } |
| 5257 | return arr; |
| 5258 | } |
| 5259 | 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] | 5260 | 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] | 5261 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 5262 | (upb_Message*)msg, &field, arena); |
| 5263 | if (size) { |
| 5264 | *size = arr ? arr->size : 0; |
| 5265 | } |
| 5266 | return arr; |
| 5267 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5268 | UPB_INLINE bool google_protobuf_DescriptorProto_has_enum_type(const google_protobuf_DescriptorProto* msg) { |
| 5269 | size_t size; |
| 5270 | google_protobuf_DescriptorProto_enum_type(msg, &size); |
| 5271 | return size != 0; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5272 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5273 | 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] | 5274 | 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] | 5275 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5276 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5277 | 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] | 5278 | 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] | 5279 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 5280 | if (arr) { |
| 5281 | if (size) *size = arr->size; |
| 5282 | return (const google_protobuf_DescriptorProto_ExtensionRange* const*)_upb_array_constptr(arr); |
| 5283 | } else { |
| 5284 | if (size) *size = 0; |
| 5285 | return NULL; |
| 5286 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5287 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 5288 | 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] | 5289 | 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] | 5290 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 5291 | if (size) { |
| 5292 | *size = arr ? arr->size : 0; |
| 5293 | } |
| 5294 | return arr; |
| 5295 | } |
| 5296 | 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] | 5297 | 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] | 5298 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 5299 | (upb_Message*)msg, &field, arena); |
| 5300 | if (size) { |
| 5301 | *size = arr ? arr->size : 0; |
| 5302 | } |
| 5303 | return arr; |
| 5304 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5305 | UPB_INLINE bool google_protobuf_DescriptorProto_has_extension_range(const google_protobuf_DescriptorProto* msg) { |
| 5306 | size_t size; |
| 5307 | google_protobuf_DescriptorProto_extension_range(msg, &size); |
| 5308 | return size != 0; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5309 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5310 | UPB_INLINE void google_protobuf_DescriptorProto_clear_extension(google_protobuf_DescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5311 | 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] | 5312 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5313 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5314 | 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] | 5315 | 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] | 5316 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 5317 | if (arr) { |
| 5318 | if (size) *size = arr->size; |
| 5319 | return (const google_protobuf_FieldDescriptorProto* const*)_upb_array_constptr(arr); |
| 5320 | } else { |
| 5321 | if (size) *size = 0; |
| 5322 | return NULL; |
| 5323 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5324 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 5325 | 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] | 5326 | 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] | 5327 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 5328 | if (size) { |
| 5329 | *size = arr ? arr->size : 0; |
| 5330 | } |
| 5331 | return arr; |
| 5332 | } |
| 5333 | 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] | 5334 | 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] | 5335 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 5336 | (upb_Message*)msg, &field, arena); |
| 5337 | if (size) { |
| 5338 | *size = arr ? arr->size : 0; |
| 5339 | } |
| 5340 | return arr; |
| 5341 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5342 | UPB_INLINE bool google_protobuf_DescriptorProto_has_extension(const google_protobuf_DescriptorProto* msg) { |
| 5343 | size_t size; |
| 5344 | google_protobuf_DescriptorProto_extension(msg, &size); |
| 5345 | return size != 0; |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5346 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5347 | UPB_INLINE void google_protobuf_DescriptorProto_clear_options(google_protobuf_DescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5348 | 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] | 5349 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5350 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5351 | 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] | 5352 | const google_protobuf_MessageOptions* default_val = NULL; |
| 5353 | const google_protobuf_MessageOptions* ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5354 | 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] | 5355 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 5356 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5357 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5358 | 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] | 5359 | 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] | 5360 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5361 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5362 | 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] | 5363 | 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] | 5364 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5365 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5366 | 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] | 5367 | 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] | 5368 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 5369 | if (arr) { |
| 5370 | if (size) *size = arr->size; |
| 5371 | return (const google_protobuf_OneofDescriptorProto* const*)_upb_array_constptr(arr); |
| 5372 | } else { |
| 5373 | if (size) *size = 0; |
| 5374 | return NULL; |
| 5375 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5376 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 5377 | 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] | 5378 | 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] | 5379 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 5380 | if (size) { |
| 5381 | *size = arr ? arr->size : 0; |
| 5382 | } |
| 5383 | return arr; |
| 5384 | } |
| 5385 | 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] | 5386 | 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] | 5387 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 5388 | (upb_Message*)msg, &field, arena); |
| 5389 | if (size) { |
| 5390 | *size = arr ? arr->size : 0; |
| 5391 | } |
| 5392 | return arr; |
| 5393 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5394 | UPB_INLINE bool google_protobuf_DescriptorProto_has_oneof_decl(const google_protobuf_DescriptorProto* msg) { |
| 5395 | size_t size; |
| 5396 | google_protobuf_DescriptorProto_oneof_decl(msg, &size); |
| 5397 | return size != 0; |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5398 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5399 | 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] | 5400 | 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] | 5401 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5402 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5403 | 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] | 5404 | 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] | 5405 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 5406 | if (arr) { |
| 5407 | if (size) *size = arr->size; |
| 5408 | return (const google_protobuf_DescriptorProto_ReservedRange* const*)_upb_array_constptr(arr); |
| 5409 | } else { |
| 5410 | if (size) *size = 0; |
| 5411 | return NULL; |
| 5412 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5413 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 5414 | 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] | 5415 | 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] | 5416 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 5417 | if (size) { |
| 5418 | *size = arr ? arr->size : 0; |
| 5419 | } |
| 5420 | return arr; |
| 5421 | } |
| 5422 | 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] | 5423 | 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] | 5424 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 5425 | (upb_Message*)msg, &field, arena); |
| 5426 | if (size) { |
| 5427 | *size = arr ? arr->size : 0; |
| 5428 | } |
| 5429 | return arr; |
| 5430 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5431 | UPB_INLINE bool google_protobuf_DescriptorProto_has_reserved_range(const google_protobuf_DescriptorProto* msg) { |
| 5432 | size_t size; |
| 5433 | google_protobuf_DescriptorProto_reserved_range(msg, &size); |
| 5434 | return size != 0; |
| 5435 | } |
| 5436 | 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] | 5437 | 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] | 5438 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5439 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5440 | 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] | 5441 | 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] | 5442 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 5443 | if (arr) { |
| 5444 | if (size) *size = arr->size; |
| 5445 | return (upb_StringView const*)_upb_array_constptr(arr); |
| 5446 | } else { |
| 5447 | if (size) *size = 0; |
| 5448 | return NULL; |
| 5449 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5450 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 5451 | 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] | 5452 | 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] | 5453 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 5454 | if (size) { |
| 5455 | *size = arr ? arr->size : 0; |
| 5456 | } |
| 5457 | return arr; |
| 5458 | } |
| 5459 | 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] | 5460 | 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] | 5461 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 5462 | (upb_Message*)msg, &field, arena); |
| 5463 | if (size) { |
| 5464 | *size = arr ? arr->size : 0; |
| 5465 | } |
| 5466 | return arr; |
| 5467 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5468 | UPB_INLINE bool google_protobuf_DescriptorProto_has_reserved_name(const google_protobuf_DescriptorProto* msg) { |
| 5469 | size_t size; |
| 5470 | google_protobuf_DescriptorProto_reserved_name(msg, &size); |
| 5471 | return size != 0; |
| 5472 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5473 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5474 | 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] | 5475 | 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] | 5476 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 5477 | } |
| 5478 | 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] | 5479 | 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] | 5480 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 5481 | if (arr) { |
| 5482 | if (size) *size = arr->size; |
| 5483 | return (google_protobuf_FieldDescriptorProto**)_upb_array_ptr(arr); |
| 5484 | } else { |
| 5485 | if (size) *size = 0; |
| 5486 | return NULL; |
| 5487 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5488 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5489 | 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] | 5490 | 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] | 5491 | return (google_protobuf_FieldDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5492 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5493 | 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] | 5494 | 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] | 5495 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 5496 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 5497 | return NULL; |
| 5498 | } |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 5499 | 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] | 5500 | if (!arr || !sub) return NULL; |
| 5501 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5502 | return sub; |
| 5503 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5504 | 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] | 5505 | 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] | 5506 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 5507 | if (arr) { |
| 5508 | if (size) *size = arr->size; |
| 5509 | return (google_protobuf_DescriptorProto**)_upb_array_ptr(arr); |
| 5510 | } else { |
| 5511 | if (size) *size = 0; |
| 5512 | return NULL; |
| 5513 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5514 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5515 | 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] | 5516 | 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] | 5517 | return (google_protobuf_DescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5518 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5519 | 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] | 5520 | 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] | 5521 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 5522 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 5523 | return NULL; |
| 5524 | } |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 5525 | 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] | 5526 | if (!arr || !sub) return NULL; |
| 5527 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5528 | return sub; |
| 5529 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5530 | 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] | 5531 | 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] | 5532 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 5533 | if (arr) { |
| 5534 | if (size) *size = arr->size; |
| 5535 | return (google_protobuf_EnumDescriptorProto**)_upb_array_ptr(arr); |
| 5536 | } else { |
| 5537 | if (size) *size = 0; |
| 5538 | return NULL; |
| 5539 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5540 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5541 | 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] | 5542 | 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] | 5543 | return (google_protobuf_EnumDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5544 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5545 | 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] | 5546 | 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] | 5547 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 5548 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 5549 | return NULL; |
| 5550 | } |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 5551 | 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] | 5552 | if (!arr || !sub) return NULL; |
| 5553 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5554 | return sub; |
| 5555 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5556 | 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] | 5557 | 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] | 5558 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 5559 | if (arr) { |
| 5560 | if (size) *size = arr->size; |
| 5561 | return (google_protobuf_DescriptorProto_ExtensionRange**)_upb_array_ptr(arr); |
| 5562 | } else { |
| 5563 | if (size) *size = 0; |
| 5564 | return NULL; |
| 5565 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5566 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5567 | 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] | 5568 | 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] | 5569 | return (google_protobuf_DescriptorProto_ExtensionRange**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5570 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5571 | 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] | 5572 | 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] | 5573 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 5574 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 5575 | return NULL; |
| 5576 | } |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 5577 | 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] | 5578 | if (!arr || !sub) return NULL; |
| 5579 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5580 | return sub; |
| 5581 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5582 | 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] | 5583 | 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] | 5584 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 5585 | if (arr) { |
| 5586 | if (size) *size = arr->size; |
| 5587 | return (google_protobuf_FieldDescriptorProto**)_upb_array_ptr(arr); |
| 5588 | } else { |
| 5589 | if (size) *size = 0; |
| 5590 | return NULL; |
| 5591 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5592 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5593 | 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] | 5594 | 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] | 5595 | return (google_protobuf_FieldDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5596 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5597 | 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] | 5598 | 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] | 5599 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 5600 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 5601 | return NULL; |
| 5602 | } |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 5603 | 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] | 5604 | if (!arr || !sub) return NULL; |
| 5605 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5606 | return sub; |
| 5607 | } |
| 5608 | 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] | 5609 | 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] | 5610 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 5611 | } |
| 5612 | 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] | 5613 | struct google_protobuf_MessageOptions* sub = (struct google_protobuf_MessageOptions*)google_protobuf_DescriptorProto_options(msg); |
| 5614 | if (sub == NULL) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 5615 | 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] | 5616 | if (sub) google_protobuf_DescriptorProto_set_options(msg, sub); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5617 | } |
| 5618 | return sub; |
| 5619 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5620 | 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] | 5621 | 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] | 5622 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 5623 | if (arr) { |
| 5624 | if (size) *size = arr->size; |
| 5625 | return (google_protobuf_OneofDescriptorProto**)_upb_array_ptr(arr); |
| 5626 | } else { |
| 5627 | if (size) *size = 0; |
| 5628 | return NULL; |
| 5629 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5630 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5631 | 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] | 5632 | 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] | 5633 | return (google_protobuf_OneofDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5634 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5635 | 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] | 5636 | 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] | 5637 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 5638 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 5639 | return NULL; |
| 5640 | } |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 5641 | 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] | 5642 | if (!arr || !sub) return NULL; |
| 5643 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5644 | return sub; |
| 5645 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5646 | 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] | 5647 | 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] | 5648 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 5649 | if (arr) { |
| 5650 | if (size) *size = arr->size; |
| 5651 | return (google_protobuf_DescriptorProto_ReservedRange**)_upb_array_ptr(arr); |
| 5652 | } else { |
| 5653 | if (size) *size = 0; |
| 5654 | return NULL; |
| 5655 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5656 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5657 | 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] | 5658 | 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] | 5659 | return (google_protobuf_DescriptorProto_ReservedRange**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5660 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5661 | 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] | 5662 | 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] | 5663 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 5664 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 5665 | return NULL; |
| 5666 | } |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 5667 | 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] | 5668 | if (!arr || !sub) return NULL; |
| 5669 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5670 | return sub; |
| 5671 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5672 | 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] | 5673 | 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] | 5674 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 5675 | if (arr) { |
| 5676 | if (size) *size = arr->size; |
| 5677 | return (upb_StringView*)_upb_array_ptr(arr); |
| 5678 | } else { |
| 5679 | if (size) *size = 0; |
| 5680 | return NULL; |
| 5681 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5682 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5683 | 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] | 5684 | 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] | 5685 | return (upb_StringView*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5686 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5687 | 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] | 5688 | 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] | 5689 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 5690 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 5691 | return false; |
| 5692 | } |
| 5693 | _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val)); |
| 5694 | return true; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5695 | } |
| 5696 | |
| 5697 | /* google.protobuf.DescriptorProto.ExtensionRange */ |
| 5698 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5699 | UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange* google_protobuf_DescriptorProto_ExtensionRange_new(upb_Arena* arena) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 5700 | 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] | 5701 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5702 | UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange* google_protobuf_DescriptorProto_ExtensionRange_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 5703 | google_protobuf_DescriptorProto_ExtensionRange* ret = google_protobuf_DescriptorProto_ExtensionRange_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 5704 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 5705 | 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] | 5706 | return NULL; |
| 5707 | } |
| 5708 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5709 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5710 | UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange* google_protobuf_DescriptorProto_ExtensionRange_parse_ex(const char* buf, size_t size, |
| 5711 | const upb_ExtensionRegistry* extreg, |
| 5712 | int options, upb_Arena* arena) { |
| 5713 | google_protobuf_DescriptorProto_ExtensionRange* ret = google_protobuf_DescriptorProto_ExtensionRange_new(arena); |
| 5714 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 5715 | 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] | 5716 | kUpb_DecodeStatus_Ok) { |
| 5717 | return NULL; |
| 5718 | } |
| 5719 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5720 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5721 | 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] | 5722 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 5723 | (void)upb_Encode(msg, &google__protobuf__DescriptorProto__ExtensionRange_msg_init, 0, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5724 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5725 | } |
| 5726 | UPB_INLINE char* google_protobuf_DescriptorProto_ExtensionRange_serialize_ex(const google_protobuf_DescriptorProto_ExtensionRange* msg, int options, |
| 5727 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5728 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 5729 | (void)upb_Encode(msg, &google__protobuf__DescriptorProto__ExtensionRange_msg_init, options, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5730 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5731 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5732 | 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] | 5733 | 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] | 5734 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5735 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5736 | 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] | 5737 | int32_t default_val = (int32_t)0; |
| 5738 | int32_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5739 | 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] | 5740 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 5741 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5742 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5743 | 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] | 5744 | 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] | 5745 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5746 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5747 | 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] | 5748 | 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] | 5749 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5750 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5751 | 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] | 5752 | int32_t default_val = (int32_t)0; |
| 5753 | int32_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5754 | 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] | 5755 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 5756 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5757 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5758 | 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] | 5759 | 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] | 5760 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5761 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5762 | 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] | 5763 | 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] | 5764 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5765 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5766 | 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] | 5767 | const google_protobuf_ExtensionRangeOptions* default_val = NULL; |
| 5768 | const google_protobuf_ExtensionRangeOptions* ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5769 | 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] | 5770 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 5771 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5772 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5773 | 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] | 5774 | 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] | 5775 | return _upb_Message_HasNonExtensionField(msg, &field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5776 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5777 | |
| 5778 | 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] | 5779 | 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] | 5780 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 5781 | } |
| 5782 | 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] | 5783 | 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] | 5784 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 5785 | } |
| 5786 | 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] | 5787 | 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] | 5788 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 5789 | } |
| 5790 | 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] | 5791 | struct google_protobuf_ExtensionRangeOptions* sub = (struct google_protobuf_ExtensionRangeOptions*)google_protobuf_DescriptorProto_ExtensionRange_options(msg); |
| 5792 | if (sub == NULL) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 5793 | 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] | 5794 | if (sub) google_protobuf_DescriptorProto_ExtensionRange_set_options(msg, sub); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5795 | } |
| 5796 | return sub; |
| 5797 | } |
| 5798 | |
| 5799 | /* google.protobuf.DescriptorProto.ReservedRange */ |
| 5800 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5801 | UPB_INLINE google_protobuf_DescriptorProto_ReservedRange* google_protobuf_DescriptorProto_ReservedRange_new(upb_Arena* arena) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 5802 | 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] | 5803 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5804 | UPB_INLINE google_protobuf_DescriptorProto_ReservedRange* google_protobuf_DescriptorProto_ReservedRange_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 5805 | google_protobuf_DescriptorProto_ReservedRange* ret = google_protobuf_DescriptorProto_ReservedRange_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 5806 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 5807 | 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] | 5808 | return NULL; |
| 5809 | } |
| 5810 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5811 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5812 | UPB_INLINE google_protobuf_DescriptorProto_ReservedRange* google_protobuf_DescriptorProto_ReservedRange_parse_ex(const char* buf, size_t size, |
| 5813 | const upb_ExtensionRegistry* extreg, |
| 5814 | int options, upb_Arena* arena) { |
| 5815 | google_protobuf_DescriptorProto_ReservedRange* ret = google_protobuf_DescriptorProto_ReservedRange_new(arena); |
| 5816 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 5817 | 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] | 5818 | kUpb_DecodeStatus_Ok) { |
| 5819 | return NULL; |
| 5820 | } |
| 5821 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5822 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5823 | 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] | 5824 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 5825 | (void)upb_Encode(msg, &google__protobuf__DescriptorProto__ReservedRange_msg_init, 0, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5826 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5827 | } |
| 5828 | UPB_INLINE char* google_protobuf_DescriptorProto_ReservedRange_serialize_ex(const google_protobuf_DescriptorProto_ReservedRange* msg, int options, |
| 5829 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5830 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 5831 | (void)upb_Encode(msg, &google__protobuf__DescriptorProto__ReservedRange_msg_init, options, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5832 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5833 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5834 | 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] | 5835 | 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] | 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 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] | 5839 | int32_t default_val = (int32_t)0; |
| 5840 | int32_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5841 | 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] | 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_ReservedRange_has_start(const google_protobuf_DescriptorProto_ReservedRange* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5846 | 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] | 5847 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5848 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5849 | 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] | 5850 | 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] | 5851 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5852 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5853 | 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] | 5854 | int32_t default_val = (int32_t)0; |
| 5855 | int32_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5856 | 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] | 5857 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 5858 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5859 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5860 | 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] | 5861 | 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] | 5862 | return _upb_Message_HasNonExtensionField(msg, &field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5863 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5864 | |
| 5865 | 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] | 5866 | 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] | 5867 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 5868 | } |
| 5869 | 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] | 5870 | 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] | 5871 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5872 | } |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 5873 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5874 | /* google.protobuf.ExtensionRangeOptions */ |
| 5875 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5876 | UPB_INLINE google_protobuf_ExtensionRangeOptions* google_protobuf_ExtensionRangeOptions_new(upb_Arena* arena) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 5877 | 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] | 5878 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5879 | UPB_INLINE google_protobuf_ExtensionRangeOptions* google_protobuf_ExtensionRangeOptions_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 5880 | google_protobuf_ExtensionRangeOptions* ret = google_protobuf_ExtensionRangeOptions_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 5881 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 5882 | 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] | 5883 | return NULL; |
| 5884 | } |
| 5885 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5886 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5887 | UPB_INLINE google_protobuf_ExtensionRangeOptions* google_protobuf_ExtensionRangeOptions_parse_ex(const char* buf, size_t size, |
| 5888 | const upb_ExtensionRegistry* extreg, |
| 5889 | int options, upb_Arena* arena) { |
| 5890 | google_protobuf_ExtensionRangeOptions* ret = google_protobuf_ExtensionRangeOptions_new(arena); |
| 5891 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 5892 | 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] | 5893 | kUpb_DecodeStatus_Ok) { |
| 5894 | return NULL; |
| 5895 | } |
| 5896 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5897 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5898 | 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] | 5899 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 5900 | (void)upb_Encode(msg, &google__protobuf__ExtensionRangeOptions_msg_init, 0, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5901 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5902 | } |
| 5903 | UPB_INLINE char* google_protobuf_ExtensionRangeOptions_serialize_ex(const google_protobuf_ExtensionRangeOptions* msg, int options, |
| 5904 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5905 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 5906 | (void)upb_Encode(msg, &google__protobuf__ExtensionRangeOptions_msg_init, options, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5907 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5908 | } |
Mike Kruskal | 145900f | 2023-03-27 09:55:52 -0700 | [diff] [blame] | 5909 | UPB_INLINE void google_protobuf_ExtensionRangeOptions_clear_declaration(google_protobuf_ExtensionRangeOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5910 | 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] | 5911 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 5912 | } |
| 5913 | 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] | 5914 | 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] | 5915 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 5916 | if (arr) { |
| 5917 | if (size) *size = arr->size; |
| 5918 | return (const google_protobuf_ExtensionRangeOptions_Declaration* const*)_upb_array_constptr(arr); |
| 5919 | } else { |
| 5920 | if (size) *size = 0; |
| 5921 | return NULL; |
| 5922 | } |
| 5923 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 5924 | 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] | 5925 | 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] | 5926 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 5927 | if (size) { |
| 5928 | *size = arr ? arr->size : 0; |
| 5929 | } |
| 5930 | return arr; |
| 5931 | } |
| 5932 | 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] | 5933 | 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] | 5934 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 5935 | (upb_Message*)msg, &field, arena); |
| 5936 | if (size) { |
| 5937 | *size = arr ? arr->size : 0; |
| 5938 | } |
| 5939 | return arr; |
| 5940 | } |
Mike Kruskal | 145900f | 2023-03-27 09:55:52 -0700 | [diff] [blame] | 5941 | UPB_INLINE bool google_protobuf_ExtensionRangeOptions_has_declaration(const google_protobuf_ExtensionRangeOptions* msg) { |
| 5942 | size_t size; |
| 5943 | google_protobuf_ExtensionRangeOptions_declaration(msg, &size); |
| 5944 | return size != 0; |
| 5945 | } |
Protobuf Team Bot | 469f027 | 2023-04-21 18:12:45 -0700 | [diff] [blame] | 5946 | UPB_INLINE void google_protobuf_ExtensionRangeOptions_clear_verification(google_protobuf_ExtensionRangeOptions* msg) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 5947 | 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] | 5948 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 5949 | } |
| 5950 | UPB_INLINE int32_t google_protobuf_ExtensionRangeOptions_verification(const google_protobuf_ExtensionRangeOptions* msg) { |
| 5951 | int32_t default_val = 1; |
| 5952 | int32_t ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 5953 | 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] | 5954 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 5955 | return ret; |
| 5956 | } |
| 5957 | 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] | 5958 | const upb_MiniTableField field = {3, UPB_SIZE(8, 4), 1, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
| 5959 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 5960 | } |
| 5961 | UPB_INLINE void google_protobuf_ExtensionRangeOptions_clear_features(google_protobuf_ExtensionRangeOptions* msg) { |
| 5962 | 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)}; |
| 5963 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 5964 | } |
| 5965 | UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_ExtensionRangeOptions_features(const google_protobuf_ExtensionRangeOptions* msg) { |
| 5966 | const google_protobuf_FeatureSet* default_val = NULL; |
| 5967 | const google_protobuf_FeatureSet* ret; |
| 5968 | 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)}; |
| 5969 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 5970 | return ret; |
| 5971 | } |
| 5972 | UPB_INLINE bool google_protobuf_ExtensionRangeOptions_has_features(const google_protobuf_ExtensionRangeOptions* msg) { |
| 5973 | 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] | 5974 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 5975 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5976 | 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] | 5977 | 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] | 5978 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5979 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5980 | 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] | 5981 | 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] | 5982 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 5983 | if (arr) { |
| 5984 | if (size) *size = arr->size; |
| 5985 | return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr); |
| 5986 | } else { |
| 5987 | if (size) *size = 0; |
| 5988 | return NULL; |
| 5989 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5990 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 5991 | 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] | 5992 | 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] | 5993 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 5994 | if (size) { |
| 5995 | *size = arr ? arr->size : 0; |
| 5996 | } |
| 5997 | return arr; |
| 5998 | } |
| 5999 | 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] | 6000 | 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] | 6001 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 6002 | (upb_Message*)msg, &field, arena); |
| 6003 | if (size) { |
| 6004 | *size = arr ? arr->size : 0; |
| 6005 | } |
| 6006 | return arr; |
| 6007 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6008 | UPB_INLINE bool google_protobuf_ExtensionRangeOptions_has_uninterpreted_option(const google_protobuf_ExtensionRangeOptions* msg) { |
| 6009 | size_t size; |
| 6010 | google_protobuf_ExtensionRangeOptions_uninterpreted_option(msg, &size); |
| 6011 | return size != 0; |
| 6012 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6013 | |
Mike Kruskal | 145900f | 2023-03-27 09:55:52 -0700 | [diff] [blame] | 6014 | 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] | 6015 | 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] | 6016 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 6017 | if (arr) { |
| 6018 | if (size) *size = arr->size; |
| 6019 | return (google_protobuf_ExtensionRangeOptions_Declaration**)_upb_array_ptr(arr); |
| 6020 | } else { |
| 6021 | if (size) *size = 0; |
| 6022 | return NULL; |
| 6023 | } |
| 6024 | } |
| 6025 | 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] | 6026 | 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] | 6027 | return (google_protobuf_ExtensionRangeOptions_Declaration**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Mike Kruskal | 145900f | 2023-03-27 09:55:52 -0700 | [diff] [blame] | 6028 | } |
| 6029 | 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] | 6030 | 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] | 6031 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 6032 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 6033 | return NULL; |
| 6034 | } |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6035 | struct google_protobuf_ExtensionRangeOptions_Declaration* sub = (struct google_protobuf_ExtensionRangeOptions_Declaration*)_upb_Message_New(&google__protobuf__ExtensionRangeOptions__Declaration_msg_init, arena); |
Mike Kruskal | 145900f | 2023-03-27 09:55:52 -0700 | [diff] [blame] | 6036 | if (!arr || !sub) return NULL; |
| 6037 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
| 6038 | return sub; |
| 6039 | } |
Protobuf Team Bot | 469f027 | 2023-04-21 18:12:45 -0700 | [diff] [blame] | 6040 | 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] | 6041 | 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] | 6042 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 6043 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 6044 | UPB_INLINE void google_protobuf_ExtensionRangeOptions_set_features(google_protobuf_ExtensionRangeOptions *msg, google_protobuf_FeatureSet* value) { |
| 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)}; |
| 6046 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 6047 | } |
| 6048 | UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_ExtensionRangeOptions_mutable_features(google_protobuf_ExtensionRangeOptions* msg, upb_Arena* arena) { |
| 6049 | struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_ExtensionRangeOptions_features(msg); |
| 6050 | if (sub == NULL) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6051 | sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena); |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 6052 | if (sub) google_protobuf_ExtensionRangeOptions_set_features(msg, sub); |
| 6053 | } |
| 6054 | return sub; |
| 6055 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 6056 | 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] | 6057 | 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] | 6058 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 6059 | if (arr) { |
| 6060 | if (size) *size = arr->size; |
| 6061 | return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr); |
| 6062 | } else { |
| 6063 | if (size) *size = 0; |
| 6064 | return NULL; |
| 6065 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6066 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 6067 | 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] | 6068 | 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] | 6069 | return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6070 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6071 | 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] | 6072 | 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] | 6073 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 6074 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 6075 | return NULL; |
| 6076 | } |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6077 | 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] | 6078 | if (!arr || !sub) return NULL; |
| 6079 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6080 | return sub; |
| 6081 | } |
| 6082 | |
Mike Kruskal | 145900f | 2023-03-27 09:55:52 -0700 | [diff] [blame] | 6083 | /* google.protobuf.ExtensionRangeOptions.Declaration */ |
| 6084 | |
| 6085 | UPB_INLINE google_protobuf_ExtensionRangeOptions_Declaration* google_protobuf_ExtensionRangeOptions_Declaration_new(upb_Arena* arena) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6086 | return (google_protobuf_ExtensionRangeOptions_Declaration*)_upb_Message_New(&google__protobuf__ExtensionRangeOptions__Declaration_msg_init, arena); |
Mike Kruskal | 145900f | 2023-03-27 09:55:52 -0700 | [diff] [blame] | 6087 | } |
| 6088 | UPB_INLINE google_protobuf_ExtensionRangeOptions_Declaration* google_protobuf_ExtensionRangeOptions_Declaration_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 6089 | google_protobuf_ExtensionRangeOptions_Declaration* ret = google_protobuf_ExtensionRangeOptions_Declaration_new(arena); |
| 6090 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6091 | if (upb_Decode(buf, size, ret, &google__protobuf__ExtensionRangeOptions__Declaration_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { |
Mike Kruskal | 145900f | 2023-03-27 09:55:52 -0700 | [diff] [blame] | 6092 | return NULL; |
| 6093 | } |
| 6094 | return ret; |
| 6095 | } |
| 6096 | UPB_INLINE google_protobuf_ExtensionRangeOptions_Declaration* google_protobuf_ExtensionRangeOptions_Declaration_parse_ex(const char* buf, size_t size, |
| 6097 | const upb_ExtensionRegistry* extreg, |
| 6098 | int options, upb_Arena* arena) { |
| 6099 | google_protobuf_ExtensionRangeOptions_Declaration* ret = google_protobuf_ExtensionRangeOptions_Declaration_new(arena); |
| 6100 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6101 | if (upb_Decode(buf, size, ret, &google__protobuf__ExtensionRangeOptions__Declaration_msg_init, extreg, options, arena) != |
Mike Kruskal | 145900f | 2023-03-27 09:55:52 -0700 | [diff] [blame] | 6102 | kUpb_DecodeStatus_Ok) { |
| 6103 | return NULL; |
| 6104 | } |
| 6105 | return ret; |
| 6106 | } |
| 6107 | UPB_INLINE char* google_protobuf_ExtensionRangeOptions_Declaration_serialize(const google_protobuf_ExtensionRangeOptions_Declaration* msg, upb_Arena* arena, size_t* len) { |
| 6108 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6109 | (void)upb_Encode(msg, &google__protobuf__ExtensionRangeOptions__Declaration_msg_init, 0, arena, &ptr, len); |
Mike Kruskal | 145900f | 2023-03-27 09:55:52 -0700 | [diff] [blame] | 6110 | return ptr; |
| 6111 | } |
| 6112 | UPB_INLINE char* google_protobuf_ExtensionRangeOptions_Declaration_serialize_ex(const google_protobuf_ExtensionRangeOptions_Declaration* msg, int options, |
| 6113 | upb_Arena* arena, size_t* len) { |
| 6114 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6115 | (void)upb_Encode(msg, &google__protobuf__ExtensionRangeOptions__Declaration_msg_init, options, arena, &ptr, len); |
Mike Kruskal | 145900f | 2023-03-27 09:55:52 -0700 | [diff] [blame] | 6116 | return ptr; |
| 6117 | } |
| 6118 | 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] | 6119 | 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] | 6120 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 6121 | } |
| 6122 | UPB_INLINE int32_t google_protobuf_ExtensionRangeOptions_Declaration_number(const google_protobuf_ExtensionRangeOptions_Declaration* msg) { |
| 6123 | int32_t default_val = (int32_t)0; |
| 6124 | int32_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6125 | 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] | 6126 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 6127 | return ret; |
| 6128 | } |
| 6129 | 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] | 6130 | 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] | 6131 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 6132 | } |
| 6133 | 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] | 6134 | 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] | 6135 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 6136 | } |
| 6137 | UPB_INLINE upb_StringView google_protobuf_ExtensionRangeOptions_Declaration_full_name(const google_protobuf_ExtensionRangeOptions_Declaration* msg) { |
| 6138 | upb_StringView default_val = upb_StringView_FromString(""); |
| 6139 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6140 | 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] | 6141 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 6142 | return ret; |
| 6143 | } |
| 6144 | 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] | 6145 | 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] | 6146 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 6147 | } |
| 6148 | 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] | 6149 | 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] | 6150 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 6151 | } |
| 6152 | UPB_INLINE upb_StringView google_protobuf_ExtensionRangeOptions_Declaration_type(const google_protobuf_ExtensionRangeOptions_Declaration* msg) { |
| 6153 | upb_StringView default_val = upb_StringView_FromString(""); |
| 6154 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6155 | 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] | 6156 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 6157 | return ret; |
| 6158 | } |
| 6159 | 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] | 6160 | 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] | 6161 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 6162 | } |
Protobuf Team Bot | 41287bd | 2023-04-10 18:57:14 -0700 | [diff] [blame] | 6163 | 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] | 6164 | 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] | 6165 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 6166 | } |
| 6167 | UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_reserved(const google_protobuf_ExtensionRangeOptions_Declaration* msg) { |
| 6168 | bool default_val = false; |
| 6169 | bool ret; |
Sandy Zhang | 96c601d | 2023-07-05 12:39:20 -0700 | [diff] [blame] | 6170 | 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] | 6171 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 6172 | return ret; |
| 6173 | } |
| 6174 | 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] | 6175 | 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] | 6176 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 6177 | } |
Protobuf Team Bot | 469f027 | 2023-04-21 18:12:45 -0700 | [diff] [blame] | 6178 | 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] | 6179 | 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] | 6180 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 6181 | } |
| 6182 | UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_repeated(const google_protobuf_ExtensionRangeOptions_Declaration* msg) { |
| 6183 | bool default_val = false; |
| 6184 | bool ret; |
Sandy Zhang | 96c601d | 2023-07-05 12:39:20 -0700 | [diff] [blame] | 6185 | 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] | 6186 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 6187 | return ret; |
| 6188 | } |
| 6189 | 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] | 6190 | 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] | 6191 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 6192 | } |
Mike Kruskal | 145900f | 2023-03-27 09:55:52 -0700 | [diff] [blame] | 6193 | |
| 6194 | 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] | 6195 | 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] | 6196 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 6197 | } |
| 6198 | 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] | 6199 | 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] | 6200 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 6201 | } |
| 6202 | 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] | 6203 | 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] | 6204 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 6205 | } |
Protobuf Team Bot | 41287bd | 2023-04-10 18:57:14 -0700 | [diff] [blame] | 6206 | 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] | 6207 | 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] | 6208 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 6209 | } |
Protobuf Team Bot | 469f027 | 2023-04-21 18:12:45 -0700 | [diff] [blame] | 6210 | 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] | 6211 | 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] | 6212 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 6213 | } |
Mike Kruskal | 145900f | 2023-03-27 09:55:52 -0700 | [diff] [blame] | 6214 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6215 | /* google.protobuf.FieldDescriptorProto */ |
| 6216 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6217 | UPB_INLINE google_protobuf_FieldDescriptorProto* google_protobuf_FieldDescriptorProto_new(upb_Arena* arena) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6218 | 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] | 6219 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6220 | UPB_INLINE google_protobuf_FieldDescriptorProto* google_protobuf_FieldDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 6221 | google_protobuf_FieldDescriptorProto* ret = google_protobuf_FieldDescriptorProto_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 6222 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6223 | 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] | 6224 | return NULL; |
| 6225 | } |
| 6226 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6227 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6228 | UPB_INLINE google_protobuf_FieldDescriptorProto* google_protobuf_FieldDescriptorProto_parse_ex(const char* buf, size_t size, |
| 6229 | const upb_ExtensionRegistry* extreg, |
| 6230 | int options, upb_Arena* arena) { |
| 6231 | google_protobuf_FieldDescriptorProto* ret = google_protobuf_FieldDescriptorProto_new(arena); |
| 6232 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6233 | 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] | 6234 | kUpb_DecodeStatus_Ok) { |
| 6235 | return NULL; |
| 6236 | } |
| 6237 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6238 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6239 | 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] | 6240 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6241 | (void)upb_Encode(msg, &google__protobuf__FieldDescriptorProto_msg_init, 0, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6242 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6243 | } |
| 6244 | UPB_INLINE char* google_protobuf_FieldDescriptorProto_serialize_ex(const google_protobuf_FieldDescriptorProto* msg, int options, |
| 6245 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6246 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6247 | (void)upb_Encode(msg, &google__protobuf__FieldDescriptorProto_msg_init, options, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6248 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6249 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6250 | UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_name(google_protobuf_FieldDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6251 | 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] | 6252 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6253 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6254 | 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] | 6255 | upb_StringView default_val = upb_StringView_FromString(""); |
| 6256 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6257 | 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] | 6258 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6259 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6260 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6261 | 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] | 6262 | 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] | 6263 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6264 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6265 | UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_extendee(google_protobuf_FieldDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6266 | 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] | 6267 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6268 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6269 | 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] | 6270 | upb_StringView default_val = upb_StringView_FromString(""); |
| 6271 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6272 | 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] | 6273 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6274 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6275 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6276 | 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] | 6277 | 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] | 6278 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6279 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6280 | UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_number(google_protobuf_FieldDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6281 | 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] | 6282 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6283 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6284 | 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] | 6285 | int32_t default_val = (int32_t)0; |
| 6286 | int32_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6287 | 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] | 6288 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6289 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6290 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6291 | 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] | 6292 | 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] | 6293 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6294 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6295 | UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_label(google_protobuf_FieldDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6296 | 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] | 6297 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6298 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6299 | 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] | 6300 | int32_t default_val = 1; |
| 6301 | int32_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6302 | 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] | 6303 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6304 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6305 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6306 | 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] | 6307 | 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] | 6308 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6309 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6310 | UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_type(google_protobuf_FieldDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6311 | 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] | 6312 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6313 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6314 | 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] | 6315 | int32_t default_val = 1; |
| 6316 | int32_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6317 | 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] | 6318 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6319 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6320 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6321 | 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] | 6322 | 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] | 6323 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6324 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6325 | 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] | 6326 | 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] | 6327 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6328 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6329 | 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] | 6330 | upb_StringView default_val = upb_StringView_FromString(""); |
| 6331 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6332 | 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] | 6333 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6334 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6335 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6336 | 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] | 6337 | 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] | 6338 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6339 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6340 | 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] | 6341 | 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] | 6342 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6343 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6344 | 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] | 6345 | upb_StringView default_val = upb_StringView_FromString(""); |
| 6346 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6347 | 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] | 6348 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6349 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6350 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6351 | 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] | 6352 | 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] | 6353 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6354 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6355 | UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_options(google_protobuf_FieldDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6356 | 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] | 6357 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6358 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6359 | 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] | 6360 | const google_protobuf_FieldOptions* default_val = NULL; |
| 6361 | const google_protobuf_FieldOptions* ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6362 | 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] | 6363 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6364 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6365 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6366 | 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] | 6367 | 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] | 6368 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6369 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6370 | 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] | 6371 | 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] | 6372 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6373 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6374 | 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] | 6375 | int32_t default_val = (int32_t)0; |
| 6376 | int32_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6377 | 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] | 6378 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6379 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6380 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6381 | 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] | 6382 | 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] | 6383 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6384 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6385 | 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] | 6386 | 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] | 6387 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6388 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6389 | 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] | 6390 | upb_StringView default_val = upb_StringView_FromString(""); |
| 6391 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6392 | 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] | 6393 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6394 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6395 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6396 | 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] | 6397 | 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] | 6398 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6399 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6400 | 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] | 6401 | 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] | 6402 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6403 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6404 | 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] | 6405 | bool default_val = false; |
| 6406 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6407 | 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] | 6408 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6409 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6410 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6411 | 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] | 6412 | 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] | 6413 | return _upb_Message_HasNonExtensionField(msg, &field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6414 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6415 | |
| 6416 | 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] | 6417 | 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] | 6418 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6419 | } |
| 6420 | 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] | 6421 | 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] | 6422 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6423 | } |
| 6424 | 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] | 6425 | 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] | 6426 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6427 | } |
| 6428 | 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] | 6429 | 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] | 6430 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6431 | } |
| 6432 | 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] | 6433 | 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] | 6434 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6435 | } |
| 6436 | 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] | 6437 | 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] | 6438 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6439 | } |
| 6440 | 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] | 6441 | 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] | 6442 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6443 | } |
| 6444 | 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] | 6445 | 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] | 6446 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6447 | } |
| 6448 | 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] | 6449 | struct google_protobuf_FieldOptions* sub = (struct google_protobuf_FieldOptions*)google_protobuf_FieldDescriptorProto_options(msg); |
| 6450 | if (sub == NULL) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6451 | 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] | 6452 | if (sub) google_protobuf_FieldDescriptorProto_set_options(msg, sub); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6453 | } |
| 6454 | return sub; |
| 6455 | } |
| 6456 | 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] | 6457 | 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] | 6458 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6459 | } |
| 6460 | 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] | 6461 | 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] | 6462 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6463 | } |
| 6464 | 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] | 6465 | 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] | 6466 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6467 | } |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6468 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6469 | /* google.protobuf.OneofDescriptorProto */ |
| 6470 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6471 | UPB_INLINE google_protobuf_OneofDescriptorProto* google_protobuf_OneofDescriptorProto_new(upb_Arena* arena) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6472 | 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] | 6473 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6474 | UPB_INLINE google_protobuf_OneofDescriptorProto* google_protobuf_OneofDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 6475 | google_protobuf_OneofDescriptorProto* ret = google_protobuf_OneofDescriptorProto_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 6476 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6477 | 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] | 6478 | return NULL; |
| 6479 | } |
| 6480 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6481 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6482 | UPB_INLINE google_protobuf_OneofDescriptorProto* google_protobuf_OneofDescriptorProto_parse_ex(const char* buf, size_t size, |
| 6483 | const upb_ExtensionRegistry* extreg, |
| 6484 | int options, upb_Arena* arena) { |
| 6485 | google_protobuf_OneofDescriptorProto* ret = google_protobuf_OneofDescriptorProto_new(arena); |
| 6486 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6487 | 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] | 6488 | kUpb_DecodeStatus_Ok) { |
| 6489 | return NULL; |
| 6490 | } |
| 6491 | return ret; |
| 6492 | } |
| 6493 | 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] | 6494 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6495 | (void)upb_Encode(msg, &google__protobuf__OneofDescriptorProto_msg_init, 0, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6496 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6497 | } |
| 6498 | UPB_INLINE char* google_protobuf_OneofDescriptorProto_serialize_ex(const google_protobuf_OneofDescriptorProto* msg, int options, |
| 6499 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6500 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6501 | (void)upb_Encode(msg, &google__protobuf__OneofDescriptorProto_msg_init, options, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6502 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6503 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6504 | UPB_INLINE void google_protobuf_OneofDescriptorProto_clear_name(google_protobuf_OneofDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6505 | 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] | 6506 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6507 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6508 | 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] | 6509 | upb_StringView default_val = upb_StringView_FromString(""); |
| 6510 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6511 | 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] | 6512 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6513 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6514 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6515 | 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] | 6516 | 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] | 6517 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6518 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6519 | UPB_INLINE void google_protobuf_OneofDescriptorProto_clear_options(google_protobuf_OneofDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6520 | 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] | 6521 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6522 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6523 | 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] | 6524 | const google_protobuf_OneofOptions* default_val = NULL; |
| 6525 | const google_protobuf_OneofOptions* ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6526 | 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] | 6527 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6528 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6529 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6530 | 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] | 6531 | 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] | 6532 | return _upb_Message_HasNonExtensionField(msg, &field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6533 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6534 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6535 | 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] | 6536 | 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] | 6537 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6538 | } |
| 6539 | 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] | 6540 | 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] | 6541 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6542 | } |
| 6543 | 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] | 6544 | struct google_protobuf_OneofOptions* sub = (struct google_protobuf_OneofOptions*)google_protobuf_OneofDescriptorProto_options(msg); |
| 6545 | if (sub == NULL) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6546 | 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] | 6547 | if (sub) google_protobuf_OneofDescriptorProto_set_options(msg, sub); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6548 | } |
| 6549 | return sub; |
| 6550 | } |
| 6551 | |
| 6552 | /* google.protobuf.EnumDescriptorProto */ |
| 6553 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6554 | UPB_INLINE google_protobuf_EnumDescriptorProto* google_protobuf_EnumDescriptorProto_new(upb_Arena* arena) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6555 | 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] | 6556 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6557 | UPB_INLINE google_protobuf_EnumDescriptorProto* google_protobuf_EnumDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 6558 | google_protobuf_EnumDescriptorProto* ret = google_protobuf_EnumDescriptorProto_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 6559 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6560 | 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] | 6561 | return NULL; |
| 6562 | } |
| 6563 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6564 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6565 | UPB_INLINE google_protobuf_EnumDescriptorProto* google_protobuf_EnumDescriptorProto_parse_ex(const char* buf, size_t size, |
| 6566 | const upb_ExtensionRegistry* extreg, |
| 6567 | int options, upb_Arena* arena) { |
| 6568 | google_protobuf_EnumDescriptorProto* ret = google_protobuf_EnumDescriptorProto_new(arena); |
| 6569 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6570 | 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] | 6571 | kUpb_DecodeStatus_Ok) { |
| 6572 | return NULL; |
| 6573 | } |
| 6574 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6575 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6576 | 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] | 6577 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6578 | (void)upb_Encode(msg, &google__protobuf__EnumDescriptorProto_msg_init, 0, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6579 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6580 | } |
| 6581 | UPB_INLINE char* google_protobuf_EnumDescriptorProto_serialize_ex(const google_protobuf_EnumDescriptorProto* msg, int options, |
| 6582 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6583 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6584 | (void)upb_Encode(msg, &google__protobuf__EnumDescriptorProto_msg_init, options, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6585 | return ptr; |
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 void google_protobuf_EnumDescriptorProto_clear_name(google_protobuf_EnumDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6588 | 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] | 6589 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6590 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6591 | 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] | 6592 | upb_StringView default_val = upb_StringView_FromString(""); |
| 6593 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6594 | 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] | 6595 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6596 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6597 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6598 | 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] | 6599 | 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] | 6600 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6601 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6602 | UPB_INLINE void google_protobuf_EnumDescriptorProto_clear_value(google_protobuf_EnumDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6603 | 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] | 6604 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6605 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 6606 | 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] | 6607 | 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] | 6608 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 6609 | if (arr) { |
| 6610 | if (size) *size = arr->size; |
| 6611 | return (const google_protobuf_EnumValueDescriptorProto* const*)_upb_array_constptr(arr); |
| 6612 | } else { |
| 6613 | if (size) *size = 0; |
| 6614 | return NULL; |
| 6615 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6616 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 6617 | 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] | 6618 | 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] | 6619 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 6620 | if (size) { |
| 6621 | *size = arr ? arr->size : 0; |
| 6622 | } |
| 6623 | return arr; |
| 6624 | } |
| 6625 | 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] | 6626 | 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] | 6627 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 6628 | (upb_Message*)msg, &field, arena); |
| 6629 | if (size) { |
| 6630 | *size = arr ? arr->size : 0; |
| 6631 | } |
| 6632 | return arr; |
| 6633 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6634 | UPB_INLINE bool google_protobuf_EnumDescriptorProto_has_value(const google_protobuf_EnumDescriptorProto* msg) { |
| 6635 | size_t size; |
| 6636 | google_protobuf_EnumDescriptorProto_value(msg, &size); |
| 6637 | return size != 0; |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6638 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6639 | UPB_INLINE void google_protobuf_EnumDescriptorProto_clear_options(google_protobuf_EnumDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6640 | 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] | 6641 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6642 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6643 | 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] | 6644 | const google_protobuf_EnumOptions* default_val = NULL; |
| 6645 | const google_protobuf_EnumOptions* ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6646 | 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] | 6647 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6648 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6649 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6650 | 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] | 6651 | 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] | 6652 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6653 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6654 | 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] | 6655 | 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] | 6656 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6657 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 6658 | 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] | 6659 | 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] | 6660 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 6661 | if (arr) { |
| 6662 | if (size) *size = arr->size; |
| 6663 | return (const google_protobuf_EnumDescriptorProto_EnumReservedRange* const*)_upb_array_constptr(arr); |
| 6664 | } else { |
| 6665 | if (size) *size = 0; |
| 6666 | return NULL; |
| 6667 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6668 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 6669 | 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] | 6670 | 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] | 6671 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 6672 | if (size) { |
| 6673 | *size = arr ? arr->size : 0; |
| 6674 | } |
| 6675 | return arr; |
| 6676 | } |
| 6677 | 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] | 6678 | 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] | 6679 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 6680 | (upb_Message*)msg, &field, arena); |
| 6681 | if (size) { |
| 6682 | *size = arr ? arr->size : 0; |
| 6683 | } |
| 6684 | return arr; |
| 6685 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6686 | UPB_INLINE bool google_protobuf_EnumDescriptorProto_has_reserved_range(const google_protobuf_EnumDescriptorProto* msg) { |
| 6687 | size_t size; |
| 6688 | google_protobuf_EnumDescriptorProto_reserved_range(msg, &size); |
| 6689 | return size != 0; |
| 6690 | } |
| 6691 | 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] | 6692 | 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] | 6693 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6694 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 6695 | 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] | 6696 | 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] | 6697 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 6698 | if (arr) { |
| 6699 | if (size) *size = arr->size; |
| 6700 | return (upb_StringView const*)_upb_array_constptr(arr); |
| 6701 | } else { |
| 6702 | if (size) *size = 0; |
| 6703 | return NULL; |
| 6704 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6705 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 6706 | 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] | 6707 | 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] | 6708 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 6709 | if (size) { |
| 6710 | *size = arr ? arr->size : 0; |
| 6711 | } |
| 6712 | return arr; |
| 6713 | } |
| 6714 | 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] | 6715 | 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] | 6716 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 6717 | (upb_Message*)msg, &field, arena); |
| 6718 | if (size) { |
| 6719 | *size = arr ? arr->size : 0; |
| 6720 | } |
| 6721 | return arr; |
| 6722 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6723 | UPB_INLINE bool google_protobuf_EnumDescriptorProto_has_reserved_name(const google_protobuf_EnumDescriptorProto* msg) { |
| 6724 | size_t size; |
| 6725 | google_protobuf_EnumDescriptorProto_reserved_name(msg, &size); |
| 6726 | return size != 0; |
| 6727 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6728 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6729 | 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] | 6730 | 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] | 6731 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6732 | } |
| 6733 | 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] | 6734 | 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] | 6735 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 6736 | if (arr) { |
| 6737 | if (size) *size = arr->size; |
| 6738 | return (google_protobuf_EnumValueDescriptorProto**)_upb_array_ptr(arr); |
| 6739 | } else { |
| 6740 | if (size) *size = 0; |
| 6741 | return NULL; |
| 6742 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6743 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 6744 | 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] | 6745 | 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] | 6746 | return (google_protobuf_EnumValueDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6747 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6748 | 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] | 6749 | 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] | 6750 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 6751 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 6752 | return NULL; |
| 6753 | } |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6754 | 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] | 6755 | if (!arr || !sub) return NULL; |
| 6756 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6757 | return sub; |
| 6758 | } |
| 6759 | 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] | 6760 | 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] | 6761 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6762 | } |
| 6763 | 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] | 6764 | struct google_protobuf_EnumOptions* sub = (struct google_protobuf_EnumOptions*)google_protobuf_EnumDescriptorProto_options(msg); |
| 6765 | if (sub == NULL) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6766 | 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] | 6767 | if (sub) google_protobuf_EnumDescriptorProto_set_options(msg, sub); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6768 | } |
| 6769 | return sub; |
| 6770 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 6771 | 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] | 6772 | 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] | 6773 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 6774 | if (arr) { |
| 6775 | if (size) *size = arr->size; |
| 6776 | return (google_protobuf_EnumDescriptorProto_EnumReservedRange**)_upb_array_ptr(arr); |
| 6777 | } else { |
| 6778 | if (size) *size = 0; |
| 6779 | return NULL; |
| 6780 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6781 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 6782 | 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] | 6783 | 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] | 6784 | return (google_protobuf_EnumDescriptorProto_EnumReservedRange**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6785 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6786 | 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] | 6787 | 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] | 6788 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 6789 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 6790 | return NULL; |
| 6791 | } |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6792 | 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] | 6793 | if (!arr || !sub) return NULL; |
| 6794 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6795 | return sub; |
| 6796 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 6797 | 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] | 6798 | 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] | 6799 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 6800 | if (arr) { |
| 6801 | if (size) *size = arr->size; |
| 6802 | return (upb_StringView*)_upb_array_ptr(arr); |
| 6803 | } else { |
| 6804 | if (size) *size = 0; |
| 6805 | return NULL; |
| 6806 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6807 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 6808 | 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] | 6809 | 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] | 6810 | return (upb_StringView*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6811 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6812 | 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] | 6813 | 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] | 6814 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 6815 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 6816 | return false; |
| 6817 | } |
| 6818 | _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val)); |
| 6819 | return true; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6820 | } |
| 6821 | |
| 6822 | /* google.protobuf.EnumDescriptorProto.EnumReservedRange */ |
| 6823 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6824 | UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange* google_protobuf_EnumDescriptorProto_EnumReservedRange_new(upb_Arena* arena) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6825 | 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] | 6826 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6827 | UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange* google_protobuf_EnumDescriptorProto_EnumReservedRange_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 6828 | google_protobuf_EnumDescriptorProto_EnumReservedRange* ret = google_protobuf_EnumDescriptorProto_EnumReservedRange_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 6829 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6830 | 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] | 6831 | return NULL; |
| 6832 | } |
| 6833 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6834 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6835 | UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange* google_protobuf_EnumDescriptorProto_EnumReservedRange_parse_ex(const char* buf, size_t size, |
| 6836 | const upb_ExtensionRegistry* extreg, |
| 6837 | int options, upb_Arena* arena) { |
| 6838 | google_protobuf_EnumDescriptorProto_EnumReservedRange* ret = google_protobuf_EnumDescriptorProto_EnumReservedRange_new(arena); |
| 6839 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6840 | 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] | 6841 | kUpb_DecodeStatus_Ok) { |
| 6842 | return NULL; |
| 6843 | } |
| 6844 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6845 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6846 | 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] | 6847 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6848 | (void)upb_Encode(msg, &google__protobuf__EnumDescriptorProto__EnumReservedRange_msg_init, 0, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6849 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6850 | } |
| 6851 | UPB_INLINE char* google_protobuf_EnumDescriptorProto_EnumReservedRange_serialize_ex(const google_protobuf_EnumDescriptorProto_EnumReservedRange* msg, int options, |
| 6852 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6853 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6854 | (void)upb_Encode(msg, &google__protobuf__EnumDescriptorProto__EnumReservedRange_msg_init, options, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6855 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6856 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6857 | 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] | 6858 | 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] | 6859 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6860 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6861 | 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] | 6862 | int32_t default_val = (int32_t)0; |
| 6863 | int32_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6864 | 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] | 6865 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6866 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6867 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6868 | 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] | 6869 | 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] | 6870 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6871 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6872 | 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] | 6873 | 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] | 6874 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6875 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6876 | 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] | 6877 | int32_t default_val = (int32_t)0; |
| 6878 | int32_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6879 | 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] | 6880 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6881 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6882 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6883 | 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] | 6884 | 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] | 6885 | return _upb_Message_HasNonExtensionField(msg, &field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6886 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6887 | |
| 6888 | 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] | 6889 | 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] | 6890 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6891 | } |
| 6892 | 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] | 6893 | 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] | 6894 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6895 | } |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6896 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6897 | /* google.protobuf.EnumValueDescriptorProto */ |
| 6898 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6899 | UPB_INLINE google_protobuf_EnumValueDescriptorProto* google_protobuf_EnumValueDescriptorProto_new(upb_Arena* arena) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6900 | 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] | 6901 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6902 | UPB_INLINE google_protobuf_EnumValueDescriptorProto* google_protobuf_EnumValueDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 6903 | google_protobuf_EnumValueDescriptorProto* ret = google_protobuf_EnumValueDescriptorProto_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 6904 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6905 | 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] | 6906 | return NULL; |
| 6907 | } |
| 6908 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6909 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6910 | UPB_INLINE google_protobuf_EnumValueDescriptorProto* google_protobuf_EnumValueDescriptorProto_parse_ex(const char* buf, size_t size, |
| 6911 | const upb_ExtensionRegistry* extreg, |
| 6912 | int options, upb_Arena* arena) { |
| 6913 | google_protobuf_EnumValueDescriptorProto* ret = google_protobuf_EnumValueDescriptorProto_new(arena); |
| 6914 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6915 | 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] | 6916 | kUpb_DecodeStatus_Ok) { |
| 6917 | return NULL; |
| 6918 | } |
| 6919 | return ret; |
| 6920 | } |
| 6921 | 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] | 6922 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6923 | (void)upb_Encode(msg, &google__protobuf__EnumValueDescriptorProto_msg_init, 0, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6924 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6925 | } |
| 6926 | UPB_INLINE char* google_protobuf_EnumValueDescriptorProto_serialize_ex(const google_protobuf_EnumValueDescriptorProto* msg, int options, |
| 6927 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6928 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6929 | (void)upb_Encode(msg, &google__protobuf__EnumValueDescriptorProto_msg_init, options, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6930 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6931 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6932 | UPB_INLINE void google_protobuf_EnumValueDescriptorProto_clear_name(google_protobuf_EnumValueDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6933 | 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] | 6934 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6935 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6936 | 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] | 6937 | upb_StringView default_val = upb_StringView_FromString(""); |
| 6938 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6939 | 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] | 6940 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6941 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6942 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6943 | 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] | 6944 | 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] | 6945 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6946 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6947 | UPB_INLINE void google_protobuf_EnumValueDescriptorProto_clear_number(google_protobuf_EnumValueDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6948 | 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] | 6949 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6950 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6951 | 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] | 6952 | int32_t default_val = (int32_t)0; |
| 6953 | int32_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6954 | 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] | 6955 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6956 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6957 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6958 | 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] | 6959 | 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] | 6960 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6961 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6962 | UPB_INLINE void google_protobuf_EnumValueDescriptorProto_clear_options(google_protobuf_EnumValueDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6963 | 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] | 6964 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6965 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6966 | 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] | 6967 | const google_protobuf_EnumValueOptions* default_val = NULL; |
| 6968 | const google_protobuf_EnumValueOptions* ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6969 | 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] | 6970 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6971 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6972 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6973 | 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] | 6974 | 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] | 6975 | return _upb_Message_HasNonExtensionField(msg, &field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6976 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6977 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6978 | 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] | 6979 | 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] | 6980 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6981 | } |
| 6982 | 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] | 6983 | 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] | 6984 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6985 | } |
| 6986 | 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] | 6987 | 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] | 6988 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6989 | } |
| 6990 | 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] | 6991 | struct google_protobuf_EnumValueOptions* sub = (struct google_protobuf_EnumValueOptions*)google_protobuf_EnumValueDescriptorProto_options(msg); |
| 6992 | if (sub == NULL) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6993 | 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] | 6994 | if (sub) google_protobuf_EnumValueDescriptorProto_set_options(msg, sub); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6995 | } |
| 6996 | return sub; |
| 6997 | } |
| 6998 | |
| 6999 | /* google.protobuf.ServiceDescriptorProto */ |
| 7000 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7001 | UPB_INLINE google_protobuf_ServiceDescriptorProto* google_protobuf_ServiceDescriptorProto_new(upb_Arena* arena) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 7002 | 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] | 7003 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7004 | UPB_INLINE google_protobuf_ServiceDescriptorProto* google_protobuf_ServiceDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 7005 | google_protobuf_ServiceDescriptorProto* ret = google_protobuf_ServiceDescriptorProto_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 7006 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 7007 | 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] | 7008 | return NULL; |
| 7009 | } |
| 7010 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7011 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7012 | UPB_INLINE google_protobuf_ServiceDescriptorProto* google_protobuf_ServiceDescriptorProto_parse_ex(const char* buf, size_t size, |
| 7013 | const upb_ExtensionRegistry* extreg, |
| 7014 | int options, upb_Arena* arena) { |
| 7015 | google_protobuf_ServiceDescriptorProto* ret = google_protobuf_ServiceDescriptorProto_new(arena); |
| 7016 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 7017 | 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] | 7018 | kUpb_DecodeStatus_Ok) { |
| 7019 | return NULL; |
| 7020 | } |
| 7021 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7022 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7023 | 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] | 7024 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 7025 | (void)upb_Encode(msg, &google__protobuf__ServiceDescriptorProto_msg_init, 0, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7026 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7027 | } |
| 7028 | UPB_INLINE char* google_protobuf_ServiceDescriptorProto_serialize_ex(const google_protobuf_ServiceDescriptorProto* msg, int options, |
| 7029 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7030 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 7031 | (void)upb_Encode(msg, &google__protobuf__ServiceDescriptorProto_msg_init, options, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7032 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7033 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7034 | UPB_INLINE void google_protobuf_ServiceDescriptorProto_clear_name(google_protobuf_ServiceDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7035 | 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] | 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 upb_StringView google_protobuf_ServiceDescriptorProto_name(const google_protobuf_ServiceDescriptorProto* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7039 | upb_StringView default_val = upb_StringView_FromString(""); |
| 7040 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7041 | 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] | 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 | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7044 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7045 | 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] | 7046 | 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] | 7047 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7048 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7049 | UPB_INLINE void google_protobuf_ServiceDescriptorProto_clear_method(google_protobuf_ServiceDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7050 | 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] | 7051 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7052 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 7053 | 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] | 7054 | 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] | 7055 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 7056 | if (arr) { |
| 7057 | if (size) *size = arr->size; |
| 7058 | return (const google_protobuf_MethodDescriptorProto* const*)_upb_array_constptr(arr); |
| 7059 | } else { |
| 7060 | if (size) *size = 0; |
| 7061 | return NULL; |
| 7062 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7063 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 7064 | 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] | 7065 | 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] | 7066 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 7067 | if (size) { |
| 7068 | *size = arr ? arr->size : 0; |
| 7069 | } |
| 7070 | return arr; |
| 7071 | } |
| 7072 | 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] | 7073 | 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] | 7074 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 7075 | (upb_Message*)msg, &field, arena); |
| 7076 | if (size) { |
| 7077 | *size = arr ? arr->size : 0; |
| 7078 | } |
| 7079 | return arr; |
| 7080 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7081 | UPB_INLINE bool google_protobuf_ServiceDescriptorProto_has_method(const google_protobuf_ServiceDescriptorProto* msg) { |
| 7082 | size_t size; |
| 7083 | google_protobuf_ServiceDescriptorProto_method(msg, &size); |
| 7084 | return size != 0; |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7085 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7086 | UPB_INLINE void google_protobuf_ServiceDescriptorProto_clear_options(google_protobuf_ServiceDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7087 | 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] | 7088 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7089 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7090 | 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] | 7091 | const google_protobuf_ServiceOptions* default_val = NULL; |
| 7092 | const google_protobuf_ServiceOptions* ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7093 | 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] | 7094 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7095 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7096 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7097 | 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] | 7098 | 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] | 7099 | return _upb_Message_HasNonExtensionField(msg, &field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7100 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7101 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7102 | 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] | 7103 | 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] | 7104 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7105 | } |
| 7106 | 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] | 7107 | 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] | 7108 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 7109 | if (arr) { |
| 7110 | if (size) *size = arr->size; |
| 7111 | return (google_protobuf_MethodDescriptorProto**)_upb_array_ptr(arr); |
| 7112 | } else { |
| 7113 | if (size) *size = 0; |
| 7114 | return NULL; |
| 7115 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7116 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 7117 | 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] | 7118 | 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] | 7119 | return (google_protobuf_MethodDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7120 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7121 | 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] | 7122 | 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] | 7123 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 7124 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 7125 | return NULL; |
| 7126 | } |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 7127 | 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] | 7128 | if (!arr || !sub) return NULL; |
| 7129 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7130 | return sub; |
| 7131 | } |
| 7132 | 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] | 7133 | 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] | 7134 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7135 | } |
| 7136 | 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] | 7137 | struct google_protobuf_ServiceOptions* sub = (struct google_protobuf_ServiceOptions*)google_protobuf_ServiceDescriptorProto_options(msg); |
| 7138 | if (sub == NULL) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 7139 | 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] | 7140 | if (sub) google_protobuf_ServiceDescriptorProto_set_options(msg, sub); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7141 | } |
| 7142 | return sub; |
| 7143 | } |
| 7144 | |
| 7145 | /* google.protobuf.MethodDescriptorProto */ |
| 7146 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7147 | UPB_INLINE google_protobuf_MethodDescriptorProto* google_protobuf_MethodDescriptorProto_new(upb_Arena* arena) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 7148 | 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] | 7149 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7150 | UPB_INLINE google_protobuf_MethodDescriptorProto* google_protobuf_MethodDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 7151 | google_protobuf_MethodDescriptorProto* ret = google_protobuf_MethodDescriptorProto_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 7152 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 7153 | 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] | 7154 | return NULL; |
| 7155 | } |
| 7156 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7157 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7158 | UPB_INLINE google_protobuf_MethodDescriptorProto* google_protobuf_MethodDescriptorProto_parse_ex(const char* buf, size_t size, |
| 7159 | const upb_ExtensionRegistry* extreg, |
| 7160 | int options, upb_Arena* arena) { |
| 7161 | google_protobuf_MethodDescriptorProto* ret = google_protobuf_MethodDescriptorProto_new(arena); |
| 7162 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 7163 | 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] | 7164 | kUpb_DecodeStatus_Ok) { |
| 7165 | return NULL; |
| 7166 | } |
| 7167 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7168 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7169 | 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] | 7170 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 7171 | (void)upb_Encode(msg, &google__protobuf__MethodDescriptorProto_msg_init, 0, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7172 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7173 | } |
| 7174 | UPB_INLINE char* google_protobuf_MethodDescriptorProto_serialize_ex(const google_protobuf_MethodDescriptorProto* msg, int options, |
| 7175 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7176 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 7177 | (void)upb_Encode(msg, &google__protobuf__MethodDescriptorProto_msg_init, options, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7178 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7179 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7180 | UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_name(google_protobuf_MethodDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7181 | 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] | 7182 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7183 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7184 | 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] | 7185 | upb_StringView default_val = upb_StringView_FromString(""); |
| 7186 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7187 | 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] | 7188 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7189 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7190 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7191 | 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] | 7192 | 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] | 7193 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7194 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7195 | 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] | 7196 | 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] | 7197 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7198 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7199 | 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] | 7200 | upb_StringView default_val = upb_StringView_FromString(""); |
| 7201 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7202 | 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] | 7203 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7204 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7205 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7206 | 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] | 7207 | 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] | 7208 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7209 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7210 | 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] | 7211 | 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] | 7212 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7213 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7214 | 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] | 7215 | upb_StringView default_val = upb_StringView_FromString(""); |
| 7216 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7217 | 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] | 7218 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7219 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7220 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7221 | 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] | 7222 | 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] | 7223 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7224 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7225 | UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_options(google_protobuf_MethodDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7226 | 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] | 7227 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7228 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7229 | 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] | 7230 | const google_protobuf_MethodOptions* default_val = NULL; |
| 7231 | const google_protobuf_MethodOptions* ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7232 | 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] | 7233 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7234 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7235 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7236 | 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] | 7237 | 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] | 7238 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7239 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7240 | 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] | 7241 | 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] | 7242 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7243 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7244 | 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] | 7245 | bool default_val = false; |
| 7246 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7247 | 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] | 7248 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7249 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7250 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7251 | 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] | 7252 | 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] | 7253 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7254 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7255 | 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] | 7256 | 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] | 7257 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7258 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7259 | 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] | 7260 | bool default_val = false; |
| 7261 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7262 | 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] | 7263 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7264 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7265 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7266 | 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] | 7267 | 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] | 7268 | return _upb_Message_HasNonExtensionField(msg, &field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7269 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7270 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7271 | 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] | 7272 | 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] | 7273 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7274 | } |
| 7275 | 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] | 7276 | 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] | 7277 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7278 | } |
| 7279 | 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] | 7280 | 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] | 7281 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7282 | } |
| 7283 | 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] | 7284 | 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] | 7285 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7286 | } |
| 7287 | 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] | 7288 | struct google_protobuf_MethodOptions* sub = (struct google_protobuf_MethodOptions*)google_protobuf_MethodDescriptorProto_options(msg); |
| 7289 | if (sub == NULL) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 7290 | 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] | 7291 | if (sub) google_protobuf_MethodDescriptorProto_set_options(msg, sub); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7292 | } |
| 7293 | return sub; |
| 7294 | } |
| 7295 | 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] | 7296 | 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] | 7297 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7298 | } |
| 7299 | 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] | 7300 | 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] | 7301 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7302 | } |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7303 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7304 | /* google.protobuf.FileOptions */ |
| 7305 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7306 | UPB_INLINE google_protobuf_FileOptions* google_protobuf_FileOptions_new(upb_Arena* arena) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 7307 | 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] | 7308 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7309 | UPB_INLINE google_protobuf_FileOptions* google_protobuf_FileOptions_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 7310 | google_protobuf_FileOptions* ret = google_protobuf_FileOptions_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 7311 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 7312 | 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] | 7313 | return NULL; |
| 7314 | } |
| 7315 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7316 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7317 | UPB_INLINE google_protobuf_FileOptions* google_protobuf_FileOptions_parse_ex(const char* buf, size_t size, |
| 7318 | const upb_ExtensionRegistry* extreg, |
| 7319 | int options, upb_Arena* arena) { |
| 7320 | google_protobuf_FileOptions* ret = google_protobuf_FileOptions_new(arena); |
| 7321 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 7322 | 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] | 7323 | kUpb_DecodeStatus_Ok) { |
| 7324 | return NULL; |
| 7325 | } |
| 7326 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7327 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7328 | 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] | 7329 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 7330 | (void)upb_Encode(msg, &google__protobuf__FileOptions_msg_init, 0, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7331 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7332 | } |
| 7333 | UPB_INLINE char* google_protobuf_FileOptions_serialize_ex(const google_protobuf_FileOptions* msg, int options, |
| 7334 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7335 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 7336 | (void)upb_Encode(msg, &google__protobuf__FileOptions_msg_init, options, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7337 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7338 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7339 | 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] | 7340 | 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] | 7341 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7342 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7343 | 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] | 7344 | upb_StringView default_val = upb_StringView_FromString(""); |
| 7345 | upb_StringView ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7346 | 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] | 7347 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7348 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7349 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7350 | 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] | 7351 | 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] | 7352 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7353 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7354 | 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] | 7355 | 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] | 7356 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7357 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7358 | 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] | 7359 | upb_StringView default_val = upb_StringView_FromString(""); |
| 7360 | upb_StringView ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7361 | 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] | 7362 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7363 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7364 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7365 | 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] | 7366 | 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] | 7367 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7368 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7369 | 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] | 7370 | 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] | 7371 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7372 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7373 | 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] | 7374 | int32_t default_val = 1; |
| 7375 | int32_t ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7376 | 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] | 7377 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7378 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7379 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7380 | 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] | 7381 | 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] | 7382 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7383 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7384 | 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] | 7385 | 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] | 7386 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7387 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7388 | 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] | 7389 | bool default_val = false; |
| 7390 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7391 | 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] | 7392 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7393 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7394 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7395 | 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] | 7396 | 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] | 7397 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7398 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7399 | 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] | 7400 | 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] | 7401 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7402 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7403 | 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] | 7404 | upb_StringView default_val = upb_StringView_FromString(""); |
| 7405 | upb_StringView ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7406 | 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] | 7407 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7408 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7409 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7410 | 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] | 7411 | 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] | 7412 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7413 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7414 | 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] | 7415 | 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] | 7416 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7417 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7418 | 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] | 7419 | bool default_val = false; |
| 7420 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7421 | 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] | 7422 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7423 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7424 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7425 | 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] | 7426 | 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] | 7427 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7428 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7429 | 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] | 7430 | 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] | 7431 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7432 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7433 | 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] | 7434 | bool default_val = false; |
| 7435 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7436 | 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] | 7437 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7438 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7439 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7440 | 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] | 7441 | 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] | 7442 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7443 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7444 | 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] | 7445 | 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] | 7446 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7447 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7448 | 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] | 7449 | bool default_val = false; |
| 7450 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7451 | 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] | 7452 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7453 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7454 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7455 | 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] | 7456 | 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] | 7457 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7458 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7459 | 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] | 7460 | 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] | 7461 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7462 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7463 | 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] | 7464 | bool default_val = false; |
| 7465 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7466 | 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] | 7467 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7468 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7469 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7470 | 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] | 7471 | 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] | 7472 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7473 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7474 | UPB_INLINE void google_protobuf_FileOptions_clear_deprecated(google_protobuf_FileOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7475 | 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] | 7476 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7477 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7478 | UPB_INLINE bool google_protobuf_FileOptions_deprecated(const google_protobuf_FileOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7479 | bool default_val = false; |
| 7480 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7481 | 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] | 7482 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7483 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7484 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7485 | 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] | 7486 | 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] | 7487 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7488 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7489 | 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] | 7490 | 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] | 7491 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7492 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7493 | 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] | 7494 | bool default_val = false; |
| 7495 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7496 | 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] | 7497 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7498 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7499 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7500 | 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] | 7501 | 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] | 7502 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7503 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7504 | 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] | 7505 | 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] | 7506 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7507 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7508 | 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] | 7509 | bool default_val = true; |
| 7510 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7511 | 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] | 7512 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7513 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7514 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7515 | 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] | 7516 | 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] | 7517 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7518 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7519 | 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] | 7520 | 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] | 7521 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7522 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7523 | 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] | 7524 | upb_StringView default_val = upb_StringView_FromString(""); |
| 7525 | upb_StringView ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7526 | 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] | 7527 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7528 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7529 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7530 | 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] | 7531 | 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] | 7532 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7533 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7534 | 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] | 7535 | 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] | 7536 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7537 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7538 | 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] | 7539 | upb_StringView default_val = upb_StringView_FromString(""); |
| 7540 | upb_StringView ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7541 | 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] | 7542 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7543 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7544 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7545 | 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] | 7546 | 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] | 7547 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7548 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7549 | 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] | 7550 | 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] | 7551 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7552 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7553 | 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] | 7554 | upb_StringView default_val = upb_StringView_FromString(""); |
| 7555 | upb_StringView ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7556 | 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] | 7557 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7558 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7559 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7560 | 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] | 7561 | 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] | 7562 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7563 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7564 | 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] | 7565 | 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] | 7566 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7567 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7568 | 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] | 7569 | upb_StringView default_val = upb_StringView_FromString(""); |
| 7570 | upb_StringView ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7571 | 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] | 7572 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7573 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7574 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7575 | 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] | 7576 | 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] | 7577 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7578 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7579 | 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] | 7580 | 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] | 7581 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7582 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7583 | 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] | 7584 | upb_StringView default_val = upb_StringView_FromString(""); |
| 7585 | upb_StringView ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7586 | 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] | 7587 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7588 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7589 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7590 | 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] | 7591 | 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] | 7592 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7593 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7594 | 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] | 7595 | 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] | 7596 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7597 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7598 | 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] | 7599 | bool default_val = false; |
| 7600 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7601 | 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] | 7602 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7603 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7604 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7605 | 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] | 7606 | 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] | 7607 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7608 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7609 | 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] | 7610 | 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] | 7611 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7612 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7613 | 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] | 7614 | upb_StringView default_val = upb_StringView_FromString(""); |
| 7615 | upb_StringView ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7616 | 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] | 7617 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7618 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7619 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7620 | 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] | 7621 | 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] | 7622 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7623 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7624 | 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] | 7625 | 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] | 7626 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7627 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7628 | 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] | 7629 | upb_StringView default_val = upb_StringView_FromString(""); |
| 7630 | upb_StringView ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7631 | 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] | 7632 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7633 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7634 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7635 | 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] | 7636 | 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)}; |
| 7637 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 7638 | } |
| 7639 | UPB_INLINE void google_protobuf_FileOptions_clear_features(google_protobuf_FileOptions* msg) { |
| 7640 | 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)}; |
| 7641 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 7642 | } |
| 7643 | UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_FileOptions_features(const google_protobuf_FileOptions* msg) { |
| 7644 | const google_protobuf_FeatureSet* default_val = NULL; |
| 7645 | const google_protobuf_FeatureSet* ret; |
| 7646 | 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)}; |
| 7647 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 7648 | return ret; |
| 7649 | } |
| 7650 | UPB_INLINE bool google_protobuf_FileOptions_has_features(const google_protobuf_FileOptions* msg) { |
| 7651 | 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] | 7652 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7653 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7654 | 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] | 7655 | 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] | 7656 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7657 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 7658 | 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] | 7659 | 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] | 7660 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 7661 | if (arr) { |
| 7662 | if (size) *size = arr->size; |
| 7663 | return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr); |
| 7664 | } else { |
| 7665 | if (size) *size = 0; |
| 7666 | return NULL; |
| 7667 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7668 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 7669 | 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] | 7670 | 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] | 7671 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 7672 | if (size) { |
| 7673 | *size = arr ? arr->size : 0; |
| 7674 | } |
| 7675 | return arr; |
| 7676 | } |
| 7677 | 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] | 7678 | 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] | 7679 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 7680 | (upb_Message*)msg, &field, arena); |
| 7681 | if (size) { |
| 7682 | *size = arr ? arr->size : 0; |
| 7683 | } |
| 7684 | return arr; |
| 7685 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7686 | UPB_INLINE bool google_protobuf_FileOptions_has_uninterpreted_option(const google_protobuf_FileOptions* msg) { |
| 7687 | size_t size; |
| 7688 | google_protobuf_FileOptions_uninterpreted_option(msg, &size); |
| 7689 | return size != 0; |
| 7690 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7691 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7692 | 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] | 7693 | 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] | 7694 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7695 | } |
| 7696 | 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] | 7697 | 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] | 7698 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7699 | } |
| 7700 | 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] | 7701 | 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] | 7702 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7703 | } |
| 7704 | 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] | 7705 | 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] | 7706 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7707 | } |
| 7708 | 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] | 7709 | 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] | 7710 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7711 | } |
| 7712 | 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] | 7713 | 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] | 7714 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7715 | } |
| 7716 | 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] | 7717 | 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] | 7718 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7719 | } |
| 7720 | 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] | 7721 | 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] | 7722 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7723 | } |
| 7724 | 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] | 7725 | 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] | 7726 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7727 | } |
| 7728 | 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] | 7729 | 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] | 7730 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7731 | } |
| 7732 | 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] | 7733 | 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] | 7734 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7735 | } |
| 7736 | 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] | 7737 | 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] | 7738 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7739 | } |
| 7740 | 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] | 7741 | 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] | 7742 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7743 | } |
| 7744 | 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] | 7745 | 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] | 7746 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7747 | } |
| 7748 | 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] | 7749 | 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] | 7750 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7751 | } |
| 7752 | 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] | 7753 | 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] | 7754 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7755 | } |
| 7756 | 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] | 7757 | 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] | 7758 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7759 | } |
| 7760 | 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] | 7761 | 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] | 7762 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7763 | } |
| 7764 | 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] | 7765 | 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] | 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_ruby_package(google_protobuf_FileOptions *msg, upb_StringView value) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7769 | 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] | 7770 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7771 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7772 | UPB_INLINE void google_protobuf_FileOptions_set_features(google_protobuf_FileOptions *msg, google_protobuf_FeatureSet* value) { |
| 7773 | 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)}; |
| 7774 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 7775 | } |
| 7776 | UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_FileOptions_mutable_features(google_protobuf_FileOptions* msg, upb_Arena* arena) { |
| 7777 | struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_FileOptions_features(msg); |
| 7778 | if (sub == NULL) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 7779 | sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena); |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7780 | if (sub) google_protobuf_FileOptions_set_features(msg, sub); |
| 7781 | } |
| 7782 | return sub; |
| 7783 | } |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7784 | 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] | 7785 | 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] | 7786 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 7787 | if (arr) { |
| 7788 | if (size) *size = arr->size; |
| 7789 | return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr); |
| 7790 | } else { |
| 7791 | if (size) *size = 0; |
| 7792 | return NULL; |
| 7793 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7794 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 7795 | 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] | 7796 | 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] | 7797 | return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7798 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7799 | 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] | 7800 | 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] | 7801 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 7802 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 7803 | return NULL; |
| 7804 | } |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 7805 | 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] | 7806 | if (!arr || !sub) return NULL; |
| 7807 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7808 | return sub; |
| 7809 | } |
| 7810 | |
| 7811 | /* google.protobuf.MessageOptions */ |
| 7812 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7813 | UPB_INLINE google_protobuf_MessageOptions* google_protobuf_MessageOptions_new(upb_Arena* arena) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 7814 | 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] | 7815 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7816 | UPB_INLINE google_protobuf_MessageOptions* google_protobuf_MessageOptions_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 7817 | google_protobuf_MessageOptions* ret = google_protobuf_MessageOptions_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 7818 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 7819 | 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] | 7820 | return NULL; |
| 7821 | } |
| 7822 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7823 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7824 | UPB_INLINE google_protobuf_MessageOptions* google_protobuf_MessageOptions_parse_ex(const char* buf, size_t size, |
| 7825 | const upb_ExtensionRegistry* extreg, |
| 7826 | int options, upb_Arena* arena) { |
| 7827 | google_protobuf_MessageOptions* ret = google_protobuf_MessageOptions_new(arena); |
| 7828 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 7829 | 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] | 7830 | kUpb_DecodeStatus_Ok) { |
| 7831 | return NULL; |
| 7832 | } |
| 7833 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7834 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7835 | 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] | 7836 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 7837 | (void)upb_Encode(msg, &google__protobuf__MessageOptions_msg_init, 0, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7838 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7839 | } |
| 7840 | UPB_INLINE char* google_protobuf_MessageOptions_serialize_ex(const google_protobuf_MessageOptions* msg, int options, |
| 7841 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7842 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 7843 | (void)upb_Encode(msg, &google__protobuf__MessageOptions_msg_init, options, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7844 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7845 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7846 | 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] | 7847 | 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] | 7848 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7849 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7850 | 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] | 7851 | bool default_val = false; |
| 7852 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7853 | 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] | 7854 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7855 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7856 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7857 | 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] | 7858 | 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] | 7859 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7860 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7861 | 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] | 7862 | 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] | 7863 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7864 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7865 | 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] | 7866 | bool default_val = false; |
| 7867 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7868 | 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] | 7869 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7870 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7871 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7872 | 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] | 7873 | 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] | 7874 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7875 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7876 | UPB_INLINE void google_protobuf_MessageOptions_clear_deprecated(google_protobuf_MessageOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7877 | 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] | 7878 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7879 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7880 | UPB_INLINE bool google_protobuf_MessageOptions_deprecated(const google_protobuf_MessageOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7881 | bool default_val = false; |
| 7882 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7883 | 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] | 7884 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7885 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7886 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7887 | 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] | 7888 | 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] | 7889 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7890 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7891 | 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] | 7892 | 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] | 7893 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7894 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7895 | 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] | 7896 | bool default_val = false; |
| 7897 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7898 | 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] | 7899 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7900 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7901 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7902 | 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] | 7903 | 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] | 7904 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7905 | } |
Mike Kruskal | 6b87d6f | 2022-12-14 10:36:53 -0800 | [diff] [blame] | 7906 | 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] | 7907 | 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] | 7908 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 7909 | } |
| 7910 | UPB_INLINE bool google_protobuf_MessageOptions_deprecated_legacy_json_field_conflicts(const google_protobuf_MessageOptions* msg) { |
| 7911 | bool default_val = false; |
| 7912 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7913 | 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] | 7914 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 7915 | return ret; |
| 7916 | } |
| 7917 | 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] | 7918 | 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] | 7919 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 7920 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7921 | UPB_INLINE void google_protobuf_MessageOptions_clear_features(google_protobuf_MessageOptions* msg) { |
| 7922 | 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)}; |
| 7923 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 7924 | } |
| 7925 | UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_MessageOptions_features(const google_protobuf_MessageOptions* msg) { |
| 7926 | const google_protobuf_FeatureSet* default_val = NULL; |
| 7927 | const google_protobuf_FeatureSet* ret; |
| 7928 | 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)}; |
| 7929 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 7930 | return ret; |
| 7931 | } |
| 7932 | UPB_INLINE bool google_protobuf_MessageOptions_has_features(const google_protobuf_MessageOptions* msg) { |
| 7933 | 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)}; |
| 7934 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 7935 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7936 | 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] | 7937 | 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] | 7938 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7939 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 7940 | 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] | 7941 | 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] | 7942 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 7943 | if (arr) { |
| 7944 | if (size) *size = arr->size; |
| 7945 | return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr); |
| 7946 | } else { |
| 7947 | if (size) *size = 0; |
| 7948 | return NULL; |
| 7949 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7950 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 7951 | 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] | 7952 | 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] | 7953 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 7954 | if (size) { |
| 7955 | *size = arr ? arr->size : 0; |
| 7956 | } |
| 7957 | return arr; |
| 7958 | } |
| 7959 | 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] | 7960 | 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] | 7961 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 7962 | (upb_Message*)msg, &field, arena); |
| 7963 | if (size) { |
| 7964 | *size = arr ? arr->size : 0; |
| 7965 | } |
| 7966 | return arr; |
| 7967 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7968 | UPB_INLINE bool google_protobuf_MessageOptions_has_uninterpreted_option(const google_protobuf_MessageOptions* msg) { |
| 7969 | size_t size; |
| 7970 | google_protobuf_MessageOptions_uninterpreted_option(msg, &size); |
| 7971 | return size != 0; |
| 7972 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7973 | |
| 7974 | 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] | 7975 | 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] | 7976 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7977 | } |
| 7978 | 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] | 7979 | 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] | 7980 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7981 | } |
| 7982 | 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] | 7983 | 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] | 7984 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7985 | } |
| 7986 | 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] | 7987 | 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] | 7988 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7989 | } |
| 7990 | 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] | 7991 | 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] | 7992 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7993 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7994 | UPB_INLINE void google_protobuf_MessageOptions_set_features(google_protobuf_MessageOptions *msg, google_protobuf_FeatureSet* value) { |
| 7995 | 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)}; |
| 7996 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 7997 | } |
| 7998 | UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_MessageOptions_mutable_features(google_protobuf_MessageOptions* msg, upb_Arena* arena) { |
| 7999 | struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_MessageOptions_features(msg); |
| 8000 | if (sub == NULL) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 8001 | sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena); |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8002 | if (sub) google_protobuf_MessageOptions_set_features(msg, sub); |
| 8003 | } |
| 8004 | return sub; |
| 8005 | } |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8006 | 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] | 8007 | 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] | 8008 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 8009 | if (arr) { |
| 8010 | if (size) *size = arr->size; |
| 8011 | return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr); |
| 8012 | } else { |
| 8013 | if (size) *size = 0; |
| 8014 | return NULL; |
| 8015 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8016 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 8017 | 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] | 8018 | 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] | 8019 | return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8020 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8021 | 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] | 8022 | 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] | 8023 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 8024 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 8025 | return NULL; |
| 8026 | } |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 8027 | 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] | 8028 | if (!arr || !sub) return NULL; |
| 8029 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8030 | return sub; |
| 8031 | } |
| 8032 | |
| 8033 | /* google.protobuf.FieldOptions */ |
| 8034 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8035 | UPB_INLINE google_protobuf_FieldOptions* google_protobuf_FieldOptions_new(upb_Arena* arena) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 8036 | 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] | 8037 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8038 | UPB_INLINE google_protobuf_FieldOptions* google_protobuf_FieldOptions_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 8039 | google_protobuf_FieldOptions* ret = google_protobuf_FieldOptions_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 8040 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 8041 | 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] | 8042 | return NULL; |
| 8043 | } |
| 8044 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8045 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8046 | UPB_INLINE google_protobuf_FieldOptions* google_protobuf_FieldOptions_parse_ex(const char* buf, size_t size, |
| 8047 | const upb_ExtensionRegistry* extreg, |
| 8048 | int options, upb_Arena* arena) { |
| 8049 | google_protobuf_FieldOptions* ret = google_protobuf_FieldOptions_new(arena); |
| 8050 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 8051 | 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] | 8052 | kUpb_DecodeStatus_Ok) { |
| 8053 | return NULL; |
| 8054 | } |
| 8055 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8056 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8057 | 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] | 8058 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 8059 | (void)upb_Encode(msg, &google__protobuf__FieldOptions_msg_init, 0, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8060 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8061 | } |
| 8062 | UPB_INLINE char* google_protobuf_FieldOptions_serialize_ex(const google_protobuf_FieldOptions* msg, int options, |
| 8063 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8064 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 8065 | (void)upb_Encode(msg, &google__protobuf__FieldOptions_msg_init, options, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8066 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8067 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8068 | UPB_INLINE void google_protobuf_FieldOptions_clear_ctype(google_protobuf_FieldOptions* msg) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8069 | 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] | 8070 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8071 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8072 | 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] | 8073 | int32_t default_val = 0; |
| 8074 | int32_t ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8075 | 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] | 8076 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8077 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8078 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8079 | 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] | 8080 | 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] | 8081 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8082 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8083 | UPB_INLINE void google_protobuf_FieldOptions_clear_packed(google_protobuf_FieldOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8084 | 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] | 8085 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8086 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8087 | UPB_INLINE bool google_protobuf_FieldOptions_packed(const google_protobuf_FieldOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8088 | bool default_val = false; |
| 8089 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8090 | 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] | 8091 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8092 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8093 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8094 | 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] | 8095 | 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] | 8096 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8097 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8098 | UPB_INLINE void google_protobuf_FieldOptions_clear_deprecated(google_protobuf_FieldOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8099 | 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] | 8100 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8101 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8102 | UPB_INLINE bool google_protobuf_FieldOptions_deprecated(const google_protobuf_FieldOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8103 | bool default_val = false; |
| 8104 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8105 | 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] | 8106 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8107 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8108 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8109 | 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] | 8110 | 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] | 8111 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8112 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8113 | UPB_INLINE void google_protobuf_FieldOptions_clear_lazy(google_protobuf_FieldOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8114 | 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] | 8115 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8116 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8117 | UPB_INLINE bool google_protobuf_FieldOptions_lazy(const google_protobuf_FieldOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8118 | bool default_val = false; |
| 8119 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8120 | 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] | 8121 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8122 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8123 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8124 | 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] | 8125 | 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] | 8126 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8127 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8128 | UPB_INLINE void google_protobuf_FieldOptions_clear_jstype(google_protobuf_FieldOptions* msg) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8129 | 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] | 8130 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8131 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8132 | 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] | 8133 | int32_t default_val = 0; |
| 8134 | int32_t ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8135 | 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] | 8136 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8137 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8138 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8139 | 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] | 8140 | 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] | 8141 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8142 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8143 | UPB_INLINE void google_protobuf_FieldOptions_clear_weak(google_protobuf_FieldOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8144 | 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] | 8145 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8146 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8147 | UPB_INLINE bool google_protobuf_FieldOptions_weak(const google_protobuf_FieldOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8148 | bool default_val = false; |
| 8149 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8150 | 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] | 8151 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8152 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8153 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8154 | 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] | 8155 | 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] | 8156 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8157 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8158 | 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] | 8159 | 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] | 8160 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8161 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8162 | 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] | 8163 | bool default_val = false; |
| 8164 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8165 | 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] | 8166 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8167 | return ret; |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8168 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8169 | 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] | 8170 | 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] | 8171 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8172 | } |
Protobuf Team Bot | 9238c48 | 2022-12-16 20:01:55 -0800 | [diff] [blame] | 8173 | 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] | 8174 | 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] | 8175 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 8176 | } |
| 8177 | UPB_INLINE bool google_protobuf_FieldOptions_debug_redact(const google_protobuf_FieldOptions* msg) { |
| 8178 | bool default_val = false; |
| 8179 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8180 | 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] | 8181 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 8182 | return ret; |
| 8183 | } |
| 8184 | 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] | 8185 | 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] | 8186 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 8187 | } |
Adam Cozzette | 5a56837 | 2023-01-24 20:35:59 -0800 | [diff] [blame] | 8188 | UPB_INLINE void google_protobuf_FieldOptions_clear_retention(google_protobuf_FieldOptions* msg) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8189 | 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] | 8190 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 8191 | } |
| 8192 | UPB_INLINE int32_t google_protobuf_FieldOptions_retention(const google_protobuf_FieldOptions* msg) { |
| 8193 | int32_t default_val = 0; |
| 8194 | int32_t ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8195 | 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] | 8196 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 8197 | return ret; |
| 8198 | } |
| 8199 | 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] | 8200 | 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] | 8201 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 8202 | } |
Mike Kruskal | 0c12139 | 2023-03-18 00:05:41 -0700 | [diff] [blame] | 8203 | UPB_INLINE void google_protobuf_FieldOptions_clear_targets(google_protobuf_FieldOptions* msg) { |
Sandy Zhang | 96c601d | 2023-07-05 12:39:20 -0700 | [diff] [blame] | 8204 | 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] | 8205 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 8206 | } |
Mike Kruskal | 0c12139 | 2023-03-18 00:05:41 -0700 | [diff] [blame] | 8207 | 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] | 8208 | 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] | 8209 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 8210 | if (arr) { |
| 8211 | if (size) *size = arr->size; |
| 8212 | return (int32_t const*)_upb_array_constptr(arr); |
| 8213 | } else { |
| 8214 | if (size) *size = 0; |
| 8215 | return NULL; |
| 8216 | } |
Adam Cozzette | 5a56837 | 2023-01-24 20:35:59 -0800 | [diff] [blame] | 8217 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 8218 | 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] | 8219 | 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] | 8220 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 8221 | if (size) { |
| 8222 | *size = arr ? arr->size : 0; |
| 8223 | } |
| 8224 | return arr; |
| 8225 | } |
| 8226 | 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] | 8227 | 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] | 8228 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 8229 | (upb_Message*)msg, &field, arena); |
| 8230 | if (size) { |
| 8231 | *size = arr ? arr->size : 0; |
| 8232 | } |
| 8233 | return arr; |
| 8234 | } |
Mike Kruskal | 0c12139 | 2023-03-18 00:05:41 -0700 | [diff] [blame] | 8235 | UPB_INLINE bool google_protobuf_FieldOptions_has_targets(const google_protobuf_FieldOptions* msg) { |
| 8236 | size_t size; |
| 8237 | google_protobuf_FieldOptions_targets(msg, &size); |
| 8238 | return size != 0; |
Adam Cozzette | 5a56837 | 2023-01-24 20:35:59 -0800 | [diff] [blame] | 8239 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8240 | 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] | 8241 | 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] | 8242 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 8243 | } |
| 8244 | 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] | 8245 | 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] | 8246 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 8247 | if (arr) { |
| 8248 | if (size) *size = arr->size; |
| 8249 | return (const google_protobuf_FieldOptions_EditionDefault* const*)_upb_array_constptr(arr); |
| 8250 | } else { |
| 8251 | if (size) *size = 0; |
| 8252 | return NULL; |
| 8253 | } |
| 8254 | } |
| 8255 | 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] | 8256 | 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] | 8257 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 8258 | if (size) { |
| 8259 | *size = arr ? arr->size : 0; |
| 8260 | } |
| 8261 | return arr; |
| 8262 | } |
| 8263 | 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] | 8264 | 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] | 8265 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 8266 | (upb_Message*)msg, &field, arena); |
| 8267 | if (size) { |
| 8268 | *size = arr ? arr->size : 0; |
| 8269 | } |
| 8270 | return arr; |
| 8271 | } |
| 8272 | UPB_INLINE bool google_protobuf_FieldOptions_has_edition_defaults(const google_protobuf_FieldOptions* msg) { |
| 8273 | size_t size; |
| 8274 | google_protobuf_FieldOptions_edition_defaults(msg, &size); |
| 8275 | return size != 0; |
| 8276 | } |
| 8277 | UPB_INLINE void google_protobuf_FieldOptions_clear_features(google_protobuf_FieldOptions* msg) { |
Sandy Zhang | 96c601d | 2023-07-05 12:39:20 -0700 | [diff] [blame] | 8278 | 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] | 8279 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 8280 | } |
| 8281 | UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_FieldOptions_features(const google_protobuf_FieldOptions* msg) { |
| 8282 | const google_protobuf_FeatureSet* default_val = NULL; |
| 8283 | const google_protobuf_FeatureSet* ret; |
Sandy Zhang | 96c601d | 2023-07-05 12:39:20 -0700 | [diff] [blame] | 8284 | 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] | 8285 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 8286 | return ret; |
| 8287 | } |
| 8288 | 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] | 8289 | 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] | 8290 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 8291 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8292 | 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] | 8293 | 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] | 8294 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8295 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 8296 | 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] | 8297 | 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] | 8298 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 8299 | if (arr) { |
| 8300 | if (size) *size = arr->size; |
| 8301 | return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr); |
| 8302 | } else { |
| 8303 | if (size) *size = 0; |
| 8304 | return NULL; |
| 8305 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8306 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 8307 | 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] | 8308 | 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] | 8309 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 8310 | if (size) { |
| 8311 | *size = arr ? arr->size : 0; |
| 8312 | } |
| 8313 | return arr; |
| 8314 | } |
| 8315 | 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] | 8316 | 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] | 8317 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 8318 | (upb_Message*)msg, &field, arena); |
| 8319 | if (size) { |
| 8320 | *size = arr ? arr->size : 0; |
| 8321 | } |
| 8322 | return arr; |
| 8323 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8324 | UPB_INLINE bool google_protobuf_FieldOptions_has_uninterpreted_option(const google_protobuf_FieldOptions* msg) { |
| 8325 | size_t size; |
| 8326 | google_protobuf_FieldOptions_uninterpreted_option(msg, &size); |
| 8327 | return size != 0; |
| 8328 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8329 | |
| 8330 | 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] | 8331 | 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] | 8332 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8333 | } |
| 8334 | 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] | 8335 | 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] | 8336 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8337 | } |
| 8338 | 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] | 8339 | 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] | 8340 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8341 | } |
| 8342 | 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] | 8343 | 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] | 8344 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8345 | } |
| 8346 | 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] | 8347 | 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] | 8348 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8349 | } |
| 8350 | 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] | 8351 | 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] | 8352 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8353 | } |
| 8354 | 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] | 8355 | 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] | 8356 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8357 | } |
| 8358 | 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] | 8359 | 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] | 8360 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8361 | } |
Adam Cozzette | 5a56837 | 2023-01-24 20:35:59 -0800 | [diff] [blame] | 8362 | 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] | 8363 | 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] | 8364 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 8365 | } |
Mike Kruskal | 0c12139 | 2023-03-18 00:05:41 -0700 | [diff] [blame] | 8366 | 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] | 8367 | 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] | 8368 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 8369 | if (arr) { |
| 8370 | if (size) *size = arr->size; |
| 8371 | return (int32_t*)_upb_array_ptr(arr); |
| 8372 | } else { |
| 8373 | if (size) *size = 0; |
| 8374 | return NULL; |
| 8375 | } |
| 8376 | } |
| 8377 | 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] | 8378 | 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] | 8379 | return (int32_t*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Mike Kruskal | 0c12139 | 2023-03-18 00:05:41 -0700 | [diff] [blame] | 8380 | } |
| 8381 | 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] | 8382 | 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] | 8383 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 8384 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 8385 | return false; |
| 8386 | } |
| 8387 | _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val)); |
| 8388 | return true; |
Adam Cozzette | 5a56837 | 2023-01-24 20:35:59 -0800 | [diff] [blame] | 8389 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8390 | 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] | 8391 | 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] | 8392 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 8393 | if (arr) { |
| 8394 | if (size) *size = arr->size; |
| 8395 | return (google_protobuf_FieldOptions_EditionDefault**)_upb_array_ptr(arr); |
| 8396 | } else { |
| 8397 | if (size) *size = 0; |
| 8398 | return NULL; |
| 8399 | } |
| 8400 | } |
| 8401 | 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] | 8402 | 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] | 8403 | return (google_protobuf_FieldOptions_EditionDefault**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
| 8404 | } |
| 8405 | 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] | 8406 | 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] | 8407 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 8408 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 8409 | return NULL; |
| 8410 | } |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 8411 | struct google_protobuf_FieldOptions_EditionDefault* sub = (struct google_protobuf_FieldOptions_EditionDefault*)_upb_Message_New(&google__protobuf__FieldOptions__EditionDefault_msg_init, arena); |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8412 | if (!arr || !sub) return NULL; |
| 8413 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
| 8414 | return sub; |
| 8415 | } |
| 8416 | 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] | 8417 | 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] | 8418 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 8419 | } |
| 8420 | UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_FieldOptions_mutable_features(google_protobuf_FieldOptions* msg, upb_Arena* arena) { |
| 8421 | struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_FieldOptions_features(msg); |
| 8422 | if (sub == NULL) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 8423 | sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena); |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8424 | if (sub) google_protobuf_FieldOptions_set_features(msg, sub); |
| 8425 | } |
| 8426 | return sub; |
| 8427 | } |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8428 | 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] | 8429 | 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] | 8430 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 8431 | if (arr) { |
| 8432 | if (size) *size = arr->size; |
| 8433 | return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr); |
| 8434 | } else { |
| 8435 | if (size) *size = 0; |
| 8436 | return NULL; |
| 8437 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8438 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 8439 | 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] | 8440 | 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] | 8441 | return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8442 | } |
| 8443 | 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] | 8444 | 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] | 8445 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 8446 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 8447 | return NULL; |
| 8448 | } |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 8449 | 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] | 8450 | if (!arr || !sub) return NULL; |
| 8451 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8452 | return sub; |
| 8453 | } |
| 8454 | |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8455 | /* google.protobuf.FieldOptions.EditionDefault */ |
| 8456 | |
| 8457 | UPB_INLINE google_protobuf_FieldOptions_EditionDefault* google_protobuf_FieldOptions_EditionDefault_new(upb_Arena* arena) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 8458 | return (google_protobuf_FieldOptions_EditionDefault*)_upb_Message_New(&google__protobuf__FieldOptions__EditionDefault_msg_init, arena); |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8459 | } |
| 8460 | UPB_INLINE google_protobuf_FieldOptions_EditionDefault* google_protobuf_FieldOptions_EditionDefault_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 8461 | google_protobuf_FieldOptions_EditionDefault* ret = google_protobuf_FieldOptions_EditionDefault_new(arena); |
| 8462 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 8463 | if (upb_Decode(buf, size, ret, &google__protobuf__FieldOptions__EditionDefault_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8464 | return NULL; |
| 8465 | } |
| 8466 | return ret; |
| 8467 | } |
| 8468 | UPB_INLINE google_protobuf_FieldOptions_EditionDefault* google_protobuf_FieldOptions_EditionDefault_parse_ex(const char* buf, size_t size, |
| 8469 | const upb_ExtensionRegistry* extreg, |
| 8470 | int options, upb_Arena* arena) { |
| 8471 | google_protobuf_FieldOptions_EditionDefault* ret = google_protobuf_FieldOptions_EditionDefault_new(arena); |
| 8472 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 8473 | if (upb_Decode(buf, size, ret, &google__protobuf__FieldOptions__EditionDefault_msg_init, extreg, options, arena) != |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8474 | kUpb_DecodeStatus_Ok) { |
| 8475 | return NULL; |
| 8476 | } |
| 8477 | return ret; |
| 8478 | } |
| 8479 | UPB_INLINE char* google_protobuf_FieldOptions_EditionDefault_serialize(const google_protobuf_FieldOptions_EditionDefault* msg, upb_Arena* arena, size_t* len) { |
| 8480 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 8481 | (void)upb_Encode(msg, &google__protobuf__FieldOptions__EditionDefault_msg_init, 0, arena, &ptr, len); |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8482 | return ptr; |
| 8483 | } |
| 8484 | UPB_INLINE char* google_protobuf_FieldOptions_EditionDefault_serialize_ex(const google_protobuf_FieldOptions_EditionDefault* msg, int options, |
| 8485 | upb_Arena* arena, size_t* len) { |
| 8486 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 8487 | (void)upb_Encode(msg, &google__protobuf__FieldOptions__EditionDefault_msg_init, options, arena, &ptr, len); |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8488 | return ptr; |
| 8489 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8490 | UPB_INLINE void google_protobuf_FieldOptions_EditionDefault_clear_value(google_protobuf_FieldOptions_EditionDefault* msg) { |
Protobuf Team Bot | ab58f8f | 2023-09-26 16:14:19 +0000 | [diff] [blame] | 8491 | const upb_MiniTableField field = {2, 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] | 8492 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 8493 | } |
| 8494 | UPB_INLINE upb_StringView google_protobuf_FieldOptions_EditionDefault_value(const google_protobuf_FieldOptions_EditionDefault* msg) { |
| 8495 | upb_StringView default_val = upb_StringView_FromString(""); |
| 8496 | upb_StringView ret; |
Protobuf Team Bot | ab58f8f | 2023-09-26 16:14:19 +0000 | [diff] [blame] | 8497 | const upb_MiniTableField field = {2, 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] | 8498 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 8499 | return ret; |
| 8500 | } |
| 8501 | UPB_INLINE bool google_protobuf_FieldOptions_EditionDefault_has_value(const google_protobuf_FieldOptions_EditionDefault* msg) { |
Protobuf Team Bot | ab58f8f | 2023-09-26 16:14:19 +0000 | [diff] [blame] | 8502 | const upb_MiniTableField field = {2, 8, 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Protobuf Team Bot | fa98bb3 | 2023-09-01 18:11:09 +0000 | [diff] [blame] | 8503 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 8504 | } |
Protobuf Team Bot | ab58f8f | 2023-09-26 16:14:19 +0000 | [diff] [blame] | 8505 | UPB_INLINE void google_protobuf_FieldOptions_EditionDefault_clear_edition(google_protobuf_FieldOptions_EditionDefault* msg) { |
| 8506 | const upb_MiniTableField field = {3, 4, 2, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Protobuf Team Bot | fa98bb3 | 2023-09-01 18:11:09 +0000 | [diff] [blame] | 8507 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 8508 | } |
Protobuf Team Bot | ab58f8f | 2023-09-26 16:14:19 +0000 | [diff] [blame] | 8509 | UPB_INLINE int32_t google_protobuf_FieldOptions_EditionDefault_edition(const google_protobuf_FieldOptions_EditionDefault* msg) { |
Protobuf Team Bot | fa98bb3 | 2023-09-01 18:11:09 +0000 | [diff] [blame] | 8510 | int32_t default_val = 0; |
| 8511 | int32_t ret; |
Protobuf Team Bot | ab58f8f | 2023-09-26 16:14:19 +0000 | [diff] [blame] | 8512 | const upb_MiniTableField field = {3, 4, 2, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Protobuf Team Bot | fa98bb3 | 2023-09-01 18:11:09 +0000 | [diff] [blame] | 8513 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 8514 | return ret; |
| 8515 | } |
Protobuf Team Bot | ab58f8f | 2023-09-26 16:14:19 +0000 | [diff] [blame] | 8516 | UPB_INLINE bool google_protobuf_FieldOptions_EditionDefault_has_edition(const google_protobuf_FieldOptions_EditionDefault* msg) { |
| 8517 | const upb_MiniTableField field = {3, 4, 2, 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] | 8518 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 8519 | } |
| 8520 | |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8521 | UPB_INLINE void google_protobuf_FieldOptions_EditionDefault_set_value(google_protobuf_FieldOptions_EditionDefault *msg, upb_StringView value) { |
Protobuf Team Bot | ab58f8f | 2023-09-26 16:14:19 +0000 | [diff] [blame] | 8522 | const upb_MiniTableField field = {2, 8, 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Protobuf Team Bot | fa98bb3 | 2023-09-01 18:11:09 +0000 | [diff] [blame] | 8523 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 8524 | } |
Protobuf Team Bot | ab58f8f | 2023-09-26 16:14:19 +0000 | [diff] [blame] | 8525 | UPB_INLINE void google_protobuf_FieldOptions_EditionDefault_set_edition(google_protobuf_FieldOptions_EditionDefault *msg, int32_t value) { |
| 8526 | const upb_MiniTableField field = {3, 4, 2, 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] | 8527 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 8528 | } |
| 8529 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8530 | /* google.protobuf.OneofOptions */ |
| 8531 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8532 | UPB_INLINE google_protobuf_OneofOptions* google_protobuf_OneofOptions_new(upb_Arena* arena) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 8533 | 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] | 8534 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8535 | UPB_INLINE google_protobuf_OneofOptions* google_protobuf_OneofOptions_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 8536 | google_protobuf_OneofOptions* ret = google_protobuf_OneofOptions_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 8537 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 8538 | 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] | 8539 | return NULL; |
| 8540 | } |
| 8541 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8542 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8543 | UPB_INLINE google_protobuf_OneofOptions* google_protobuf_OneofOptions_parse_ex(const char* buf, size_t size, |
| 8544 | const upb_ExtensionRegistry* extreg, |
| 8545 | int options, upb_Arena* arena) { |
| 8546 | google_protobuf_OneofOptions* ret = google_protobuf_OneofOptions_new(arena); |
| 8547 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 8548 | 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] | 8549 | kUpb_DecodeStatus_Ok) { |
| 8550 | return NULL; |
| 8551 | } |
| 8552 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8553 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8554 | 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] | 8555 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 8556 | (void)upb_Encode(msg, &google__protobuf__OneofOptions_msg_init, 0, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8557 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8558 | } |
| 8559 | UPB_INLINE char* google_protobuf_OneofOptions_serialize_ex(const google_protobuf_OneofOptions* msg, int options, |
| 8560 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8561 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 8562 | (void)upb_Encode(msg, &google__protobuf__OneofOptions_msg_init, options, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8563 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8564 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8565 | UPB_INLINE void google_protobuf_OneofOptions_clear_features(google_protobuf_OneofOptions* msg) { |
| 8566 | 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)}; |
| 8567 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 8568 | } |
| 8569 | UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_OneofOptions_features(const google_protobuf_OneofOptions* msg) { |
| 8570 | const google_protobuf_FeatureSet* default_val = NULL; |
| 8571 | const google_protobuf_FeatureSet* ret; |
| 8572 | 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)}; |
| 8573 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 8574 | return ret; |
| 8575 | } |
| 8576 | UPB_INLINE bool google_protobuf_OneofOptions_has_features(const google_protobuf_OneofOptions* msg) { |
| 8577 | 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)}; |
| 8578 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 8579 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8580 | 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] | 8581 | 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] | 8582 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8583 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 8584 | 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] | 8585 | 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] | 8586 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 8587 | if (arr) { |
| 8588 | if (size) *size = arr->size; |
| 8589 | return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr); |
| 8590 | } else { |
| 8591 | if (size) *size = 0; |
| 8592 | return NULL; |
| 8593 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8594 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 8595 | 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] | 8596 | 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] | 8597 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 8598 | if (size) { |
| 8599 | *size = arr ? arr->size : 0; |
| 8600 | } |
| 8601 | return arr; |
| 8602 | } |
| 8603 | 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] | 8604 | 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] | 8605 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 8606 | (upb_Message*)msg, &field, arena); |
| 8607 | if (size) { |
| 8608 | *size = arr ? arr->size : 0; |
| 8609 | } |
| 8610 | return arr; |
| 8611 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8612 | UPB_INLINE bool google_protobuf_OneofOptions_has_uninterpreted_option(const google_protobuf_OneofOptions* msg) { |
| 8613 | size_t size; |
| 8614 | google_protobuf_OneofOptions_uninterpreted_option(msg, &size); |
| 8615 | return size != 0; |
| 8616 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8617 | |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8618 | UPB_INLINE void google_protobuf_OneofOptions_set_features(google_protobuf_OneofOptions *msg, google_protobuf_FeatureSet* value) { |
| 8619 | 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)}; |
| 8620 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 8621 | } |
| 8622 | UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_OneofOptions_mutable_features(google_protobuf_OneofOptions* msg, upb_Arena* arena) { |
| 8623 | struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_OneofOptions_features(msg); |
| 8624 | if (sub == NULL) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 8625 | sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena); |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8626 | if (sub) google_protobuf_OneofOptions_set_features(msg, sub); |
| 8627 | } |
| 8628 | return sub; |
| 8629 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 8630 | 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] | 8631 | 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] | 8632 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 8633 | if (arr) { |
| 8634 | if (size) *size = arr->size; |
| 8635 | return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr); |
| 8636 | } else { |
| 8637 | if (size) *size = 0; |
| 8638 | return NULL; |
| 8639 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8640 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 8641 | 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] | 8642 | 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] | 8643 | return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8644 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8645 | 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] | 8646 | 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] | 8647 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 8648 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 8649 | return NULL; |
| 8650 | } |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 8651 | 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] | 8652 | if (!arr || !sub) return NULL; |
| 8653 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8654 | return sub; |
| 8655 | } |
| 8656 | |
| 8657 | /* google.protobuf.EnumOptions */ |
| 8658 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8659 | UPB_INLINE google_protobuf_EnumOptions* google_protobuf_EnumOptions_new(upb_Arena* arena) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 8660 | 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] | 8661 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8662 | UPB_INLINE google_protobuf_EnumOptions* google_protobuf_EnumOptions_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 8663 | google_protobuf_EnumOptions* ret = google_protobuf_EnumOptions_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 8664 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 8665 | 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] | 8666 | return NULL; |
| 8667 | } |
| 8668 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8669 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8670 | UPB_INLINE google_protobuf_EnumOptions* google_protobuf_EnumOptions_parse_ex(const char* buf, size_t size, |
| 8671 | const upb_ExtensionRegistry* extreg, |
| 8672 | int options, upb_Arena* arena) { |
| 8673 | google_protobuf_EnumOptions* ret = google_protobuf_EnumOptions_new(arena); |
| 8674 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 8675 | 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] | 8676 | kUpb_DecodeStatus_Ok) { |
| 8677 | return NULL; |
| 8678 | } |
| 8679 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8680 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8681 | 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] | 8682 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 8683 | (void)upb_Encode(msg, &google__protobuf__EnumOptions_msg_init, 0, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8684 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8685 | } |
| 8686 | UPB_INLINE char* google_protobuf_EnumOptions_serialize_ex(const google_protobuf_EnumOptions* msg, int options, |
| 8687 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8688 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 8689 | (void)upb_Encode(msg, &google__protobuf__EnumOptions_msg_init, options, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8690 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8691 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8692 | 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] | 8693 | 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] | 8694 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8695 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8696 | 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] | 8697 | bool default_val = false; |
| 8698 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8699 | 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] | 8700 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8701 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8702 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8703 | 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] | 8704 | 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] | 8705 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8706 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8707 | UPB_INLINE void google_protobuf_EnumOptions_clear_deprecated(google_protobuf_EnumOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8708 | 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] | 8709 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8710 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8711 | UPB_INLINE bool google_protobuf_EnumOptions_deprecated(const google_protobuf_EnumOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8712 | bool default_val = false; |
| 8713 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8714 | 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] | 8715 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8716 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8717 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8718 | 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] | 8719 | 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] | 8720 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8721 | } |
Mike Kruskal | 6b87d6f | 2022-12-14 10:36:53 -0800 | [diff] [blame] | 8722 | 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] | 8723 | 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] | 8724 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 8725 | } |
| 8726 | UPB_INLINE bool google_protobuf_EnumOptions_deprecated_legacy_json_field_conflicts(const google_protobuf_EnumOptions* msg) { |
| 8727 | bool default_val = false; |
| 8728 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8729 | 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] | 8730 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 8731 | return ret; |
| 8732 | } |
| 8733 | 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] | 8734 | 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] | 8735 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 8736 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8737 | UPB_INLINE void google_protobuf_EnumOptions_clear_features(google_protobuf_EnumOptions* msg) { |
| 8738 | 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)}; |
| 8739 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 8740 | } |
| 8741 | UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_EnumOptions_features(const google_protobuf_EnumOptions* msg) { |
| 8742 | const google_protobuf_FeatureSet* default_val = NULL; |
| 8743 | const google_protobuf_FeatureSet* ret; |
| 8744 | 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)}; |
| 8745 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 8746 | return ret; |
| 8747 | } |
| 8748 | UPB_INLINE bool google_protobuf_EnumOptions_has_features(const google_protobuf_EnumOptions* msg) { |
| 8749 | 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)}; |
| 8750 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 8751 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8752 | 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] | 8753 | 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] | 8754 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8755 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 8756 | 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] | 8757 | 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] | 8758 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 8759 | if (arr) { |
| 8760 | if (size) *size = arr->size; |
| 8761 | return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr); |
| 8762 | } else { |
| 8763 | if (size) *size = 0; |
| 8764 | return NULL; |
| 8765 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8766 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 8767 | 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] | 8768 | 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] | 8769 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 8770 | if (size) { |
| 8771 | *size = arr ? arr->size : 0; |
| 8772 | } |
| 8773 | return arr; |
| 8774 | } |
| 8775 | 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] | 8776 | 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] | 8777 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 8778 | (upb_Message*)msg, &field, arena); |
| 8779 | if (size) { |
| 8780 | *size = arr ? arr->size : 0; |
| 8781 | } |
| 8782 | return arr; |
| 8783 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8784 | UPB_INLINE bool google_protobuf_EnumOptions_has_uninterpreted_option(const google_protobuf_EnumOptions* msg) { |
| 8785 | size_t size; |
| 8786 | google_protobuf_EnumOptions_uninterpreted_option(msg, &size); |
| 8787 | return size != 0; |
| 8788 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8789 | |
| 8790 | 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] | 8791 | 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] | 8792 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8793 | } |
| 8794 | 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] | 8795 | 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] | 8796 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8797 | } |
| 8798 | 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] | 8799 | 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] | 8800 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8801 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8802 | UPB_INLINE void google_protobuf_EnumOptions_set_features(google_protobuf_EnumOptions *msg, google_protobuf_FeatureSet* value) { |
| 8803 | 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)}; |
| 8804 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 8805 | } |
| 8806 | UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_EnumOptions_mutable_features(google_protobuf_EnumOptions* msg, upb_Arena* arena) { |
| 8807 | struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_EnumOptions_features(msg); |
| 8808 | if (sub == NULL) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 8809 | sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena); |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8810 | if (sub) google_protobuf_EnumOptions_set_features(msg, sub); |
| 8811 | } |
| 8812 | return sub; |
| 8813 | } |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8814 | 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] | 8815 | 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] | 8816 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 8817 | if (arr) { |
| 8818 | if (size) *size = arr->size; |
| 8819 | return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr); |
| 8820 | } else { |
| 8821 | if (size) *size = 0; |
| 8822 | return NULL; |
| 8823 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8824 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 8825 | 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] | 8826 | 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] | 8827 | return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8828 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8829 | 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] | 8830 | 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] | 8831 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 8832 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 8833 | return NULL; |
| 8834 | } |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 8835 | 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] | 8836 | if (!arr || !sub) return NULL; |
| 8837 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8838 | return sub; |
| 8839 | } |
| 8840 | |
| 8841 | /* google.protobuf.EnumValueOptions */ |
| 8842 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8843 | UPB_INLINE google_protobuf_EnumValueOptions* google_protobuf_EnumValueOptions_new(upb_Arena* arena) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 8844 | 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] | 8845 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8846 | UPB_INLINE google_protobuf_EnumValueOptions* google_protobuf_EnumValueOptions_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 8847 | google_protobuf_EnumValueOptions* ret = google_protobuf_EnumValueOptions_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 8848 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 8849 | 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] | 8850 | return NULL; |
| 8851 | } |
| 8852 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8853 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8854 | UPB_INLINE google_protobuf_EnumValueOptions* google_protobuf_EnumValueOptions_parse_ex(const char* buf, size_t size, |
| 8855 | const upb_ExtensionRegistry* extreg, |
| 8856 | int options, upb_Arena* arena) { |
| 8857 | google_protobuf_EnumValueOptions* ret = google_protobuf_EnumValueOptions_new(arena); |
| 8858 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 8859 | 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] | 8860 | kUpb_DecodeStatus_Ok) { |
| 8861 | return NULL; |
| 8862 | } |
| 8863 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8864 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8865 | 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] | 8866 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 8867 | (void)upb_Encode(msg, &google__protobuf__EnumValueOptions_msg_init, 0, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8868 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8869 | } |
| 8870 | UPB_INLINE char* google_protobuf_EnumValueOptions_serialize_ex(const google_protobuf_EnumValueOptions* msg, int options, |
| 8871 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8872 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 8873 | (void)upb_Encode(msg, &google__protobuf__EnumValueOptions_msg_init, options, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8874 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8875 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8876 | UPB_INLINE void google_protobuf_EnumValueOptions_clear_deprecated(google_protobuf_EnumValueOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8877 | 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] | 8878 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8879 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8880 | UPB_INLINE bool google_protobuf_EnumValueOptions_deprecated(const google_protobuf_EnumValueOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8881 | bool default_val = false; |
| 8882 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8883 | 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] | 8884 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8885 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8886 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8887 | 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] | 8888 | 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] | 8889 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8890 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8891 | UPB_INLINE void google_protobuf_EnumValueOptions_clear_features(google_protobuf_EnumValueOptions* msg) { |
| 8892 | 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)}; |
| 8893 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 8894 | } |
| 8895 | UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_EnumValueOptions_features(const google_protobuf_EnumValueOptions* msg) { |
| 8896 | const google_protobuf_FeatureSet* default_val = NULL; |
| 8897 | const google_protobuf_FeatureSet* ret; |
| 8898 | 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)}; |
| 8899 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 8900 | return ret; |
| 8901 | } |
| 8902 | UPB_INLINE bool google_protobuf_EnumValueOptions_has_features(const google_protobuf_EnumValueOptions* msg) { |
| 8903 | 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)}; |
| 8904 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 8905 | } |
Mike Kruskal | 12e0f1d | 2023-05-31 15:40:54 -0700 | [diff] [blame] | 8906 | 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] | 8907 | 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] | 8908 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 8909 | } |
| 8910 | UPB_INLINE bool google_protobuf_EnumValueOptions_debug_redact(const google_protobuf_EnumValueOptions* msg) { |
| 8911 | bool default_val = false; |
| 8912 | bool ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8913 | 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] | 8914 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 8915 | return ret; |
| 8916 | } |
| 8917 | 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] | 8918 | 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] | 8919 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 8920 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8921 | 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] | 8922 | 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] | 8923 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8924 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 8925 | 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] | 8926 | 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] | 8927 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 8928 | if (arr) { |
| 8929 | if (size) *size = arr->size; |
| 8930 | return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr); |
| 8931 | } else { |
| 8932 | if (size) *size = 0; |
| 8933 | return NULL; |
| 8934 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8935 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 8936 | 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] | 8937 | 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] | 8938 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 8939 | if (size) { |
| 8940 | *size = arr ? arr->size : 0; |
| 8941 | } |
| 8942 | return arr; |
| 8943 | } |
| 8944 | 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] | 8945 | 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] | 8946 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 8947 | (upb_Message*)msg, &field, arena); |
| 8948 | if (size) { |
| 8949 | *size = arr ? arr->size : 0; |
| 8950 | } |
| 8951 | return arr; |
| 8952 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8953 | UPB_INLINE bool google_protobuf_EnumValueOptions_has_uninterpreted_option(const google_protobuf_EnumValueOptions* msg) { |
| 8954 | size_t size; |
| 8955 | google_protobuf_EnumValueOptions_uninterpreted_option(msg, &size); |
| 8956 | return size != 0; |
| 8957 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8958 | |
| 8959 | 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] | 8960 | 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] | 8961 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8962 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8963 | UPB_INLINE void google_protobuf_EnumValueOptions_set_features(google_protobuf_EnumValueOptions *msg, google_protobuf_FeatureSet* value) { |
| 8964 | 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)}; |
| 8965 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 8966 | } |
| 8967 | UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_EnumValueOptions_mutable_features(google_protobuf_EnumValueOptions* msg, upb_Arena* arena) { |
| 8968 | struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_EnumValueOptions_features(msg); |
| 8969 | if (sub == NULL) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 8970 | sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena); |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8971 | if (sub) google_protobuf_EnumValueOptions_set_features(msg, sub); |
| 8972 | } |
| 8973 | return sub; |
| 8974 | } |
Mike Kruskal | 12e0f1d | 2023-05-31 15:40:54 -0700 | [diff] [blame] | 8975 | 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] | 8976 | 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] | 8977 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 8978 | } |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8979 | 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] | 8980 | 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] | 8981 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 8982 | if (arr) { |
| 8983 | if (size) *size = arr->size; |
| 8984 | return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr); |
| 8985 | } else { |
| 8986 | if (size) *size = 0; |
| 8987 | return NULL; |
| 8988 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8989 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 8990 | 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] | 8991 | 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] | 8992 | return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8993 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8994 | 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] | 8995 | 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] | 8996 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 8997 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 8998 | return NULL; |
| 8999 | } |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9000 | 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] | 9001 | if (!arr || !sub) return NULL; |
| 9002 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9003 | return sub; |
| 9004 | } |
| 9005 | |
| 9006 | /* google.protobuf.ServiceOptions */ |
| 9007 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9008 | UPB_INLINE google_protobuf_ServiceOptions* google_protobuf_ServiceOptions_new(upb_Arena* arena) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9009 | 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] | 9010 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9011 | UPB_INLINE google_protobuf_ServiceOptions* google_protobuf_ServiceOptions_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 9012 | google_protobuf_ServiceOptions* ret = google_protobuf_ServiceOptions_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 9013 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9014 | 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] | 9015 | return NULL; |
| 9016 | } |
| 9017 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9018 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9019 | UPB_INLINE google_protobuf_ServiceOptions* google_protobuf_ServiceOptions_parse_ex(const char* buf, size_t size, |
| 9020 | const upb_ExtensionRegistry* extreg, |
| 9021 | int options, upb_Arena* arena) { |
| 9022 | google_protobuf_ServiceOptions* ret = google_protobuf_ServiceOptions_new(arena); |
| 9023 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9024 | 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] | 9025 | kUpb_DecodeStatus_Ok) { |
| 9026 | return NULL; |
| 9027 | } |
| 9028 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9029 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9030 | 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] | 9031 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9032 | (void)upb_Encode(msg, &google__protobuf__ServiceOptions_msg_init, 0, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9033 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9034 | } |
| 9035 | UPB_INLINE char* google_protobuf_ServiceOptions_serialize_ex(const google_protobuf_ServiceOptions* msg, int options, |
| 9036 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9037 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9038 | (void)upb_Encode(msg, &google__protobuf__ServiceOptions_msg_init, options, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9039 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9040 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9041 | UPB_INLINE void google_protobuf_ServiceOptions_clear_deprecated(google_protobuf_ServiceOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9042 | 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] | 9043 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9044 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9045 | UPB_INLINE bool google_protobuf_ServiceOptions_deprecated(const google_protobuf_ServiceOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 9046 | bool default_val = false; |
| 9047 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9048 | 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] | 9049 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 9050 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9051 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9052 | 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] | 9053 | 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] | 9054 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9055 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9056 | UPB_INLINE void google_protobuf_ServiceOptions_clear_features(google_protobuf_ServiceOptions* msg) { |
| 9057 | 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)}; |
| 9058 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 9059 | } |
| 9060 | UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_ServiceOptions_features(const google_protobuf_ServiceOptions* msg) { |
| 9061 | const google_protobuf_FeatureSet* default_val = NULL; |
| 9062 | const google_protobuf_FeatureSet* ret; |
| 9063 | 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)}; |
| 9064 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 9065 | return ret; |
| 9066 | } |
| 9067 | UPB_INLINE bool google_protobuf_ServiceOptions_has_features(const google_protobuf_ServiceOptions* msg) { |
| 9068 | 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)}; |
| 9069 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 9070 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9071 | 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] | 9072 | 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] | 9073 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9074 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9075 | 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] | 9076 | 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] | 9077 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 9078 | if (arr) { |
| 9079 | if (size) *size = arr->size; |
| 9080 | return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr); |
| 9081 | } else { |
| 9082 | if (size) *size = 0; |
| 9083 | return NULL; |
| 9084 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9085 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 9086 | 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] | 9087 | 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] | 9088 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 9089 | if (size) { |
| 9090 | *size = arr ? arr->size : 0; |
| 9091 | } |
| 9092 | return arr; |
| 9093 | } |
| 9094 | 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] | 9095 | 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] | 9096 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 9097 | (upb_Message*)msg, &field, arena); |
| 9098 | if (size) { |
| 9099 | *size = arr ? arr->size : 0; |
| 9100 | } |
| 9101 | return arr; |
| 9102 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9103 | UPB_INLINE bool google_protobuf_ServiceOptions_has_uninterpreted_option(const google_protobuf_ServiceOptions* msg) { |
| 9104 | size_t size; |
| 9105 | google_protobuf_ServiceOptions_uninterpreted_option(msg, &size); |
| 9106 | return size != 0; |
| 9107 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9108 | |
| 9109 | 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] | 9110 | 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] | 9111 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 9112 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9113 | UPB_INLINE void google_protobuf_ServiceOptions_set_features(google_protobuf_ServiceOptions *msg, google_protobuf_FeatureSet* value) { |
| 9114 | 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)}; |
| 9115 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 9116 | } |
| 9117 | UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_ServiceOptions_mutable_features(google_protobuf_ServiceOptions* msg, upb_Arena* arena) { |
| 9118 | struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_ServiceOptions_features(msg); |
| 9119 | if (sub == NULL) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9120 | sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena); |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9121 | if (sub) google_protobuf_ServiceOptions_set_features(msg, sub); |
| 9122 | } |
| 9123 | return sub; |
| 9124 | } |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 9125 | 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] | 9126 | 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] | 9127 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 9128 | if (arr) { |
| 9129 | if (size) *size = arr->size; |
| 9130 | return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr); |
| 9131 | } else { |
| 9132 | if (size) *size = 0; |
| 9133 | return NULL; |
| 9134 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9135 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9136 | 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] | 9137 | 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] | 9138 | return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9139 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9140 | 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] | 9141 | 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] | 9142 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 9143 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 9144 | return NULL; |
| 9145 | } |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9146 | 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] | 9147 | if (!arr || !sub) return NULL; |
| 9148 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9149 | return sub; |
| 9150 | } |
| 9151 | |
| 9152 | /* google.protobuf.MethodOptions */ |
| 9153 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9154 | UPB_INLINE google_protobuf_MethodOptions* google_protobuf_MethodOptions_new(upb_Arena* arena) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9155 | 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] | 9156 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9157 | UPB_INLINE google_protobuf_MethodOptions* google_protobuf_MethodOptions_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 9158 | google_protobuf_MethodOptions* ret = google_protobuf_MethodOptions_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 9159 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9160 | 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] | 9161 | return NULL; |
| 9162 | } |
| 9163 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9164 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9165 | UPB_INLINE google_protobuf_MethodOptions* google_protobuf_MethodOptions_parse_ex(const char* buf, size_t size, |
| 9166 | const upb_ExtensionRegistry* extreg, |
| 9167 | int options, upb_Arena* arena) { |
| 9168 | google_protobuf_MethodOptions* ret = google_protobuf_MethodOptions_new(arena); |
| 9169 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9170 | 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] | 9171 | kUpb_DecodeStatus_Ok) { |
| 9172 | return NULL; |
| 9173 | } |
| 9174 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9175 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9176 | 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] | 9177 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9178 | (void)upb_Encode(msg, &google__protobuf__MethodOptions_msg_init, 0, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9179 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9180 | } |
| 9181 | UPB_INLINE char* google_protobuf_MethodOptions_serialize_ex(const google_protobuf_MethodOptions* msg, int options, |
| 9182 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9183 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9184 | (void)upb_Encode(msg, &google__protobuf__MethodOptions_msg_init, options, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9185 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9186 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9187 | UPB_INLINE void google_protobuf_MethodOptions_clear_deprecated(google_protobuf_MethodOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9188 | 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] | 9189 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9190 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9191 | UPB_INLINE bool google_protobuf_MethodOptions_deprecated(const google_protobuf_MethodOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 9192 | bool default_val = false; |
| 9193 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9194 | 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] | 9195 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 9196 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9197 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9198 | 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] | 9199 | 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] | 9200 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9201 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9202 | 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] | 9203 | 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] | 9204 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9205 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9206 | 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] | 9207 | int32_t default_val = 0; |
| 9208 | int32_t ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9209 | 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] | 9210 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 9211 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9212 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9213 | 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] | 9214 | const upb_MiniTableField field = {34, 4, 2, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
| 9215 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 9216 | } |
| 9217 | UPB_INLINE void google_protobuf_MethodOptions_clear_features(google_protobuf_MethodOptions* msg) { |
| 9218 | 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)}; |
| 9219 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 9220 | } |
| 9221 | UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_MethodOptions_features(const google_protobuf_MethodOptions* msg) { |
| 9222 | const google_protobuf_FeatureSet* default_val = NULL; |
| 9223 | const google_protobuf_FeatureSet* ret; |
| 9224 | 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)}; |
| 9225 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 9226 | return ret; |
| 9227 | } |
| 9228 | UPB_INLINE bool google_protobuf_MethodOptions_has_features(const google_protobuf_MethodOptions* msg) { |
| 9229 | 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] | 9230 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9231 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9232 | 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] | 9233 | 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] | 9234 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9235 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9236 | 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] | 9237 | 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] | 9238 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 9239 | if (arr) { |
| 9240 | if (size) *size = arr->size; |
| 9241 | return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr); |
| 9242 | } else { |
| 9243 | if (size) *size = 0; |
| 9244 | return NULL; |
| 9245 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9246 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 9247 | 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] | 9248 | 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] | 9249 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 9250 | if (size) { |
| 9251 | *size = arr ? arr->size : 0; |
| 9252 | } |
| 9253 | return arr; |
| 9254 | } |
| 9255 | 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] | 9256 | 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] | 9257 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 9258 | (upb_Message*)msg, &field, arena); |
| 9259 | if (size) { |
| 9260 | *size = arr ? arr->size : 0; |
| 9261 | } |
| 9262 | return arr; |
| 9263 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9264 | UPB_INLINE bool google_protobuf_MethodOptions_has_uninterpreted_option(const google_protobuf_MethodOptions* msg) { |
| 9265 | size_t size; |
| 9266 | google_protobuf_MethodOptions_uninterpreted_option(msg, &size); |
| 9267 | return size != 0; |
| 9268 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9269 | |
| 9270 | 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] | 9271 | 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] | 9272 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 9273 | } |
| 9274 | 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] | 9275 | 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] | 9276 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 9277 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9278 | UPB_INLINE void google_protobuf_MethodOptions_set_features(google_protobuf_MethodOptions *msg, google_protobuf_FeatureSet* value) { |
| 9279 | 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)}; |
| 9280 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 9281 | } |
| 9282 | UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_MethodOptions_mutable_features(google_protobuf_MethodOptions* msg, upb_Arena* arena) { |
| 9283 | struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_MethodOptions_features(msg); |
| 9284 | if (sub == NULL) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9285 | sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena); |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9286 | if (sub) google_protobuf_MethodOptions_set_features(msg, sub); |
| 9287 | } |
| 9288 | return sub; |
| 9289 | } |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 9290 | 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] | 9291 | 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] | 9292 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 9293 | if (arr) { |
| 9294 | if (size) *size = arr->size; |
| 9295 | return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr); |
| 9296 | } else { |
| 9297 | if (size) *size = 0; |
| 9298 | return NULL; |
| 9299 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9300 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9301 | 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] | 9302 | 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] | 9303 | return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9304 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9305 | 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] | 9306 | 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] | 9307 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 9308 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 9309 | return NULL; |
| 9310 | } |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9311 | 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] | 9312 | if (!arr || !sub) return NULL; |
| 9313 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9314 | return sub; |
| 9315 | } |
| 9316 | |
| 9317 | /* google.protobuf.UninterpretedOption */ |
| 9318 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9319 | UPB_INLINE google_protobuf_UninterpretedOption* google_protobuf_UninterpretedOption_new(upb_Arena* arena) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9320 | 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] | 9321 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9322 | UPB_INLINE google_protobuf_UninterpretedOption* google_protobuf_UninterpretedOption_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 9323 | google_protobuf_UninterpretedOption* ret = google_protobuf_UninterpretedOption_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 9324 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9325 | 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] | 9326 | return NULL; |
| 9327 | } |
| 9328 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9329 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9330 | UPB_INLINE google_protobuf_UninterpretedOption* google_protobuf_UninterpretedOption_parse_ex(const char* buf, size_t size, |
| 9331 | const upb_ExtensionRegistry* extreg, |
| 9332 | int options, upb_Arena* arena) { |
| 9333 | google_protobuf_UninterpretedOption* ret = google_protobuf_UninterpretedOption_new(arena); |
| 9334 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9335 | 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] | 9336 | kUpb_DecodeStatus_Ok) { |
| 9337 | return NULL; |
| 9338 | } |
| 9339 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9340 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9341 | 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] | 9342 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9343 | (void)upb_Encode(msg, &google__protobuf__UninterpretedOption_msg_init, 0, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9344 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9345 | } |
| 9346 | UPB_INLINE char* google_protobuf_UninterpretedOption_serialize_ex(const google_protobuf_UninterpretedOption* msg, int options, |
| 9347 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9348 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9349 | (void)upb_Encode(msg, &google__protobuf__UninterpretedOption_msg_init, options, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9350 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9351 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9352 | UPB_INLINE void google_protobuf_UninterpretedOption_clear_name(google_protobuf_UninterpretedOption* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9353 | 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] | 9354 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9355 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9356 | 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] | 9357 | 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] | 9358 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 9359 | if (arr) { |
| 9360 | if (size) *size = arr->size; |
| 9361 | return (const google_protobuf_UninterpretedOption_NamePart* const*)_upb_array_constptr(arr); |
| 9362 | } else { |
| 9363 | if (size) *size = 0; |
| 9364 | return NULL; |
| 9365 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9366 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 9367 | 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] | 9368 | 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] | 9369 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 9370 | if (size) { |
| 9371 | *size = arr ? arr->size : 0; |
| 9372 | } |
| 9373 | return arr; |
| 9374 | } |
| 9375 | 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] | 9376 | 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] | 9377 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 9378 | (upb_Message*)msg, &field, arena); |
| 9379 | if (size) { |
| 9380 | *size = arr ? arr->size : 0; |
| 9381 | } |
| 9382 | return arr; |
| 9383 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9384 | UPB_INLINE bool google_protobuf_UninterpretedOption_has_name(const google_protobuf_UninterpretedOption* msg) { |
| 9385 | size_t size; |
| 9386 | google_protobuf_UninterpretedOption_name(msg, &size); |
| 9387 | return size != 0; |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9388 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9389 | 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] | 9390 | 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] | 9391 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9392 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9393 | 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] | 9394 | upb_StringView default_val = upb_StringView_FromString(""); |
| 9395 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9396 | 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] | 9397 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 9398 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9399 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9400 | 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] | 9401 | 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] | 9402 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9403 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9404 | 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] | 9405 | 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] | 9406 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9407 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9408 | 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] | 9409 | uint64_t default_val = (uint64_t)0ull; |
| 9410 | uint64_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9411 | 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] | 9412 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 9413 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9414 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9415 | 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] | 9416 | 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] | 9417 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9418 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9419 | 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] | 9420 | 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] | 9421 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9422 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9423 | 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] | 9424 | int64_t default_val = (int64_t)0ll; |
| 9425 | int64_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9426 | 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] | 9427 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 9428 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9429 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9430 | 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] | 9431 | 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] | 9432 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9433 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9434 | 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] | 9435 | 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] | 9436 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9437 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9438 | 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] | 9439 | double default_val = 0; |
| 9440 | double ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9441 | 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] | 9442 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 9443 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9444 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9445 | 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] | 9446 | 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] | 9447 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9448 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9449 | 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] | 9450 | 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] | 9451 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9452 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9453 | 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] | 9454 | upb_StringView default_val = upb_StringView_FromString(""); |
| 9455 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9456 | 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] | 9457 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 9458 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9459 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9460 | 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] | 9461 | 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] | 9462 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9463 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9464 | 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] | 9465 | 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] | 9466 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9467 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9468 | 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] | 9469 | upb_StringView default_val = upb_StringView_FromString(""); |
| 9470 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9471 | 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] | 9472 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 9473 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9474 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9475 | 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] | 9476 | 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] | 9477 | return _upb_Message_HasNonExtensionField(msg, &field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9478 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9479 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9480 | 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] | 9481 | 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] | 9482 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 9483 | if (arr) { |
| 9484 | if (size) *size = arr->size; |
| 9485 | return (google_protobuf_UninterpretedOption_NamePart**)_upb_array_ptr(arr); |
| 9486 | } else { |
| 9487 | if (size) *size = 0; |
| 9488 | return NULL; |
| 9489 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9490 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9491 | 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] | 9492 | 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] | 9493 | return (google_protobuf_UninterpretedOption_NamePart**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9494 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9495 | 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] | 9496 | 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] | 9497 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 9498 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 9499 | return NULL; |
| 9500 | } |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9501 | 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] | 9502 | if (!arr || !sub) return NULL; |
| 9503 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9504 | return sub; |
| 9505 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9506 | 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] | 9507 | 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] | 9508 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 9509 | } |
| 9510 | 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] | 9511 | 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] | 9512 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 9513 | } |
| 9514 | 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] | 9515 | 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] | 9516 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 9517 | } |
| 9518 | 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] | 9519 | 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] | 9520 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 9521 | } |
| 9522 | 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] | 9523 | 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] | 9524 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 9525 | } |
| 9526 | 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] | 9527 | 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] | 9528 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9529 | } |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 9530 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9531 | /* google.protobuf.UninterpretedOption.NamePart */ |
| 9532 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9533 | UPB_INLINE google_protobuf_UninterpretedOption_NamePart* google_protobuf_UninterpretedOption_NamePart_new(upb_Arena* arena) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9534 | 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] | 9535 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9536 | UPB_INLINE google_protobuf_UninterpretedOption_NamePart* google_protobuf_UninterpretedOption_NamePart_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 9537 | google_protobuf_UninterpretedOption_NamePart* ret = google_protobuf_UninterpretedOption_NamePart_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 9538 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9539 | 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] | 9540 | return NULL; |
| 9541 | } |
| 9542 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9543 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9544 | UPB_INLINE google_protobuf_UninterpretedOption_NamePart* google_protobuf_UninterpretedOption_NamePart_parse_ex(const char* buf, size_t size, |
| 9545 | const upb_ExtensionRegistry* extreg, |
| 9546 | int options, upb_Arena* arena) { |
| 9547 | google_protobuf_UninterpretedOption_NamePart* ret = google_protobuf_UninterpretedOption_NamePart_new(arena); |
| 9548 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9549 | 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] | 9550 | kUpb_DecodeStatus_Ok) { |
| 9551 | return NULL; |
| 9552 | } |
| 9553 | return ret; |
| 9554 | } |
| 9555 | 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] | 9556 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9557 | (void)upb_Encode(msg, &google__protobuf__UninterpretedOption__NamePart_msg_init, 0, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9558 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9559 | } |
| 9560 | UPB_INLINE char* google_protobuf_UninterpretedOption_NamePart_serialize_ex(const google_protobuf_UninterpretedOption_NamePart* msg, int options, |
| 9561 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9562 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9563 | (void)upb_Encode(msg, &google__protobuf__UninterpretedOption__NamePart_msg_init, options, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9564 | return ptr; |
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 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] | 9567 | 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] | 9568 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9569 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9570 | 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] | 9571 | upb_StringView default_val = upb_StringView_FromString(""); |
| 9572 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9573 | 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] | 9574 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 9575 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9576 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9577 | 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] | 9578 | 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] | 9579 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9580 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9581 | 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] | 9582 | 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] | 9583 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9584 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9585 | 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] | 9586 | bool default_val = false; |
| 9587 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9588 | 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] | 9589 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 9590 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9591 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9592 | 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] | 9593 | 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] | 9594 | return _upb_Message_HasNonExtensionField(msg, &field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9595 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9596 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9597 | 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] | 9598 | 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] | 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_NamePart_set_is_extension(google_protobuf_UninterpretedOption_NamePart *msg, bool value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9602 | 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] | 9603 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9604 | } |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 9605 | |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9606 | /* google.protobuf.FeatureSet */ |
| 9607 | |
| 9608 | UPB_INLINE google_protobuf_FeatureSet* google_protobuf_FeatureSet_new(upb_Arena* arena) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9609 | return (google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena); |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9610 | } |
| 9611 | UPB_INLINE google_protobuf_FeatureSet* google_protobuf_FeatureSet_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 9612 | google_protobuf_FeatureSet* ret = google_protobuf_FeatureSet_new(arena); |
| 9613 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9614 | if (upb_Decode(buf, size, ret, &google__protobuf__FeatureSet_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9615 | return NULL; |
| 9616 | } |
| 9617 | return ret; |
| 9618 | } |
| 9619 | UPB_INLINE google_protobuf_FeatureSet* google_protobuf_FeatureSet_parse_ex(const char* buf, size_t size, |
| 9620 | const upb_ExtensionRegistry* extreg, |
| 9621 | int options, upb_Arena* arena) { |
| 9622 | google_protobuf_FeatureSet* ret = google_protobuf_FeatureSet_new(arena); |
| 9623 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9624 | if (upb_Decode(buf, size, ret, &google__protobuf__FeatureSet_msg_init, extreg, options, arena) != |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9625 | kUpb_DecodeStatus_Ok) { |
| 9626 | return NULL; |
| 9627 | } |
| 9628 | return ret; |
| 9629 | } |
| 9630 | UPB_INLINE char* google_protobuf_FeatureSet_serialize(const google_protobuf_FeatureSet* msg, upb_Arena* arena, size_t* len) { |
| 9631 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9632 | (void)upb_Encode(msg, &google__protobuf__FeatureSet_msg_init, 0, arena, &ptr, len); |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9633 | return ptr; |
| 9634 | } |
| 9635 | UPB_INLINE char* google_protobuf_FeatureSet_serialize_ex(const google_protobuf_FeatureSet* msg, int options, |
| 9636 | upb_Arena* arena, size_t* len) { |
| 9637 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9638 | (void)upb_Encode(msg, &google__protobuf__FeatureSet_msg_init, options, arena, &ptr, len); |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9639 | return ptr; |
| 9640 | } |
| 9641 | 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] | 9642 | 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] | 9643 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 9644 | } |
| 9645 | UPB_INLINE int32_t google_protobuf_FeatureSet_field_presence(const google_protobuf_FeatureSet* msg) { |
| 9646 | int32_t default_val = 0; |
| 9647 | int32_t ret; |
Mike Kruskal | 60ec7bf | 2023-08-17 16:44:12 -0700 | [diff] [blame] | 9648 | 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] | 9649 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 9650 | return ret; |
| 9651 | } |
| 9652 | 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] | 9653 | 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] | 9654 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 9655 | } |
| 9656 | 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] | 9657 | 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] | 9658 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 9659 | } |
| 9660 | UPB_INLINE int32_t google_protobuf_FeatureSet_enum_type(const google_protobuf_FeatureSet* msg) { |
| 9661 | int32_t default_val = 0; |
| 9662 | int32_t ret; |
Mike Kruskal | 60ec7bf | 2023-08-17 16:44:12 -0700 | [diff] [blame] | 9663 | 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] | 9664 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 9665 | return ret; |
| 9666 | } |
| 9667 | 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] | 9668 | 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] | 9669 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 9670 | } |
| 9671 | 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] | 9672 | 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] | 9673 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 9674 | } |
| 9675 | UPB_INLINE int32_t google_protobuf_FeatureSet_repeated_field_encoding(const google_protobuf_FeatureSet* msg) { |
| 9676 | int32_t default_val = 0; |
| 9677 | int32_t ret; |
Mike Kruskal | 60ec7bf | 2023-08-17 16:44:12 -0700 | [diff] [blame] | 9678 | 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] | 9679 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 9680 | return ret; |
| 9681 | } |
| 9682 | 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] | 9683 | 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] | 9684 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 9685 | } |
Protobuf Team Bot | 6112795 | 2023-09-26 20:07:33 +0000 | [diff] [blame] | 9686 | UPB_INLINE void google_protobuf_FeatureSet_clear_utf8_validation(google_protobuf_FeatureSet* msg) { |
| 9687 | const upb_MiniTableField field = {4, 16, 4, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
| 9688 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 9689 | } |
| 9690 | UPB_INLINE int32_t google_protobuf_FeatureSet_utf8_validation(const google_protobuf_FeatureSet* msg) { |
| 9691 | int32_t default_val = 0; |
| 9692 | int32_t ret; |
| 9693 | const upb_MiniTableField field = {4, 16, 4, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
| 9694 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 9695 | return ret; |
| 9696 | } |
| 9697 | UPB_INLINE bool google_protobuf_FeatureSet_has_utf8_validation(const google_protobuf_FeatureSet* msg) { |
| 9698 | const upb_MiniTableField field = {4, 16, 4, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
| 9699 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 9700 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9701 | UPB_INLINE void google_protobuf_FeatureSet_clear_message_encoding(google_protobuf_FeatureSet* msg) { |
Protobuf Team Bot | 6112795 | 2023-09-26 20:07:33 +0000 | [diff] [blame] | 9702 | const upb_MiniTableField field = {5, 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] | 9703 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 9704 | } |
| 9705 | UPB_INLINE int32_t google_protobuf_FeatureSet_message_encoding(const google_protobuf_FeatureSet* msg) { |
| 9706 | int32_t default_val = 0; |
| 9707 | int32_t ret; |
Protobuf Team Bot | 6112795 | 2023-09-26 20:07:33 +0000 | [diff] [blame] | 9708 | const upb_MiniTableField field = {5, 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] | 9709 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 9710 | return ret; |
| 9711 | } |
| 9712 | UPB_INLINE bool google_protobuf_FeatureSet_has_message_encoding(const google_protobuf_FeatureSet* msg) { |
Protobuf Team Bot | 6112795 | 2023-09-26 20:07:33 +0000 | [diff] [blame] | 9713 | const upb_MiniTableField field = {5, 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] | 9714 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 9715 | } |
| 9716 | UPB_INLINE void google_protobuf_FeatureSet_clear_json_format(google_protobuf_FeatureSet* msg) { |
Protobuf Team Bot | 6112795 | 2023-09-26 20:07:33 +0000 | [diff] [blame] | 9717 | const upb_MiniTableField field = {6, 24, 6, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9718 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 9719 | } |
| 9720 | UPB_INLINE int32_t google_protobuf_FeatureSet_json_format(const google_protobuf_FeatureSet* msg) { |
| 9721 | int32_t default_val = 0; |
| 9722 | int32_t ret; |
Protobuf Team Bot | 6112795 | 2023-09-26 20:07:33 +0000 | [diff] [blame] | 9723 | const upb_MiniTableField field = {6, 24, 6, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9724 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 9725 | return ret; |
| 9726 | } |
| 9727 | UPB_INLINE bool google_protobuf_FeatureSet_has_json_format(const google_protobuf_FeatureSet* msg) { |
Protobuf Team Bot | 6112795 | 2023-09-26 20:07:33 +0000 | [diff] [blame] | 9728 | const upb_MiniTableField field = {6, 24, 6, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9729 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 9730 | } |
| 9731 | |
| 9732 | 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] | 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_SetNonExtensionField(msg, &field, &value); |
| 9735 | } |
| 9736 | 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] | 9737 | 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] | 9738 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 9739 | } |
| 9740 | 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] | 9741 | 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] | 9742 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 9743 | } |
Protobuf Team Bot | 6112795 | 2023-09-26 20:07:33 +0000 | [diff] [blame] | 9744 | UPB_INLINE void google_protobuf_FeatureSet_set_utf8_validation(google_protobuf_FeatureSet *msg, int32_t value) { |
| 9745 | const upb_MiniTableField field = {4, 16, 4, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
| 9746 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 9747 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9748 | UPB_INLINE void google_protobuf_FeatureSet_set_message_encoding(google_protobuf_FeatureSet *msg, int32_t value) { |
Protobuf Team Bot | 6112795 | 2023-09-26 20:07:33 +0000 | [diff] [blame] | 9749 | const upb_MiniTableField field = {5, 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] | 9750 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 9751 | } |
| 9752 | UPB_INLINE void google_protobuf_FeatureSet_set_json_format(google_protobuf_FeatureSet *msg, int32_t value) { |
Protobuf Team Bot | 6112795 | 2023-09-26 20:07:33 +0000 | [diff] [blame] | 9753 | const upb_MiniTableField field = {6, 24, 6, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9754 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 9755 | } |
| 9756 | |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9757 | /* google.protobuf.FeatureSetDefaults */ |
| 9758 | |
| 9759 | UPB_INLINE google_protobuf_FeatureSetDefaults* google_protobuf_FeatureSetDefaults_new(upb_Arena* arena) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9760 | return (google_protobuf_FeatureSetDefaults*)_upb_Message_New(&google__protobuf__FeatureSetDefaults_msg_init, arena); |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9761 | } |
| 9762 | UPB_INLINE google_protobuf_FeatureSetDefaults* google_protobuf_FeatureSetDefaults_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 9763 | google_protobuf_FeatureSetDefaults* ret = google_protobuf_FeatureSetDefaults_new(arena); |
| 9764 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9765 | if (upb_Decode(buf, size, ret, &google__protobuf__FeatureSetDefaults_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9766 | return NULL; |
| 9767 | } |
| 9768 | return ret; |
| 9769 | } |
| 9770 | UPB_INLINE google_protobuf_FeatureSetDefaults* google_protobuf_FeatureSetDefaults_parse_ex(const char* buf, size_t size, |
| 9771 | const upb_ExtensionRegistry* extreg, |
| 9772 | int options, upb_Arena* arena) { |
| 9773 | google_protobuf_FeatureSetDefaults* ret = google_protobuf_FeatureSetDefaults_new(arena); |
| 9774 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9775 | if (upb_Decode(buf, size, ret, &google__protobuf__FeatureSetDefaults_msg_init, extreg, options, arena) != |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9776 | kUpb_DecodeStatus_Ok) { |
| 9777 | return NULL; |
| 9778 | } |
| 9779 | return ret; |
| 9780 | } |
| 9781 | UPB_INLINE char* google_protobuf_FeatureSetDefaults_serialize(const google_protobuf_FeatureSetDefaults* msg, upb_Arena* arena, size_t* len) { |
| 9782 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9783 | (void)upb_Encode(msg, &google__protobuf__FeatureSetDefaults_msg_init, 0, arena, &ptr, len); |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9784 | return ptr; |
| 9785 | } |
| 9786 | UPB_INLINE char* google_protobuf_FeatureSetDefaults_serialize_ex(const google_protobuf_FeatureSetDefaults* msg, int options, |
| 9787 | upb_Arena* arena, size_t* len) { |
| 9788 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9789 | (void)upb_Encode(msg, &google__protobuf__FeatureSetDefaults_msg_init, options, arena, &ptr, len); |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9790 | return ptr; |
| 9791 | } |
| 9792 | 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] | 9793 | 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] | 9794 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 9795 | } |
| 9796 | 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] | 9797 | 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] | 9798 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 9799 | if (arr) { |
| 9800 | if (size) *size = arr->size; |
| 9801 | return (const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* const*)_upb_array_constptr(arr); |
| 9802 | } else { |
| 9803 | if (size) *size = 0; |
| 9804 | return NULL; |
| 9805 | } |
| 9806 | } |
| 9807 | 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] | 9808 | 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] | 9809 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 9810 | if (size) { |
| 9811 | *size = arr ? arr->size : 0; |
| 9812 | } |
| 9813 | return arr; |
| 9814 | } |
| 9815 | 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] | 9816 | 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] | 9817 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 9818 | (upb_Message*)msg, &field, arena); |
| 9819 | if (size) { |
| 9820 | *size = arr ? arr->size : 0; |
| 9821 | } |
| 9822 | return arr; |
| 9823 | } |
| 9824 | UPB_INLINE bool google_protobuf_FeatureSetDefaults_has_defaults(const google_protobuf_FeatureSetDefaults* msg) { |
| 9825 | size_t size; |
| 9826 | google_protobuf_FeatureSetDefaults_defaults(msg, &size); |
| 9827 | return size != 0; |
| 9828 | } |
| 9829 | UPB_INLINE void google_protobuf_FeatureSetDefaults_clear_minimum_edition(google_protobuf_FeatureSetDefaults* msg) { |
Protobuf Team Bot | ab58f8f | 2023-09-26 16:14:19 +0000 | [diff] [blame] | 9830 | const upb_MiniTableField field = {4, UPB_SIZE(8, 4), 1, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9831 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 9832 | } |
Protobuf Team Bot | ab58f8f | 2023-09-26 16:14:19 +0000 | [diff] [blame] | 9833 | UPB_INLINE int32_t google_protobuf_FeatureSetDefaults_minimum_edition(const google_protobuf_FeatureSetDefaults* msg) { |
| 9834 | int32_t default_val = 0; |
| 9835 | int32_t ret; |
| 9836 | const upb_MiniTableField field = {4, UPB_SIZE(8, 4), 1, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9837 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 9838 | return ret; |
| 9839 | } |
| 9840 | UPB_INLINE bool google_protobuf_FeatureSetDefaults_has_minimum_edition(const google_protobuf_FeatureSetDefaults* msg) { |
Protobuf Team Bot | ab58f8f | 2023-09-26 16:14:19 +0000 | [diff] [blame] | 9841 | const upb_MiniTableField field = {4, UPB_SIZE(8, 4), 1, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9842 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 9843 | } |
| 9844 | UPB_INLINE void google_protobuf_FeatureSetDefaults_clear_maximum_edition(google_protobuf_FeatureSetDefaults* msg) { |
Protobuf Team Bot | ab58f8f | 2023-09-26 16:14:19 +0000 | [diff] [blame] | 9845 | const upb_MiniTableField field = {5, UPB_SIZE(12, 8), 2, 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] | 9846 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 9847 | } |
Protobuf Team Bot | ab58f8f | 2023-09-26 16:14:19 +0000 | [diff] [blame] | 9848 | UPB_INLINE int32_t google_protobuf_FeatureSetDefaults_maximum_edition(const google_protobuf_FeatureSetDefaults* msg) { |
| 9849 | int32_t default_val = 0; |
| 9850 | int32_t ret; |
| 9851 | const upb_MiniTableField field = {5, UPB_SIZE(12, 8), 2, 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] | 9852 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 9853 | return ret; |
| 9854 | } |
| 9855 | UPB_INLINE bool google_protobuf_FeatureSetDefaults_has_maximum_edition(const google_protobuf_FeatureSetDefaults* msg) { |
Protobuf Team Bot | ab58f8f | 2023-09-26 16:14:19 +0000 | [diff] [blame] | 9856 | const upb_MiniTableField field = {5, UPB_SIZE(12, 8), 2, 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] | 9857 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 9858 | } |
| 9859 | |
| 9860 | 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] | 9861 | 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] | 9862 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 9863 | if (arr) { |
| 9864 | if (size) *size = arr->size; |
| 9865 | return (google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault**)_upb_array_ptr(arr); |
| 9866 | } else { |
| 9867 | if (size) *size = 0; |
| 9868 | return NULL; |
| 9869 | } |
| 9870 | } |
| 9871 | 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] | 9872 | 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] | 9873 | return (google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
| 9874 | } |
| 9875 | 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] | 9876 | 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] | 9877 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 9878 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 9879 | return NULL; |
| 9880 | } |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9881 | struct google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* sub = (struct google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault*)_upb_Message_New(&google__protobuf__FeatureSetDefaults__FeatureSetEditionDefault_msg_init, arena); |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9882 | if (!arr || !sub) return NULL; |
| 9883 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
| 9884 | return sub; |
| 9885 | } |
Protobuf Team Bot | ab58f8f | 2023-09-26 16:14:19 +0000 | [diff] [blame] | 9886 | UPB_INLINE void google_protobuf_FeatureSetDefaults_set_minimum_edition(google_protobuf_FeatureSetDefaults *msg, int32_t value) { |
| 9887 | const upb_MiniTableField field = {4, UPB_SIZE(8, 4), 1, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9888 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 9889 | } |
Protobuf Team Bot | ab58f8f | 2023-09-26 16:14:19 +0000 | [diff] [blame] | 9890 | UPB_INLINE void google_protobuf_FeatureSetDefaults_set_maximum_edition(google_protobuf_FeatureSetDefaults *msg, int32_t value) { |
| 9891 | const upb_MiniTableField field = {5, UPB_SIZE(12, 8), 2, 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] | 9892 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 9893 | } |
| 9894 | |
| 9895 | /* google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault */ |
| 9896 | |
| 9897 | UPB_INLINE google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_new(upb_Arena* arena) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9898 | return (google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault*)_upb_Message_New(&google__protobuf__FeatureSetDefaults__FeatureSetEditionDefault_msg_init, arena); |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9899 | } |
| 9900 | UPB_INLINE google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 9901 | google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* ret = google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_new(arena); |
| 9902 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9903 | if (upb_Decode(buf, size, ret, &google__protobuf__FeatureSetDefaults__FeatureSetEditionDefault_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9904 | return NULL; |
| 9905 | } |
| 9906 | return ret; |
| 9907 | } |
| 9908 | UPB_INLINE google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_parse_ex(const char* buf, size_t size, |
| 9909 | const upb_ExtensionRegistry* extreg, |
| 9910 | int options, upb_Arena* arena) { |
| 9911 | google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* ret = google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_new(arena); |
| 9912 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9913 | if (upb_Decode(buf, size, ret, &google__protobuf__FeatureSetDefaults__FeatureSetEditionDefault_msg_init, extreg, options, arena) != |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9914 | kUpb_DecodeStatus_Ok) { |
| 9915 | return NULL; |
| 9916 | } |
| 9917 | return ret; |
| 9918 | } |
| 9919 | UPB_INLINE char* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_serialize(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg, upb_Arena* arena, size_t* len) { |
| 9920 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9921 | (void)upb_Encode(msg, &google__protobuf__FeatureSetDefaults__FeatureSetEditionDefault_msg_init, 0, arena, &ptr, len); |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9922 | return ptr; |
| 9923 | } |
| 9924 | UPB_INLINE char* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_serialize_ex(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg, int options, |
| 9925 | upb_Arena* arena, size_t* len) { |
| 9926 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9927 | (void)upb_Encode(msg, &google__protobuf__FeatureSetDefaults__FeatureSetEditionDefault_msg_init, options, arena, &ptr, len); |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9928 | return ptr; |
| 9929 | } |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9930 | UPB_INLINE void google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_clear_features(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) { |
Protobuf Team Bot | ab58f8f | 2023-09-26 16:14:19 +0000 | [diff] [blame] | 9931 | const upb_MiniTableField field = {2, UPB_SIZE(4, 8), 1, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9932 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 9933 | } |
| 9934 | UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_features(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) { |
| 9935 | const google_protobuf_FeatureSet* default_val = NULL; |
| 9936 | const google_protobuf_FeatureSet* ret; |
Protobuf Team Bot | ab58f8f | 2023-09-26 16:14:19 +0000 | [diff] [blame] | 9937 | const upb_MiniTableField field = {2, UPB_SIZE(4, 8), 1, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9938 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 9939 | return ret; |
| 9940 | } |
| 9941 | UPB_INLINE bool google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_has_features(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) { |
Protobuf Team Bot | ab58f8f | 2023-09-26 16:14:19 +0000 | [diff] [blame] | 9942 | const upb_MiniTableField field = {2, UPB_SIZE(4, 8), 1, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9943 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 9944 | } |
Protobuf Team Bot | ab58f8f | 2023-09-26 16:14:19 +0000 | [diff] [blame] | 9945 | UPB_INLINE void google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_clear_edition(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) { |
| 9946 | const upb_MiniTableField field = {3, UPB_SIZE(8, 4), 2, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Protobuf Team Bot | fa98bb3 | 2023-09-01 18:11:09 +0000 | [diff] [blame] | 9947 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 9948 | } |
Protobuf Team Bot | ab58f8f | 2023-09-26 16:14:19 +0000 | [diff] [blame] | 9949 | UPB_INLINE int32_t google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_edition(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) { |
Protobuf Team Bot | fa98bb3 | 2023-09-01 18:11:09 +0000 | [diff] [blame] | 9950 | int32_t default_val = 0; |
| 9951 | int32_t ret; |
Protobuf Team Bot | ab58f8f | 2023-09-26 16:14:19 +0000 | [diff] [blame] | 9952 | const upb_MiniTableField field = {3, UPB_SIZE(8, 4), 2, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Protobuf Team Bot | fa98bb3 | 2023-09-01 18:11:09 +0000 | [diff] [blame] | 9953 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 9954 | return ret; |
| 9955 | } |
Protobuf Team Bot | ab58f8f | 2023-09-26 16:14:19 +0000 | [diff] [blame] | 9956 | UPB_INLINE bool google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_has_edition(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) { |
| 9957 | const upb_MiniTableField field = {3, UPB_SIZE(8, 4), 2, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Protobuf Team Bot | fa98bb3 | 2023-09-01 18:11:09 +0000 | [diff] [blame] | 9958 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 9959 | } |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9960 | |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9961 | UPB_INLINE void google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_set_features(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault *msg, google_protobuf_FeatureSet* value) { |
Protobuf Team Bot | ab58f8f | 2023-09-26 16:14:19 +0000 | [diff] [blame] | 9962 | const upb_MiniTableField field = {2, UPB_SIZE(4, 8), 1, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9963 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 9964 | } |
| 9965 | UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_mutable_features(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg, upb_Arena* arena) { |
| 9966 | struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_features(msg); |
| 9967 | if (sub == NULL) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9968 | sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena); |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9969 | if (sub) google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_set_features(msg, sub); |
| 9970 | } |
| 9971 | return sub; |
| 9972 | } |
Protobuf Team Bot | ab58f8f | 2023-09-26 16:14:19 +0000 | [diff] [blame] | 9973 | UPB_INLINE void google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_set_edition(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault *msg, int32_t value) { |
| 9974 | const upb_MiniTableField field = {3, UPB_SIZE(8, 4), 2, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Protobuf Team Bot | fa98bb3 | 2023-09-01 18:11:09 +0000 | [diff] [blame] | 9975 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 9976 | } |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9977 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9978 | /* google.protobuf.SourceCodeInfo */ |
| 9979 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9980 | UPB_INLINE google_protobuf_SourceCodeInfo* google_protobuf_SourceCodeInfo_new(upb_Arena* arena) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9981 | 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] | 9982 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9983 | UPB_INLINE google_protobuf_SourceCodeInfo* google_protobuf_SourceCodeInfo_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 9984 | google_protobuf_SourceCodeInfo* ret = google_protobuf_SourceCodeInfo_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 9985 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9986 | 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] | 9987 | return NULL; |
| 9988 | } |
| 9989 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9990 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9991 | UPB_INLINE google_protobuf_SourceCodeInfo* google_protobuf_SourceCodeInfo_parse_ex(const char* buf, size_t size, |
| 9992 | const upb_ExtensionRegistry* extreg, |
| 9993 | int options, upb_Arena* arena) { |
| 9994 | google_protobuf_SourceCodeInfo* ret = google_protobuf_SourceCodeInfo_new(arena); |
| 9995 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9996 | 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] | 9997 | kUpb_DecodeStatus_Ok) { |
| 9998 | return NULL; |
| 9999 | } |
| 10000 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10001 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10002 | 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] | 10003 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 10004 | (void)upb_Encode(msg, &google__protobuf__SourceCodeInfo_msg_init, 0, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10005 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10006 | } |
| 10007 | UPB_INLINE char* google_protobuf_SourceCodeInfo_serialize_ex(const google_protobuf_SourceCodeInfo* msg, int options, |
| 10008 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10009 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 10010 | (void)upb_Encode(msg, &google__protobuf__SourceCodeInfo_msg_init, options, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10011 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10012 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10013 | UPB_INLINE void google_protobuf_SourceCodeInfo_clear_location(google_protobuf_SourceCodeInfo* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10014 | 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] | 10015 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10016 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10017 | 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] | 10018 | 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] | 10019 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 10020 | if (arr) { |
| 10021 | if (size) *size = arr->size; |
| 10022 | return (const google_protobuf_SourceCodeInfo_Location* const*)_upb_array_constptr(arr); |
| 10023 | } else { |
| 10024 | if (size) *size = 0; |
| 10025 | return NULL; |
| 10026 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 10027 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 10028 | 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] | 10029 | 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] | 10030 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 10031 | if (size) { |
| 10032 | *size = arr ? arr->size : 0; |
| 10033 | } |
| 10034 | return arr; |
| 10035 | } |
| 10036 | 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] | 10037 | 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] | 10038 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 10039 | (upb_Message*)msg, &field, arena); |
| 10040 | if (size) { |
| 10041 | *size = arr ? arr->size : 0; |
| 10042 | } |
| 10043 | return arr; |
| 10044 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10045 | UPB_INLINE bool google_protobuf_SourceCodeInfo_has_location(const google_protobuf_SourceCodeInfo* msg) { |
| 10046 | size_t size; |
| 10047 | google_protobuf_SourceCodeInfo_location(msg, &size); |
| 10048 | return size != 0; |
| 10049 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10050 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10051 | 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] | 10052 | 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] | 10053 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 10054 | if (arr) { |
| 10055 | if (size) *size = arr->size; |
| 10056 | return (google_protobuf_SourceCodeInfo_Location**)_upb_array_ptr(arr); |
| 10057 | } else { |
| 10058 | if (size) *size = 0; |
| 10059 | return NULL; |
| 10060 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10061 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10062 | 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] | 10063 | 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] | 10064 | return (google_protobuf_SourceCodeInfo_Location**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10065 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 10066 | 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] | 10067 | 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] | 10068 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 10069 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 10070 | return NULL; |
| 10071 | } |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 10072 | 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] | 10073 | if (!arr || !sub) return NULL; |
| 10074 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10075 | return sub; |
| 10076 | } |
| 10077 | |
| 10078 | /* google.protobuf.SourceCodeInfo.Location */ |
| 10079 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10080 | UPB_INLINE google_protobuf_SourceCodeInfo_Location* google_protobuf_SourceCodeInfo_Location_new(upb_Arena* arena) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 10081 | 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] | 10082 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10083 | UPB_INLINE google_protobuf_SourceCodeInfo_Location* google_protobuf_SourceCodeInfo_Location_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 10084 | google_protobuf_SourceCodeInfo_Location* ret = google_protobuf_SourceCodeInfo_Location_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 10085 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 10086 | 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] | 10087 | return NULL; |
| 10088 | } |
| 10089 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10090 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10091 | UPB_INLINE google_protobuf_SourceCodeInfo_Location* google_protobuf_SourceCodeInfo_Location_parse_ex(const char* buf, size_t size, |
| 10092 | const upb_ExtensionRegistry* extreg, |
| 10093 | int options, upb_Arena* arena) { |
| 10094 | google_protobuf_SourceCodeInfo_Location* ret = google_protobuf_SourceCodeInfo_Location_new(arena); |
| 10095 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 10096 | 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] | 10097 | kUpb_DecodeStatus_Ok) { |
| 10098 | return NULL; |
| 10099 | } |
| 10100 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10101 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10102 | 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] | 10103 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 10104 | (void)upb_Encode(msg, &google__protobuf__SourceCodeInfo__Location_msg_init, 0, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10105 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10106 | } |
| 10107 | UPB_INLINE char* google_protobuf_SourceCodeInfo_Location_serialize_ex(const google_protobuf_SourceCodeInfo_Location* msg, int options, |
| 10108 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10109 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 10110 | (void)upb_Encode(msg, &google__protobuf__SourceCodeInfo__Location_msg_init, options, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10111 | return ptr; |
| 10112 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10113 | 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] | 10114 | 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] | 10115 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10116 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10117 | 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] | 10118 | 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] | 10119 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 10120 | if (arr) { |
| 10121 | if (size) *size = arr->size; |
| 10122 | return (int32_t const*)_upb_array_constptr(arr); |
| 10123 | } else { |
| 10124 | if (size) *size = 0; |
| 10125 | return NULL; |
| 10126 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10127 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 10128 | 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] | 10129 | 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] | 10130 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 10131 | if (size) { |
| 10132 | *size = arr ? arr->size : 0; |
| 10133 | } |
| 10134 | return arr; |
| 10135 | } |
| 10136 | 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] | 10137 | 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] | 10138 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 10139 | (upb_Message*)msg, &field, arena); |
| 10140 | if (size) { |
| 10141 | *size = arr ? arr->size : 0; |
| 10142 | } |
| 10143 | return arr; |
| 10144 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10145 | UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_has_path(const google_protobuf_SourceCodeInfo_Location* msg) { |
| 10146 | size_t size; |
| 10147 | google_protobuf_SourceCodeInfo_Location_path(msg, &size); |
| 10148 | return size != 0; |
| 10149 | } |
| 10150 | 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] | 10151 | 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] | 10152 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 10153 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10154 | 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] | 10155 | 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] | 10156 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 10157 | if (arr) { |
| 10158 | if (size) *size = arr->size; |
| 10159 | return (int32_t const*)_upb_array_constptr(arr); |
| 10160 | } else { |
| 10161 | if (size) *size = 0; |
| 10162 | return NULL; |
| 10163 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 10164 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 10165 | 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] | 10166 | 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] | 10167 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 10168 | if (size) { |
| 10169 | *size = arr ? arr->size : 0; |
| 10170 | } |
| 10171 | return arr; |
| 10172 | } |
| 10173 | 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] | 10174 | 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] | 10175 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 10176 | (upb_Message*)msg, &field, arena); |
| 10177 | if (size) { |
| 10178 | *size = arr ? arr->size : 0; |
| 10179 | } |
| 10180 | return arr; |
| 10181 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10182 | UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_has_span(const google_protobuf_SourceCodeInfo_Location* msg) { |
| 10183 | size_t size; |
| 10184 | google_protobuf_SourceCodeInfo_Location_span(msg, &size); |
| 10185 | return size != 0; |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 10186 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10187 | 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] | 10188 | 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] | 10189 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10190 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10191 | 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] | 10192 | upb_StringView default_val = upb_StringView_FromString(""); |
| 10193 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10194 | 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] | 10195 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10196 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10197 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10198 | 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] | 10199 | 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] | 10200 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 10201 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10202 | 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] | 10203 | 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] | 10204 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10205 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10206 | 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] | 10207 | upb_StringView default_val = upb_StringView_FromString(""); |
| 10208 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10209 | 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] | 10210 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10211 | return ret; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10212 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10213 | 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] | 10214 | 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] | 10215 | return _upb_Message_HasNonExtensionField(msg, &field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10216 | } |
| 10217 | 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] | 10218 | 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] | 10219 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10220 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10221 | 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] | 10222 | 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] | 10223 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 10224 | if (arr) { |
| 10225 | if (size) *size = arr->size; |
| 10226 | return (upb_StringView const*)_upb_array_constptr(arr); |
| 10227 | } else { |
| 10228 | if (size) *size = 0; |
| 10229 | return NULL; |
| 10230 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 10231 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 10232 | 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] | 10233 | 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] | 10234 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 10235 | if (size) { |
| 10236 | *size = arr ? arr->size : 0; |
| 10237 | } |
| 10238 | return arr; |
| 10239 | } |
| 10240 | 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] | 10241 | 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] | 10242 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 10243 | (upb_Message*)msg, &field, arena); |
| 10244 | if (size) { |
| 10245 | *size = arr ? arr->size : 0; |
| 10246 | } |
| 10247 | return arr; |
| 10248 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10249 | UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_has_leading_detached_comments(const google_protobuf_SourceCodeInfo_Location* msg) { |
| 10250 | size_t size; |
| 10251 | google_protobuf_SourceCodeInfo_Location_leading_detached_comments(msg, &size); |
| 10252 | return size != 0; |
| 10253 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10254 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10255 | 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] | 10256 | 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] | 10257 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 10258 | if (arr) { |
| 10259 | if (size) *size = arr->size; |
| 10260 | return (int32_t*)_upb_array_ptr(arr); |
| 10261 | } else { |
| 10262 | if (size) *size = 0; |
| 10263 | return NULL; |
| 10264 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10265 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10266 | 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] | 10267 | 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] | 10268 | return (int32_t*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10269 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 10270 | 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] | 10271 | 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] | 10272 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 10273 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 10274 | return false; |
| 10275 | } |
| 10276 | _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val)); |
| 10277 | return true; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10278 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10279 | 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] | 10280 | 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] | 10281 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 10282 | if (arr) { |
| 10283 | if (size) *size = arr->size; |
| 10284 | return (int32_t*)_upb_array_ptr(arr); |
| 10285 | } else { |
| 10286 | if (size) *size = 0; |
| 10287 | return NULL; |
| 10288 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10289 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10290 | 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] | 10291 | 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] | 10292 | return (int32_t*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10293 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 10294 | 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] | 10295 | 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] | 10296 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 10297 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 10298 | return false; |
| 10299 | } |
| 10300 | _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val)); |
| 10301 | return true; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10302 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10303 | 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] | 10304 | 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] | 10305 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 10306 | } |
| 10307 | 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] | 10308 | 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] | 10309 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 10310 | } |
| 10311 | 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] | 10312 | 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] | 10313 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 10314 | if (arr) { |
| 10315 | if (size) *size = arr->size; |
| 10316 | return (upb_StringView*)_upb_array_ptr(arr); |
| 10317 | } else { |
| 10318 | if (size) *size = 0; |
| 10319 | return NULL; |
| 10320 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10321 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10322 | 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] | 10323 | 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] | 10324 | return (upb_StringView*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10325 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 10326 | 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] | 10327 | 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] | 10328 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 10329 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 10330 | return false; |
| 10331 | } |
| 10332 | _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val)); |
| 10333 | return true; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10334 | } |
| 10335 | |
| 10336 | /* google.protobuf.GeneratedCodeInfo */ |
| 10337 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10338 | UPB_INLINE google_protobuf_GeneratedCodeInfo* google_protobuf_GeneratedCodeInfo_new(upb_Arena* arena) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 10339 | 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] | 10340 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10341 | UPB_INLINE google_protobuf_GeneratedCodeInfo* google_protobuf_GeneratedCodeInfo_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 10342 | google_protobuf_GeneratedCodeInfo* ret = google_protobuf_GeneratedCodeInfo_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 10343 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 10344 | 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] | 10345 | return NULL; |
| 10346 | } |
| 10347 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10348 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10349 | UPB_INLINE google_protobuf_GeneratedCodeInfo* google_protobuf_GeneratedCodeInfo_parse_ex(const char* buf, size_t size, |
| 10350 | const upb_ExtensionRegistry* extreg, |
| 10351 | int options, upb_Arena* arena) { |
| 10352 | google_protobuf_GeneratedCodeInfo* ret = google_protobuf_GeneratedCodeInfo_new(arena); |
| 10353 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 10354 | 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] | 10355 | kUpb_DecodeStatus_Ok) { |
| 10356 | return NULL; |
| 10357 | } |
| 10358 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10359 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10360 | 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] | 10361 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 10362 | (void)upb_Encode(msg, &google__protobuf__GeneratedCodeInfo_msg_init, 0, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10363 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10364 | } |
| 10365 | UPB_INLINE char* google_protobuf_GeneratedCodeInfo_serialize_ex(const google_protobuf_GeneratedCodeInfo* msg, int options, |
| 10366 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10367 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 10368 | (void)upb_Encode(msg, &google__protobuf__GeneratedCodeInfo_msg_init, options, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10369 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10370 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10371 | UPB_INLINE void google_protobuf_GeneratedCodeInfo_clear_annotation(google_protobuf_GeneratedCodeInfo* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10372 | 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] | 10373 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10374 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10375 | 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] | 10376 | 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] | 10377 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 10378 | if (arr) { |
| 10379 | if (size) *size = arr->size; |
| 10380 | return (const google_protobuf_GeneratedCodeInfo_Annotation* const*)_upb_array_constptr(arr); |
| 10381 | } else { |
| 10382 | if (size) *size = 0; |
| 10383 | return NULL; |
| 10384 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 10385 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 10386 | 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] | 10387 | 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] | 10388 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 10389 | if (size) { |
| 10390 | *size = arr ? arr->size : 0; |
| 10391 | } |
| 10392 | return arr; |
| 10393 | } |
| 10394 | 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] | 10395 | 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] | 10396 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 10397 | (upb_Message*)msg, &field, arena); |
| 10398 | if (size) { |
| 10399 | *size = arr ? arr->size : 0; |
| 10400 | } |
| 10401 | return arr; |
| 10402 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10403 | UPB_INLINE bool google_protobuf_GeneratedCodeInfo_has_annotation(const google_protobuf_GeneratedCodeInfo* msg) { |
| 10404 | size_t size; |
| 10405 | google_protobuf_GeneratedCodeInfo_annotation(msg, &size); |
| 10406 | return size != 0; |
| 10407 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10408 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10409 | 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] | 10410 | 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] | 10411 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 10412 | if (arr) { |
| 10413 | if (size) *size = arr->size; |
| 10414 | return (google_protobuf_GeneratedCodeInfo_Annotation**)_upb_array_ptr(arr); |
| 10415 | } else { |
| 10416 | if (size) *size = 0; |
| 10417 | return NULL; |
| 10418 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10419 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10420 | 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] | 10421 | 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] | 10422 | return (google_protobuf_GeneratedCodeInfo_Annotation**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10423 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 10424 | 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] | 10425 | 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] | 10426 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 10427 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 10428 | return NULL; |
| 10429 | } |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 10430 | 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] | 10431 | if (!arr || !sub) return NULL; |
| 10432 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10433 | return sub; |
| 10434 | } |
| 10435 | |
| 10436 | /* google.protobuf.GeneratedCodeInfo.Annotation */ |
| 10437 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10438 | UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation* google_protobuf_GeneratedCodeInfo_Annotation_new(upb_Arena* arena) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 10439 | 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] | 10440 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10441 | UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation* google_protobuf_GeneratedCodeInfo_Annotation_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 10442 | google_protobuf_GeneratedCodeInfo_Annotation* ret = google_protobuf_GeneratedCodeInfo_Annotation_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 10443 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 10444 | 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] | 10445 | return NULL; |
| 10446 | } |
| 10447 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10448 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10449 | UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation* google_protobuf_GeneratedCodeInfo_Annotation_parse_ex(const char* buf, size_t size, |
| 10450 | const upb_ExtensionRegistry* extreg, |
| 10451 | int options, upb_Arena* arena) { |
| 10452 | google_protobuf_GeneratedCodeInfo_Annotation* ret = google_protobuf_GeneratedCodeInfo_Annotation_new(arena); |
| 10453 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 10454 | 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] | 10455 | kUpb_DecodeStatus_Ok) { |
| 10456 | return NULL; |
| 10457 | } |
| 10458 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10459 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10460 | 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] | 10461 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 10462 | (void)upb_Encode(msg, &google__protobuf__GeneratedCodeInfo__Annotation_msg_init, 0, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10463 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10464 | } |
| 10465 | UPB_INLINE char* google_protobuf_GeneratedCodeInfo_Annotation_serialize_ex(const google_protobuf_GeneratedCodeInfo_Annotation* msg, int options, |
| 10466 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10467 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 10468 | (void)upb_Encode(msg, &google__protobuf__GeneratedCodeInfo__Annotation_msg_init, options, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10469 | return ptr; |
| 10470 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10471 | 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] | 10472 | 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] | 10473 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10474 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10475 | 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] | 10476 | 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] | 10477 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 10478 | if (arr) { |
| 10479 | if (size) *size = arr->size; |
| 10480 | return (int32_t const*)_upb_array_constptr(arr); |
| 10481 | } else { |
| 10482 | if (size) *size = 0; |
| 10483 | return NULL; |
| 10484 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 10485 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 10486 | 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] | 10487 | 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] | 10488 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 10489 | if (size) { |
| 10490 | *size = arr ? arr->size : 0; |
| 10491 | } |
| 10492 | return arr; |
| 10493 | } |
| 10494 | 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] | 10495 | 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] | 10496 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 10497 | (upb_Message*)msg, &field, arena); |
| 10498 | if (size) { |
| 10499 | *size = arr ? arr->size : 0; |
| 10500 | } |
| 10501 | return arr; |
| 10502 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10503 | UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_path(const google_protobuf_GeneratedCodeInfo_Annotation* msg) { |
| 10504 | size_t size; |
| 10505 | google_protobuf_GeneratedCodeInfo_Annotation_path(msg, &size); |
| 10506 | return size != 0; |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 10507 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10508 | 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] | 10509 | 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] | 10510 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10511 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10512 | 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] | 10513 | upb_StringView default_val = upb_StringView_FromString(""); |
| 10514 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10515 | 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] | 10516 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10517 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10518 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10519 | 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] | 10520 | 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] | 10521 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 10522 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10523 | 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] | 10524 | 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] | 10525 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10526 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10527 | 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] | 10528 | int32_t default_val = (int32_t)0; |
| 10529 | int32_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10530 | 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] | 10531 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10532 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10533 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10534 | 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] | 10535 | 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] | 10536 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 10537 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10538 | 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] | 10539 | 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] | 10540 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10541 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10542 | 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] | 10543 | int32_t default_val = (int32_t)0; |
| 10544 | int32_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10545 | 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] | 10546 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10547 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10548 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10549 | 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] | 10550 | 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] | 10551 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10552 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10553 | 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] | 10554 | 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] | 10555 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10556 | } |
| 10557 | 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] | 10558 | int32_t default_val = 0; |
| 10559 | int32_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10560 | 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] | 10561 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10562 | return ret; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10563 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10564 | 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] | 10565 | 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] | 10566 | return _upb_Message_HasNonExtensionField(msg, &field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10567 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10568 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10569 | 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] | 10570 | 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] | 10571 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 10572 | if (arr) { |
| 10573 | if (size) *size = arr->size; |
| 10574 | return (int32_t*)_upb_array_ptr(arr); |
| 10575 | } else { |
| 10576 | if (size) *size = 0; |
| 10577 | return NULL; |
| 10578 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10579 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10580 | 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] | 10581 | 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] | 10582 | return (int32_t*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10583 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 10584 | 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] | 10585 | 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] | 10586 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 10587 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 10588 | return false; |
| 10589 | } |
| 10590 | _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val)); |
| 10591 | return true; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10592 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10593 | 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] | 10594 | 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] | 10595 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 10596 | } |
| 10597 | 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] | 10598 | 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] | 10599 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 10600 | } |
| 10601 | 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] | 10602 | 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] | 10603 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 10604 | } |
| 10605 | 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] | 10606 | 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] | 10607 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10608 | } |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 10609 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10610 | /* Max size 32 is google.protobuf.FileOptions */ |
| 10611 | /* Max size 64 is google.protobuf.FileOptions */ |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 10612 | #define _UPB_MAXOPT_SIZE UPB_SIZE(112, 200) |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10613 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10614 | #ifdef __cplusplus |
| 10615 | } /* extern "C" */ |
| 10616 | #endif |
| 10617 | |
| 10618 | |
| 10619 | #endif /* GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_H_ */ |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 10620 | // end:github_only |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10621 | |
Protobuf Team Bot | 7dabac9 | 2023-09-07 18:35:50 +0000 | [diff] [blame] | 10622 | typedef enum { |
| 10623 | kUpb_Syntax_Proto2 = 2, |
| 10624 | kUpb_Syntax_Proto3 = 3, |
| 10625 | kUpb_Syntax_Editions = 99 |
| 10626 | } upb_Syntax; |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10627 | |
| 10628 | // Forward declarations for circular references. |
| 10629 | typedef struct upb_DefPool upb_DefPool; |
| 10630 | typedef struct upb_EnumDef upb_EnumDef; |
| 10631 | typedef struct upb_EnumReservedRange upb_EnumReservedRange; |
| 10632 | typedef struct upb_EnumValueDef upb_EnumValueDef; |
| 10633 | typedef struct upb_ExtensionRange upb_ExtensionRange; |
| 10634 | typedef struct upb_FieldDef upb_FieldDef; |
| 10635 | typedef struct upb_FileDef upb_FileDef; |
| 10636 | typedef struct upb_MessageDef upb_MessageDef; |
| 10637 | typedef struct upb_MessageReservedRange upb_MessageReservedRange; |
| 10638 | typedef struct upb_MethodDef upb_MethodDef; |
| 10639 | typedef struct upb_OneofDef upb_OneofDef; |
| 10640 | typedef struct upb_ServiceDef upb_ServiceDef; |
| 10641 | |
| 10642 | // EVERYTHING BELOW THIS LINE IS INTERNAL - DO NOT USE ///////////////////////// |
| 10643 | |
| 10644 | typedef struct upb_DefBuilder upb_DefBuilder; |
| 10645 | |
| 10646 | #endif /* UPB_REFLECTION_COMMON_H_ */ |
| 10647 | |
| 10648 | #ifndef UPB_REFLECTION_DEF_TYPE_H_ |
| 10649 | #define UPB_REFLECTION_DEF_TYPE_H_ |
| 10650 | |
| 10651 | |
| 10652 | // Must be last. |
| 10653 | |
| 10654 | // Inside a symtab we store tagged pointers to specific def types. |
| 10655 | typedef enum { |
| 10656 | UPB_DEFTYPE_MASK = 7, |
| 10657 | |
| 10658 | // Only inside symtab table. |
| 10659 | UPB_DEFTYPE_EXT = 0, |
| 10660 | UPB_DEFTYPE_MSG = 1, |
| 10661 | UPB_DEFTYPE_ENUM = 2, |
| 10662 | UPB_DEFTYPE_ENUMVAL = 3, |
| 10663 | UPB_DEFTYPE_SERVICE = 4, |
| 10664 | |
| 10665 | // Only inside message table. |
| 10666 | UPB_DEFTYPE_FIELD = 0, |
| 10667 | UPB_DEFTYPE_ONEOF = 1, |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10668 | } upb_deftype_t; |
| 10669 | |
| 10670 | #ifdef __cplusplus |
| 10671 | extern "C" { |
| 10672 | #endif |
| 10673 | |
| 10674 | // Our 3-bit pointer tagging requires all pointers to be multiples of 8. |
| 10675 | // The arena will always yield 8-byte-aligned addresses, however we put |
| 10676 | // the defs into arrays. For each element in the array to be 8-byte-aligned, |
| 10677 | // the sizes of each def type must also be a multiple of 8. |
| 10678 | // |
| 10679 | // If any of these asserts fail, we need to add or remove padding on 32-bit |
| 10680 | // machines (64-bit machines will have 8-byte alignment already due to |
| 10681 | // pointers, which all of these structs have). |
| 10682 | UPB_INLINE void _upb_DefType_CheckPadding(size_t size) { |
| 10683 | UPB_ASSERT((size & UPB_DEFTYPE_MASK) == 0); |
| 10684 | } |
| 10685 | |
| 10686 | upb_deftype_t _upb_DefType_Type(upb_value v); |
| 10687 | |
| 10688 | upb_value _upb_DefType_Pack(const void* ptr, upb_deftype_t type); |
| 10689 | |
| 10690 | const void* _upb_DefType_Unpack(upb_value v, upb_deftype_t type); |
| 10691 | |
| 10692 | #ifdef __cplusplus |
| 10693 | } /* extern "C" */ |
| 10694 | #endif |
| 10695 | |
| 10696 | |
| 10697 | #endif /* UPB_REFLECTION_DEF_TYPE_H_ */ |
| 10698 | |
| 10699 | // Must be last. |
| 10700 | |
| 10701 | #ifdef __cplusplus |
| 10702 | extern "C" { |
| 10703 | #endif |
| 10704 | |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 10705 | UPB_API void upb_DefPool_Free(upb_DefPool* s); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10706 | |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 10707 | UPB_API upb_DefPool* upb_DefPool_New(void); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10708 | |
Protobuf Team Bot | ce9dcc2 | 2023-11-03 22:38:26 +0000 | [diff] [blame] | 10709 | UPB_API const UPB_DESC(FeatureSetDefaults) * |
| 10710 | upb_DefPool_FeatureSetDefaults(const upb_DefPool* s); |
| 10711 | |
Protobuf Team Bot | c6b149c | 2023-11-10 23:37:46 +0000 | [diff] [blame] | 10712 | UPB_API bool upb_DefPool_SetFeatureSetDefaults(upb_DefPool* s, |
| 10713 | const char* serialized_defaults, |
| 10714 | size_t serialized_len, |
| 10715 | upb_Status* status); |
| 10716 | |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 10717 | UPB_API const upb_MessageDef* upb_DefPool_FindMessageByName( |
| 10718 | const upb_DefPool* s, const char* sym); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10719 | |
| 10720 | const upb_MessageDef* upb_DefPool_FindMessageByNameWithSize( |
| 10721 | const upb_DefPool* s, const char* sym, size_t len); |
| 10722 | |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 10723 | UPB_API const upb_EnumDef* upb_DefPool_FindEnumByName(const upb_DefPool* s, |
| 10724 | const char* sym); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10725 | |
| 10726 | const upb_EnumValueDef* upb_DefPool_FindEnumByNameval(const upb_DefPool* s, |
| 10727 | const char* sym); |
| 10728 | |
| 10729 | const upb_FileDef* upb_DefPool_FindFileByName(const upb_DefPool* s, |
| 10730 | const char* name); |
| 10731 | |
| 10732 | const upb_FileDef* upb_DefPool_FindFileByNameWithSize(const upb_DefPool* s, |
| 10733 | const char* name, |
| 10734 | size_t len); |
| 10735 | |
| 10736 | const upb_FieldDef* upb_DefPool_FindExtensionByMiniTable( |
| 10737 | const upb_DefPool* s, const upb_MiniTableExtension* ext); |
| 10738 | |
Protobuf Team Bot | 8aad058 | 2023-11-14 23:47:47 +0000 | [diff] [blame^] | 10739 | UPB_API const upb_FieldDef* upb_DefPool_FindExtensionByName(const upb_DefPool* s, |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10740 | const char* sym); |
| 10741 | |
| 10742 | const upb_FieldDef* upb_DefPool_FindExtensionByNameWithSize( |
| 10743 | const upb_DefPool* s, const char* name, size_t size); |
| 10744 | |
| 10745 | const upb_FieldDef* upb_DefPool_FindExtensionByNumber(const upb_DefPool* s, |
| 10746 | const upb_MessageDef* m, |
| 10747 | int32_t fieldnum); |
| 10748 | |
| 10749 | const upb_ServiceDef* upb_DefPool_FindServiceByName(const upb_DefPool* s, |
| 10750 | const char* name); |
| 10751 | |
| 10752 | const upb_ServiceDef* upb_DefPool_FindServiceByNameWithSize( |
| 10753 | const upb_DefPool* s, const char* name, size_t size); |
| 10754 | |
| 10755 | const upb_FileDef* upb_DefPool_FindFileContainingSymbol(const upb_DefPool* s, |
| 10756 | const char* name); |
| 10757 | |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 10758 | UPB_API const upb_FileDef* upb_DefPool_AddFile( |
| 10759 | upb_DefPool* s, const UPB_DESC(FileDescriptorProto) * file_proto, |
| 10760 | upb_Status* status); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10761 | |
Protobuf Team Bot | 8aad058 | 2023-11-14 23:47:47 +0000 | [diff] [blame^] | 10762 | UPB_API const upb_ExtensionRegistry* upb_DefPool_ExtensionRegistry( |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10763 | const upb_DefPool* s); |
| 10764 | |
| 10765 | const upb_FieldDef** upb_DefPool_GetAllExtensions(const upb_DefPool* s, |
| 10766 | const upb_MessageDef* m, |
| 10767 | size_t* count); |
| 10768 | |
| 10769 | #ifdef __cplusplus |
| 10770 | } /* extern "C" */ |
| 10771 | #endif |
| 10772 | |
| 10773 | |
| 10774 | #endif /* UPB_REFLECTION_DEF_POOL_H_ */ |
| 10775 | |
Protobuf Team Bot | 0631035 | 2023-09-26 21:54:58 +0000 | [diff] [blame] | 10776 | // IWYU pragma: private, include "upb/reflection/def.h" |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10777 | |
| 10778 | #ifndef UPB_REFLECTION_ENUM_DEF_H_ |
| 10779 | #define UPB_REFLECTION_ENUM_DEF_H_ |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10780 | |
| 10781 | |
| 10782 | // Must be last. |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10783 | |
| 10784 | #ifdef __cplusplus |
| 10785 | extern "C" { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10786 | #endif |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10787 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10788 | bool upb_EnumDef_CheckNumber(const upb_EnumDef* e, int32_t num); |
| 10789 | const upb_MessageDef* upb_EnumDef_ContainingType(const upb_EnumDef* e); |
| 10790 | int32_t upb_EnumDef_Default(const upb_EnumDef* e); |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 10791 | UPB_API const upb_FileDef* upb_EnumDef_File(const upb_EnumDef* e); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10792 | const upb_EnumValueDef* upb_EnumDef_FindValueByName(const upb_EnumDef* e, |
| 10793 | const char* name); |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 10794 | UPB_API const upb_EnumValueDef* upb_EnumDef_FindValueByNameWithSize( |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10795 | const upb_EnumDef* e, const char* name, size_t size); |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 10796 | UPB_API const upb_EnumValueDef* upb_EnumDef_FindValueByNumber( |
| 10797 | const upb_EnumDef* e, int32_t num); |
| 10798 | UPB_API const char* upb_EnumDef_FullName(const upb_EnumDef* e); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10799 | bool upb_EnumDef_HasOptions(const upb_EnumDef* e); |
| 10800 | bool upb_EnumDef_IsClosed(const upb_EnumDef* e); |
| 10801 | |
| 10802 | // Creates a mini descriptor string for an enum, returns true on success. |
| 10803 | bool upb_EnumDef_MiniDescriptorEncode(const upb_EnumDef* e, upb_Arena* a, |
| 10804 | upb_StringView* out); |
| 10805 | |
| 10806 | const char* upb_EnumDef_Name(const upb_EnumDef* e); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 10807 | const UPB_DESC(EnumOptions) * upb_EnumDef_Options(const upb_EnumDef* e); |
Protobuf Team Bot | ce9dcc2 | 2023-11-03 22:38:26 +0000 | [diff] [blame] | 10808 | const UPB_DESC(FeatureSet) * upb_EnumDef_ResolvedFeatures(const upb_EnumDef* e); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10809 | |
| 10810 | upb_StringView upb_EnumDef_ReservedName(const upb_EnumDef* e, int i); |
| 10811 | int upb_EnumDef_ReservedNameCount(const upb_EnumDef* e); |
| 10812 | |
| 10813 | const upb_EnumReservedRange* upb_EnumDef_ReservedRange(const upb_EnumDef* e, |
| 10814 | int i); |
| 10815 | int upb_EnumDef_ReservedRangeCount(const upb_EnumDef* e); |
| 10816 | |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 10817 | UPB_API const upb_EnumValueDef* upb_EnumDef_Value(const upb_EnumDef* e, int i); |
| 10818 | UPB_API int upb_EnumDef_ValueCount(const upb_EnumDef* e); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10819 | |
| 10820 | #ifdef __cplusplus |
| 10821 | } /* extern "C" */ |
| 10822 | #endif |
| 10823 | |
| 10824 | |
| 10825 | #endif /* UPB_REFLECTION_ENUM_DEF_H_ */ |
| 10826 | |
Protobuf Team Bot | 0631035 | 2023-09-26 21:54:58 +0000 | [diff] [blame] | 10827 | // IWYU pragma: private, include "upb/reflection/def.h" |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10828 | |
| 10829 | #ifndef UPB_REFLECTION_ENUM_VALUE_DEF_H_ |
| 10830 | #define UPB_REFLECTION_ENUM_VALUE_DEF_H_ |
| 10831 | |
| 10832 | |
| 10833 | // Must be last. |
| 10834 | |
| 10835 | #ifdef __cplusplus |
| 10836 | extern "C" { |
| 10837 | #endif |
| 10838 | |
| 10839 | const upb_EnumDef* upb_EnumValueDef_Enum(const upb_EnumValueDef* v); |
| 10840 | const char* upb_EnumValueDef_FullName(const upb_EnumValueDef* v); |
| 10841 | bool upb_EnumValueDef_HasOptions(const upb_EnumValueDef* v); |
| 10842 | uint32_t upb_EnumValueDef_Index(const upb_EnumValueDef* v); |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 10843 | UPB_API const char* upb_EnumValueDef_Name(const upb_EnumValueDef* v); |
| 10844 | UPB_API int32_t upb_EnumValueDef_Number(const upb_EnumValueDef* v); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 10845 | const UPB_DESC(EnumValueOptions) * |
| 10846 | upb_EnumValueDef_Options(const upb_EnumValueDef* v); |
Protobuf Team Bot | ce9dcc2 | 2023-11-03 22:38:26 +0000 | [diff] [blame] | 10847 | const UPB_DESC(FeatureSet) * |
| 10848 | upb_EnumValueDef_ResolvedFeatures(const upb_EnumValueDef* e); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10849 | |
| 10850 | #ifdef __cplusplus |
| 10851 | } /* extern "C" */ |
| 10852 | #endif |
| 10853 | |
| 10854 | |
| 10855 | #endif /* UPB_REFLECTION_ENUM_VALUE_DEF_H_ */ |
| 10856 | |
Protobuf Team Bot | 0631035 | 2023-09-26 21:54:58 +0000 | [diff] [blame] | 10857 | // IWYU pragma: private, include "upb/reflection/def.h" |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10858 | |
| 10859 | #ifndef UPB_REFLECTION_EXTENSION_RANGE_H_ |
| 10860 | #define UPB_REFLECTION_EXTENSION_RANGE_H_ |
| 10861 | |
| 10862 | |
| 10863 | // Must be last. |
| 10864 | |
| 10865 | #ifdef __cplusplus |
| 10866 | extern "C" { |
| 10867 | #endif |
| 10868 | |
| 10869 | int32_t upb_ExtensionRange_Start(const upb_ExtensionRange* r); |
| 10870 | int32_t upb_ExtensionRange_End(const upb_ExtensionRange* r); |
| 10871 | |
| 10872 | bool upb_ExtensionRange_HasOptions(const upb_ExtensionRange* r); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 10873 | const UPB_DESC(ExtensionRangeOptions) * |
| 10874 | upb_ExtensionRange_Options(const upb_ExtensionRange* r); |
Protobuf Team Bot | ce9dcc2 | 2023-11-03 22:38:26 +0000 | [diff] [blame] | 10875 | const UPB_DESC(FeatureSet) * |
| 10876 | upb_ExtensionRange_ResolvedFeatures(const upb_ExtensionRange* e); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10877 | |
| 10878 | #ifdef __cplusplus |
| 10879 | } /* extern "C" */ |
| 10880 | #endif |
| 10881 | |
| 10882 | |
| 10883 | #endif /* UPB_REFLECTION_EXTENSION_RANGE_H_ */ |
| 10884 | |
Protobuf Team Bot | 0631035 | 2023-09-26 21:54:58 +0000 | [diff] [blame] | 10885 | // IWYU pragma: private, include "upb/reflection/def.h" |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10886 | |
| 10887 | #ifndef UPB_REFLECTION_FIELD_DEF_H_ |
| 10888 | #define UPB_REFLECTION_FIELD_DEF_H_ |
| 10889 | |
| 10890 | |
| 10891 | // Must be last. |
| 10892 | |
| 10893 | // Maximum field number allowed for FieldDefs. |
| 10894 | // This is an inherent limit of the protobuf wire format. |
| 10895 | #define kUpb_MaxFieldNumber ((1 << 29) - 1) |
| 10896 | |
| 10897 | #ifdef __cplusplus |
| 10898 | extern "C" { |
| 10899 | #endif |
| 10900 | |
| 10901 | const upb_OneofDef* upb_FieldDef_ContainingOneof(const upb_FieldDef* f); |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 10902 | UPB_API const upb_MessageDef* upb_FieldDef_ContainingType( |
| 10903 | const upb_FieldDef* f); |
| 10904 | UPB_API upb_CType upb_FieldDef_CType(const upb_FieldDef* f); |
| 10905 | UPB_API upb_MessageValue upb_FieldDef_Default(const upb_FieldDef* f); |
| 10906 | UPB_API const upb_EnumDef* upb_FieldDef_EnumSubDef(const upb_FieldDef* f); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10907 | const upb_MessageDef* upb_FieldDef_ExtensionScope(const upb_FieldDef* f); |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 10908 | UPB_API const upb_FileDef* upb_FieldDef_File(const upb_FieldDef* f); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10909 | const char* upb_FieldDef_FullName(const upb_FieldDef* f); |
| 10910 | bool upb_FieldDef_HasDefault(const upb_FieldDef* f); |
| 10911 | bool upb_FieldDef_HasJsonName(const upb_FieldDef* f); |
| 10912 | bool upb_FieldDef_HasOptions(const upb_FieldDef* f); |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 10913 | UPB_API bool upb_FieldDef_HasPresence(const upb_FieldDef* f); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10914 | bool upb_FieldDef_HasSubDef(const upb_FieldDef* f); |
| 10915 | uint32_t upb_FieldDef_Index(const upb_FieldDef* f); |
| 10916 | bool upb_FieldDef_IsExtension(const upb_FieldDef* f); |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 10917 | UPB_API bool upb_FieldDef_IsMap(const upb_FieldDef* f); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10918 | bool upb_FieldDef_IsOptional(const upb_FieldDef* f); |
| 10919 | bool upb_FieldDef_IsPacked(const upb_FieldDef* f); |
| 10920 | bool upb_FieldDef_IsPrimitive(const upb_FieldDef* f); |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 10921 | UPB_API bool upb_FieldDef_IsRepeated(const upb_FieldDef* f); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10922 | bool upb_FieldDef_IsRequired(const upb_FieldDef* f); |
| 10923 | bool upb_FieldDef_IsString(const upb_FieldDef* f); |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 10924 | UPB_API bool upb_FieldDef_IsSubMessage(const upb_FieldDef* f); |
| 10925 | UPB_API const char* upb_FieldDef_JsonName(const upb_FieldDef* f); |
| 10926 | UPB_API upb_Label upb_FieldDef_Label(const upb_FieldDef* f); |
| 10927 | UPB_API const upb_MessageDef* upb_FieldDef_MessageSubDef(const upb_FieldDef* f); |
Protobuf Team Bot | b58bd40 | 2023-09-19 15:42:34 +0000 | [diff] [blame] | 10928 | bool _upb_FieldDef_ValidateUtf8(const upb_FieldDef* f); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10929 | |
| 10930 | // Creates a mini descriptor string for a field, returns true on success. |
| 10931 | bool upb_FieldDef_MiniDescriptorEncode(const upb_FieldDef* f, upb_Arena* a, |
| 10932 | upb_StringView* out); |
| 10933 | |
| 10934 | const upb_MiniTableField* upb_FieldDef_MiniTable(const upb_FieldDef* f); |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 10935 | UPB_API const char* upb_FieldDef_Name(const upb_FieldDef* f); |
| 10936 | UPB_API uint32_t upb_FieldDef_Number(const upb_FieldDef* f); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 10937 | const UPB_DESC(FieldOptions) * upb_FieldDef_Options(const upb_FieldDef* f); |
Protobuf Team Bot | ce9dcc2 | 2023-11-03 22:38:26 +0000 | [diff] [blame] | 10938 | const UPB_DESC(FeatureSet) * |
| 10939 | upb_FieldDef_ResolvedFeatures(const upb_FieldDef* f); |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 10940 | UPB_API const upb_OneofDef* upb_FieldDef_RealContainingOneof( |
| 10941 | const upb_FieldDef* f); |
| 10942 | UPB_API upb_FieldType upb_FieldDef_Type(const upb_FieldDef* f); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10943 | |
| 10944 | #ifdef __cplusplus |
| 10945 | } /* extern "C" */ |
| 10946 | #endif |
| 10947 | |
| 10948 | |
| 10949 | #endif /* UPB_REFLECTION_FIELD_DEF_H_ */ |
| 10950 | |
Protobuf Team Bot | 0631035 | 2023-09-26 21:54:58 +0000 | [diff] [blame] | 10951 | // IWYU pragma: private, include "upb/reflection/def.h" |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10952 | |
| 10953 | #ifndef UPB_REFLECTION_FILE_DEF_H_ |
| 10954 | #define UPB_REFLECTION_FILE_DEF_H_ |
| 10955 | |
| 10956 | |
| 10957 | // Must be last. |
| 10958 | |
| 10959 | #ifdef __cplusplus |
| 10960 | extern "C" { |
| 10961 | #endif |
| 10962 | |
Protobuf Team Bot | c6b149c | 2023-11-10 23:37:46 +0000 | [diff] [blame] | 10963 | UPB_API const char* upb_FileDef_EditionName(int edition); |
| 10964 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10965 | const upb_FileDef* upb_FileDef_Dependency(const upb_FileDef* f, int i); |
| 10966 | int upb_FileDef_DependencyCount(const upb_FileDef* f); |
| 10967 | bool upb_FileDef_HasOptions(const upb_FileDef* f); |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 10968 | UPB_API const char* upb_FileDef_Name(const upb_FileDef* f); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 10969 | const UPB_DESC(FileOptions) * upb_FileDef_Options(const upb_FileDef* f); |
Protobuf Team Bot | ce9dcc2 | 2023-11-03 22:38:26 +0000 | [diff] [blame] | 10970 | const UPB_DESC(FeatureSet) * upb_FileDef_ResolvedFeatures(const upb_FileDef* f); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10971 | const char* upb_FileDef_Package(const upb_FileDef* f); |
Protobuf Team Bot | 7dabac9 | 2023-09-07 18:35:50 +0000 | [diff] [blame] | 10972 | UPB_DESC(Edition) upb_FileDef_Edition(const upb_FileDef* f); |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 10973 | UPB_API const upb_DefPool* upb_FileDef_Pool(const upb_FileDef* f); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10974 | |
| 10975 | const upb_FileDef* upb_FileDef_PublicDependency(const upb_FileDef* f, int i); |
| 10976 | int upb_FileDef_PublicDependencyCount(const upb_FileDef* f); |
| 10977 | |
| 10978 | const upb_ServiceDef* upb_FileDef_Service(const upb_FileDef* f, int i); |
| 10979 | int upb_FileDef_ServiceCount(const upb_FileDef* f); |
| 10980 | |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 10981 | UPB_API upb_Syntax upb_FileDef_Syntax(const upb_FileDef* f); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10982 | |
| 10983 | const upb_EnumDef* upb_FileDef_TopLevelEnum(const upb_FileDef* f, int i); |
| 10984 | int upb_FileDef_TopLevelEnumCount(const upb_FileDef* f); |
| 10985 | |
| 10986 | const upb_FieldDef* upb_FileDef_TopLevelExtension(const upb_FileDef* f, int i); |
| 10987 | int upb_FileDef_TopLevelExtensionCount(const upb_FileDef* f); |
| 10988 | |
| 10989 | const upb_MessageDef* upb_FileDef_TopLevelMessage(const upb_FileDef* f, int i); |
| 10990 | int upb_FileDef_TopLevelMessageCount(const upb_FileDef* f); |
| 10991 | |
| 10992 | const upb_FileDef* upb_FileDef_WeakDependency(const upb_FileDef* f, int i); |
| 10993 | int upb_FileDef_WeakDependencyCount(const upb_FileDef* f); |
| 10994 | |
| 10995 | #ifdef __cplusplus |
| 10996 | } /* extern "C" */ |
| 10997 | #endif |
| 10998 | |
| 10999 | |
| 11000 | #endif /* UPB_REFLECTION_FILE_DEF_H_ */ |
| 11001 | |
Protobuf Team Bot | 0631035 | 2023-09-26 21:54:58 +0000 | [diff] [blame] | 11002 | // IWYU pragma: private, include "upb/reflection/def.h" |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11003 | |
| 11004 | #ifndef UPB_REFLECTION_MESSAGE_DEF_H_ |
| 11005 | #define UPB_REFLECTION_MESSAGE_DEF_H_ |
| 11006 | |
| 11007 | |
| 11008 | // Must be last. |
| 11009 | |
| 11010 | // Well-known field tag numbers for map-entry messages. |
| 11011 | #define kUpb_MapEntry_KeyFieldNumber 1 |
| 11012 | #define kUpb_MapEntry_ValueFieldNumber 2 |
| 11013 | |
| 11014 | // Well-known field tag numbers for Any messages. |
| 11015 | #define kUpb_Any_TypeFieldNumber 1 |
| 11016 | #define kUpb_Any_ValueFieldNumber 2 |
| 11017 | |
| 11018 | // Well-known field tag numbers for duration messages. |
| 11019 | #define kUpb_Duration_SecondsFieldNumber 1 |
| 11020 | #define kUpb_Duration_NanosFieldNumber 2 |
| 11021 | |
| 11022 | // Well-known field tag numbers for timestamp messages. |
| 11023 | #define kUpb_Timestamp_SecondsFieldNumber 1 |
| 11024 | #define kUpb_Timestamp_NanosFieldNumber 2 |
| 11025 | |
| 11026 | // All the different kind of well known type messages. For simplicity of check, |
| 11027 | // number wrappers and string wrappers are grouped together. Make sure the |
| 11028 | // order and number of these groups are not changed. |
| 11029 | typedef enum { |
| 11030 | kUpb_WellKnown_Unspecified, |
| 11031 | kUpb_WellKnown_Any, |
| 11032 | kUpb_WellKnown_FieldMask, |
| 11033 | kUpb_WellKnown_Duration, |
| 11034 | kUpb_WellKnown_Timestamp, |
| 11035 | |
| 11036 | // number wrappers |
| 11037 | kUpb_WellKnown_DoubleValue, |
| 11038 | kUpb_WellKnown_FloatValue, |
| 11039 | kUpb_WellKnown_Int64Value, |
| 11040 | kUpb_WellKnown_UInt64Value, |
| 11041 | kUpb_WellKnown_Int32Value, |
| 11042 | kUpb_WellKnown_UInt32Value, |
| 11043 | |
| 11044 | // string wrappers |
| 11045 | kUpb_WellKnown_StringValue, |
| 11046 | kUpb_WellKnown_BytesValue, |
| 11047 | kUpb_WellKnown_BoolValue, |
| 11048 | kUpb_WellKnown_Value, |
| 11049 | kUpb_WellKnown_ListValue, |
| 11050 | kUpb_WellKnown_Struct, |
| 11051 | } upb_WellKnown; |
| 11052 | |
| 11053 | #ifdef __cplusplus |
| 11054 | extern "C" { |
| 11055 | #endif |
| 11056 | |
| 11057 | const upb_MessageDef* upb_MessageDef_ContainingType(const upb_MessageDef* m); |
| 11058 | |
| 11059 | const upb_ExtensionRange* upb_MessageDef_ExtensionRange(const upb_MessageDef* m, |
| 11060 | int i); |
| 11061 | int upb_MessageDef_ExtensionRangeCount(const upb_MessageDef* m); |
| 11062 | |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11063 | UPB_API const upb_FieldDef* upb_MessageDef_Field(const upb_MessageDef* m, |
| 11064 | int i); |
| 11065 | UPB_API int upb_MessageDef_FieldCount(const upb_MessageDef* m); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11066 | |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11067 | UPB_API const upb_FileDef* upb_MessageDef_File(const upb_MessageDef* m); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11068 | |
| 11069 | // Returns a field by either JSON name or regular proto name. |
| 11070 | const upb_FieldDef* upb_MessageDef_FindByJsonNameWithSize( |
| 11071 | const upb_MessageDef* m, const char* name, size_t size); |
| 11072 | UPB_INLINE const upb_FieldDef* upb_MessageDef_FindByJsonName( |
| 11073 | const upb_MessageDef* m, const char* name) { |
| 11074 | return upb_MessageDef_FindByJsonNameWithSize(m, name, strlen(name)); |
| 11075 | } |
| 11076 | |
| 11077 | // Lookup of either field or oneof by name. Returns whether either was found. |
| 11078 | // If the return is true, then the found def will be set, and the non-found |
| 11079 | // one set to NULL. |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11080 | UPB_API bool upb_MessageDef_FindByNameWithSize(const upb_MessageDef* m, |
| 11081 | const char* name, size_t size, |
| 11082 | const upb_FieldDef** f, |
| 11083 | const upb_OneofDef** o); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11084 | UPB_INLINE bool upb_MessageDef_FindByName(const upb_MessageDef* m, |
| 11085 | const char* name, |
| 11086 | const upb_FieldDef** f, |
| 11087 | const upb_OneofDef** o) { |
| 11088 | return upb_MessageDef_FindByNameWithSize(m, name, strlen(name), f, o); |
| 11089 | } |
| 11090 | |
| 11091 | const upb_FieldDef* upb_MessageDef_FindFieldByName(const upb_MessageDef* m, |
| 11092 | const char* name); |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11093 | UPB_API const upb_FieldDef* upb_MessageDef_FindFieldByNameWithSize( |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11094 | const upb_MessageDef* m, const char* name, size_t size); |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11095 | UPB_API const upb_FieldDef* upb_MessageDef_FindFieldByNumber( |
| 11096 | const upb_MessageDef* m, uint32_t i); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11097 | const upb_OneofDef* upb_MessageDef_FindOneofByName(const upb_MessageDef* m, |
| 11098 | const char* name); |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11099 | UPB_API const upb_OneofDef* upb_MessageDef_FindOneofByNameWithSize( |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11100 | const upb_MessageDef* m, const char* name, size_t size); |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11101 | UPB_API const char* upb_MessageDef_FullName(const upb_MessageDef* m); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11102 | bool upb_MessageDef_HasOptions(const upb_MessageDef* m); |
| 11103 | bool upb_MessageDef_IsMapEntry(const upb_MessageDef* m); |
| 11104 | bool upb_MessageDef_IsMessageSet(const upb_MessageDef* m); |
| 11105 | |
| 11106 | // Creates a mini descriptor string for a message, returns true on success. |
| 11107 | bool upb_MessageDef_MiniDescriptorEncode(const upb_MessageDef* m, upb_Arena* a, |
| 11108 | upb_StringView* out); |
| 11109 | |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11110 | UPB_API const upb_MiniTable* upb_MessageDef_MiniTable(const upb_MessageDef* m); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11111 | const char* upb_MessageDef_Name(const upb_MessageDef* m); |
| 11112 | |
| 11113 | const upb_EnumDef* upb_MessageDef_NestedEnum(const upb_MessageDef* m, int i); |
| 11114 | const upb_FieldDef* upb_MessageDef_NestedExtension(const upb_MessageDef* m, |
| 11115 | int i); |
| 11116 | const upb_MessageDef* upb_MessageDef_NestedMessage(const upb_MessageDef* m, |
| 11117 | int i); |
| 11118 | |
| 11119 | int upb_MessageDef_NestedEnumCount(const upb_MessageDef* m); |
| 11120 | int upb_MessageDef_NestedExtensionCount(const upb_MessageDef* m); |
| 11121 | int upb_MessageDef_NestedMessageCount(const upb_MessageDef* m); |
| 11122 | |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11123 | UPB_API const upb_OneofDef* upb_MessageDef_Oneof(const upb_MessageDef* m, |
| 11124 | int i); |
| 11125 | UPB_API int upb_MessageDef_OneofCount(const upb_MessageDef* m); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 11126 | int upb_MessageDef_RealOneofCount(const upb_MessageDef* m); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11127 | |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 11128 | const UPB_DESC(MessageOptions) * |
| 11129 | upb_MessageDef_Options(const upb_MessageDef* m); |
Protobuf Team Bot | ce9dcc2 | 2023-11-03 22:38:26 +0000 | [diff] [blame] | 11130 | const UPB_DESC(FeatureSet) * |
| 11131 | upb_MessageDef_ResolvedFeatures(const upb_MessageDef* m); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11132 | |
| 11133 | upb_StringView upb_MessageDef_ReservedName(const upb_MessageDef* m, int i); |
| 11134 | int upb_MessageDef_ReservedNameCount(const upb_MessageDef* m); |
| 11135 | |
| 11136 | const upb_MessageReservedRange* upb_MessageDef_ReservedRange( |
| 11137 | const upb_MessageDef* m, int i); |
| 11138 | int upb_MessageDef_ReservedRangeCount(const upb_MessageDef* m); |
| 11139 | |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11140 | UPB_API upb_Syntax upb_MessageDef_Syntax(const upb_MessageDef* m); |
| 11141 | UPB_API upb_WellKnown upb_MessageDef_WellKnownType(const upb_MessageDef* m); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11142 | |
| 11143 | #ifdef __cplusplus |
| 11144 | } /* extern "C" */ |
| 11145 | #endif |
| 11146 | |
| 11147 | |
| 11148 | #endif /* UPB_REFLECTION_MESSAGE_DEF_H_ */ |
| 11149 | |
Protobuf Team Bot | 0631035 | 2023-09-26 21:54:58 +0000 | [diff] [blame] | 11150 | // IWYU pragma: private, include "upb/reflection/def.h" |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11151 | |
| 11152 | #ifndef UPB_REFLECTION_METHOD_DEF_H_ |
| 11153 | #define UPB_REFLECTION_METHOD_DEF_H_ |
| 11154 | |
| 11155 | |
| 11156 | // Must be last. |
| 11157 | |
| 11158 | #ifdef __cplusplus |
| 11159 | extern "C" { |
| 11160 | #endif |
| 11161 | |
| 11162 | bool upb_MethodDef_ClientStreaming(const upb_MethodDef* m); |
| 11163 | const char* upb_MethodDef_FullName(const upb_MethodDef* m); |
| 11164 | bool upb_MethodDef_HasOptions(const upb_MethodDef* m); |
| 11165 | int upb_MethodDef_Index(const upb_MethodDef* m); |
| 11166 | const upb_MessageDef* upb_MethodDef_InputType(const upb_MethodDef* m); |
| 11167 | const char* upb_MethodDef_Name(const upb_MethodDef* m); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 11168 | const UPB_DESC(MethodOptions) * upb_MethodDef_Options(const upb_MethodDef* m); |
Protobuf Team Bot | ce9dcc2 | 2023-11-03 22:38:26 +0000 | [diff] [blame] | 11169 | const UPB_DESC(FeatureSet) * |
| 11170 | upb_MethodDef_ResolvedFeatures(const upb_MethodDef* m); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11171 | const upb_MessageDef* upb_MethodDef_OutputType(const upb_MethodDef* m); |
| 11172 | bool upb_MethodDef_ServerStreaming(const upb_MethodDef* m); |
| 11173 | const upb_ServiceDef* upb_MethodDef_Service(const upb_MethodDef* m); |
| 11174 | |
| 11175 | #ifdef __cplusplus |
| 11176 | } /* extern "C" */ |
| 11177 | #endif |
| 11178 | |
| 11179 | |
| 11180 | #endif /* UPB_REFLECTION_METHOD_DEF_H_ */ |
| 11181 | |
Protobuf Team Bot | 0631035 | 2023-09-26 21:54:58 +0000 | [diff] [blame] | 11182 | // IWYU pragma: private, include "upb/reflection/def.h" |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11183 | |
| 11184 | #ifndef UPB_REFLECTION_ONEOF_DEF_H_ |
| 11185 | #define UPB_REFLECTION_ONEOF_DEF_H_ |
| 11186 | |
| 11187 | |
| 11188 | // Must be last. |
| 11189 | |
| 11190 | #ifdef __cplusplus |
| 11191 | extern "C" { |
| 11192 | #endif |
| 11193 | |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11194 | UPB_API const upb_MessageDef* upb_OneofDef_ContainingType( |
| 11195 | const upb_OneofDef* o); |
| 11196 | UPB_API const upb_FieldDef* upb_OneofDef_Field(const upb_OneofDef* o, int i); |
| 11197 | UPB_API int upb_OneofDef_FieldCount(const upb_OneofDef* o); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11198 | const char* upb_OneofDef_FullName(const upb_OneofDef* o); |
| 11199 | bool upb_OneofDef_HasOptions(const upb_OneofDef* o); |
| 11200 | uint32_t upb_OneofDef_Index(const upb_OneofDef* o); |
| 11201 | bool upb_OneofDef_IsSynthetic(const upb_OneofDef* o); |
| 11202 | const upb_FieldDef* upb_OneofDef_LookupName(const upb_OneofDef* o, |
| 11203 | const char* name); |
| 11204 | const upb_FieldDef* upb_OneofDef_LookupNameWithSize(const upb_OneofDef* o, |
| 11205 | const char* name, |
| 11206 | size_t size); |
| 11207 | const upb_FieldDef* upb_OneofDef_LookupNumber(const upb_OneofDef* o, |
| 11208 | uint32_t num); |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11209 | UPB_API const char* upb_OneofDef_Name(const upb_OneofDef* o); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11210 | int upb_OneofDef_numfields(const upb_OneofDef* o); |
Protobuf Team Bot | ce9dcc2 | 2023-11-03 22:38:26 +0000 | [diff] [blame] | 11211 | const UPB_DESC(OneofOptions*) upb_OneofDef_Options(const upb_OneofDef* o); |
| 11212 | const UPB_DESC(FeatureSet*) |
| 11213 | upb_OneofDef_ResolvedFeatures(const upb_OneofDef* o); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11214 | |
| 11215 | #ifdef __cplusplus |
| 11216 | } /* extern "C" */ |
| 11217 | #endif |
| 11218 | |
| 11219 | |
| 11220 | #endif /* UPB_REFLECTION_ONEOF_DEF_H_ */ |
| 11221 | |
Protobuf Team Bot | 0631035 | 2023-09-26 21:54:58 +0000 | [diff] [blame] | 11222 | // IWYU pragma: private, include "upb/reflection/def.h" |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11223 | |
| 11224 | #ifndef UPB_REFLECTION_SERVICE_DEF_H_ |
| 11225 | #define UPB_REFLECTION_SERVICE_DEF_H_ |
| 11226 | |
| 11227 | |
| 11228 | // Must be last. |
| 11229 | |
| 11230 | #ifdef __cplusplus |
| 11231 | extern "C" { |
| 11232 | #endif |
| 11233 | |
| 11234 | const upb_FileDef* upb_ServiceDef_File(const upb_ServiceDef* s); |
| 11235 | const upb_MethodDef* upb_ServiceDef_FindMethodByName(const upb_ServiceDef* s, |
| 11236 | const char* name); |
| 11237 | const char* upb_ServiceDef_FullName(const upb_ServiceDef* s); |
| 11238 | bool upb_ServiceDef_HasOptions(const upb_ServiceDef* s); |
| 11239 | int upb_ServiceDef_Index(const upb_ServiceDef* s); |
| 11240 | const upb_MethodDef* upb_ServiceDef_Method(const upb_ServiceDef* s, int i); |
| 11241 | int upb_ServiceDef_MethodCount(const upb_ServiceDef* s); |
| 11242 | const char* upb_ServiceDef_Name(const upb_ServiceDef* s); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 11243 | const UPB_DESC(ServiceOptions) * |
| 11244 | upb_ServiceDef_Options(const upb_ServiceDef* s); |
Protobuf Team Bot | ce9dcc2 | 2023-11-03 22:38:26 +0000 | [diff] [blame] | 11245 | const UPB_DESC(FeatureSet) * |
| 11246 | upb_ServiceDef_ResolvedFeatures(const upb_ServiceDef* s); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11247 | |
| 11248 | #ifdef __cplusplus |
| 11249 | } /* extern "C" */ |
| 11250 | #endif |
| 11251 | |
| 11252 | |
| 11253 | #endif /* UPB_REFLECTION_SERVICE_DEF_H_ */ |
Protobuf Team Bot | ffc56ba | 2023-09-08 15:29:06 +0000 | [diff] [blame] | 11254 | // IWYU pragma: end_exports |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11255 | |
| 11256 | #endif /* UPB_REFLECTION_DEF_H_ */ |
| 11257 | |
| 11258 | // Must be last. |
| 11259 | |
| 11260 | #ifdef __cplusplus |
| 11261 | extern "C" { |
| 11262 | #endif |
| 11263 | |
| 11264 | enum { upb_JsonDecode_IgnoreUnknown = 1 }; |
| 11265 | |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11266 | UPB_API bool upb_JsonDecode(const char* buf, size_t size, upb_Message* msg, |
| 11267 | const upb_MessageDef* m, const upb_DefPool* symtab, |
| 11268 | int options, upb_Arena* arena, upb_Status* status); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11269 | |
| 11270 | #ifdef __cplusplus |
| 11271 | } /* extern "C" */ |
| 11272 | #endif |
| 11273 | |
| 11274 | |
| 11275 | #endif /* UPB_JSONDECODE_H_ */ |
| 11276 | |
| 11277 | #ifndef UPB_LEX_ATOI_H_ |
| 11278 | #define UPB_LEX_ATOI_H_ |
| 11279 | |
Adam Cozzette | 7d5592e | 2023-08-23 12:15:26 -0700 | [diff] [blame] | 11280 | #include <stdint.h> |
| 11281 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11282 | // Must be last. |
| 11283 | |
| 11284 | #ifdef __cplusplus |
| 11285 | extern "C" { |
| 11286 | #endif |
| 11287 | |
| 11288 | // We use these hand-written routines instead of strto[u]l() because the "long |
| 11289 | // long" variants aren't in c89. Also our version allows setting a ptr limit. |
| 11290 | // Return the new position of the pointer after parsing the int, or NULL on |
| 11291 | // integer overflow. |
| 11292 | |
| 11293 | const char* upb_BufToUint64(const char* ptr, const char* end, uint64_t* val); |
| 11294 | const char* upb_BufToInt64(const char* ptr, const char* end, int64_t* val, |
| 11295 | bool* is_neg); |
| 11296 | |
| 11297 | #ifdef __cplusplus |
| 11298 | } /* extern "C" */ |
| 11299 | #endif |
| 11300 | |
| 11301 | |
| 11302 | #endif /* UPB_LEX_ATOI_H_ */ |
| 11303 | |
| 11304 | #ifndef UPB_LEX_UNICODE_H_ |
| 11305 | #define UPB_LEX_UNICODE_H_ |
| 11306 | |
Adam Cozzette | 7d5592e | 2023-08-23 12:15:26 -0700 | [diff] [blame] | 11307 | #include <stdint.h> |
| 11308 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11309 | // Must be last. |
| 11310 | |
| 11311 | #ifdef __cplusplus |
| 11312 | extern "C" { |
| 11313 | #endif |
| 11314 | |
| 11315 | // Returns true iff a codepoint is the value for a high surrogate. |
| 11316 | UPB_INLINE bool upb_Unicode_IsHigh(uint32_t cp) { |
| 11317 | return (cp >= 0xd800 && cp <= 0xdbff); |
| 11318 | } |
| 11319 | |
| 11320 | // Returns true iff a codepoint is the value for a low surrogate. |
| 11321 | UPB_INLINE bool upb_Unicode_IsLow(uint32_t cp) { |
| 11322 | return (cp >= 0xdc00 && cp <= 0xdfff); |
| 11323 | } |
| 11324 | |
| 11325 | // Returns the high 16-bit surrogate value for a supplementary codepoint. |
| 11326 | // Does not sanity-check the input. |
| 11327 | UPB_INLINE uint16_t upb_Unicode_ToHigh(uint32_t cp) { |
| 11328 | return (cp >> 10) + 0xd7c0; |
| 11329 | } |
| 11330 | |
| 11331 | // Returns the low 16-bit surrogate value for a supplementary codepoint. |
| 11332 | // Does not sanity-check the input. |
| 11333 | UPB_INLINE uint16_t upb_Unicode_ToLow(uint32_t cp) { |
| 11334 | return (cp & 0x3ff) | 0xdc00; |
| 11335 | } |
| 11336 | |
| 11337 | // Returns the 32-bit value corresponding to a pair of 16-bit surrogates. |
| 11338 | // Does not sanity-check the input. |
| 11339 | UPB_INLINE uint32_t upb_Unicode_FromPair(uint32_t high, uint32_t low) { |
| 11340 | return ((high & 0x3ff) << 10) + (low & 0x3ff) + 0x10000; |
| 11341 | } |
| 11342 | |
| 11343 | // Outputs a codepoint as UTF8. |
| 11344 | // Returns the number of bytes written (1-4 on success, 0 on error). |
| 11345 | // Does not sanity-check the input. Specifically does not check for surrogates. |
| 11346 | int upb_Unicode_ToUTF8(uint32_t cp, char* out); |
| 11347 | |
| 11348 | #ifdef __cplusplus |
| 11349 | } /* extern "C" */ |
| 11350 | #endif |
| 11351 | |
| 11352 | |
| 11353 | #endif /* UPB_LEX_UNICODE_H_ */ |
| 11354 | |
| 11355 | #ifndef UPB_REFLECTION_MESSAGE_H_ |
| 11356 | #define UPB_REFLECTION_MESSAGE_H_ |
| 11357 | |
Protobuf Team Bot | 473d20d | 2023-09-15 22:27:16 +0000 | [diff] [blame] | 11358 | #include <stddef.h> |
| 11359 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11360 | |
| 11361 | // Must be last. |
| 11362 | |
| 11363 | #ifdef __cplusplus |
| 11364 | extern "C" { |
| 11365 | #endif |
| 11366 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 11367 | // Returns a mutable pointer to a map, array, or submessage value. If the given |
| 11368 | // arena is non-NULL this will construct a new object if it was not previously |
| 11369 | // present. May not be called for primitive fields. |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11370 | UPB_API upb_MutableMessageValue upb_Message_Mutable(upb_Message* msg, |
| 11371 | const upb_FieldDef* f, |
| 11372 | upb_Arena* a); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11373 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 11374 | // 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] | 11375 | UPB_API const upb_FieldDef* upb_Message_WhichOneof(const upb_Message* msg, |
| 11376 | const upb_OneofDef* o); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11377 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 11378 | // Clear all data and unknown fields. |
| 11379 | void upb_Message_ClearByDef(upb_Message* msg, const upb_MessageDef* m); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11380 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 11381 | // Clears any field presence and sets the value back to its default. |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11382 | UPB_API void upb_Message_ClearFieldByDef(upb_Message* msg, |
| 11383 | const upb_FieldDef* f); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11384 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 11385 | // May only be called for fields where upb_FieldDef_HasPresence(f) == true. |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11386 | UPB_API bool upb_Message_HasFieldByDef(const upb_Message* msg, |
| 11387 | const upb_FieldDef* f); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11388 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 11389 | // Returns the value in the message associated with this field def. |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11390 | UPB_API upb_MessageValue upb_Message_GetFieldByDef(const upb_Message* msg, |
| 11391 | const upb_FieldDef* f); |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 11392 | |
| 11393 | // Sets the given field to the given value. For a msg/array/map/string, the |
| 11394 | // caller must ensure that the target data outlives |msg| (by living either in |
| 11395 | // the same arena or a different arena that outlives it). |
| 11396 | // |
| 11397 | // Returns false if allocation fails. |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11398 | UPB_API bool upb_Message_SetFieldByDef(upb_Message* msg, const upb_FieldDef* f, |
| 11399 | upb_MessageValue val, upb_Arena* a); |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 11400 | |
| 11401 | // Iterate over present fields. |
| 11402 | // |
| 11403 | // size_t iter = kUpb_Message_Begin; |
| 11404 | // const upb_FieldDef *f; |
| 11405 | // upb_MessageValue val; |
| 11406 | // while (upb_Message_Next(msg, m, ext_pool, &f, &val, &iter)) { |
| 11407 | // process_field(f, val); |
| 11408 | // } |
| 11409 | // |
| 11410 | // If ext_pool is NULL, no extensions will be returned. If the given symtab |
| 11411 | // returns extensions that don't match what is in this message, those extensions |
| 11412 | // will be skipped. |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11413 | |
| 11414 | #define kUpb_Message_Begin -1 |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 11415 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11416 | bool upb_Message_Next(const upb_Message* msg, const upb_MessageDef* m, |
| 11417 | const upb_DefPool* ext_pool, const upb_FieldDef** f, |
| 11418 | upb_MessageValue* val, size_t* iter); |
| 11419 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 11420 | // Clears all unknown field data from this message and all submessages. |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11421 | UPB_API bool upb_Message_DiscardUnknown(upb_Message* msg, |
| 11422 | const upb_MessageDef* m, int maxdepth); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11423 | |
| 11424 | #ifdef __cplusplus |
| 11425 | } /* extern "C" */ |
| 11426 | #endif |
| 11427 | |
| 11428 | |
| 11429 | #endif /* UPB_REFLECTION_MESSAGE_H_ */ |
| 11430 | |
| 11431 | #ifndef UPB_JSON_ENCODE_H_ |
| 11432 | #define UPB_JSON_ENCODE_H_ |
| 11433 | |
| 11434 | |
| 11435 | // Must be last. |
| 11436 | |
| 11437 | #ifdef __cplusplus |
| 11438 | extern "C" { |
| 11439 | #endif |
| 11440 | |
| 11441 | enum { |
Protobuf Team Bot | 986cbb6 | 2023-09-19 15:03:51 +0000 | [diff] [blame] | 11442 | /* When set, emits 0/default values. TODO: proto3 only? */ |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11443 | upb_JsonEncode_EmitDefaults = 1 << 0, |
| 11444 | |
| 11445 | /* When set, use normal (snake_case) field names instead of JSON (camelCase) |
| 11446 | names. */ |
| 11447 | upb_JsonEncode_UseProtoNames = 1 << 1, |
| 11448 | |
| 11449 | /* When set, emits enums as their integer values instead of as their names. */ |
| 11450 | upb_JsonEncode_FormatEnumsAsIntegers = 1 << 2 |
| 11451 | }; |
| 11452 | |
| 11453 | /* 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] | 11454 | * |m|. The DefPool in |ext_pool| is used to find extensions (if NULL, |
| 11455 | * extensions will not be printed). |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11456 | * |
| 11457 | * Output is placed in the given buffer, and always NULL-terminated. The output |
| 11458 | * size (excluding NULL) is returned. This means that a return value >= |size| |
| 11459 | * implies that the output was truncated. (These are the same semantics as |
| 11460 | * snprintf()). */ |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11461 | UPB_API size_t upb_JsonEncode(const upb_Message* msg, const upb_MessageDef* m, |
| 11462 | const upb_DefPool* ext_pool, int options, |
| 11463 | char* buf, size_t size, upb_Status* status); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11464 | |
| 11465 | #ifdef __cplusplus |
| 11466 | } /* extern "C" */ |
| 11467 | #endif |
| 11468 | |
| 11469 | |
| 11470 | #endif /* UPB_JSONENCODE_H_ */ |
| 11471 | |
| 11472 | #ifndef UPB_LEX_ROUND_TRIP_H_ |
| 11473 | #define UPB_LEX_ROUND_TRIP_H_ |
| 11474 | |
| 11475 | // Must be last. |
| 11476 | |
| 11477 | // Encodes a float or double that is round-trippable, but as short as possible. |
| 11478 | // These routines are not fully optimal (not guaranteed to be shortest), but are |
| 11479 | // short-ish and match the implementation that has been used in protobuf since |
| 11480 | // the beginning. |
| 11481 | |
| 11482 | // The given buffer size must be at least kUpb_RoundTripBufferSize. |
| 11483 | enum { kUpb_RoundTripBufferSize = 32 }; |
| 11484 | |
| 11485 | #ifdef __cplusplus |
| 11486 | extern "C" { |
| 11487 | #endif |
| 11488 | |
| 11489 | void _upb_EncodeRoundTripDouble(double val, char* buf, size_t size); |
| 11490 | void _upb_EncodeRoundTripFloat(float val, char* buf, size_t size); |
| 11491 | |
| 11492 | #ifdef __cplusplus |
| 11493 | } /* extern "C" */ |
| 11494 | #endif |
| 11495 | |
| 11496 | |
| 11497 | #endif /* UPB_LEX_ROUND_TRIP_H_ */ |
| 11498 | |
| 11499 | #ifndef UPB_PORT_VSNPRINTF_COMPAT_H_ |
| 11500 | #define UPB_PORT_VSNPRINTF_COMPAT_H_ |
| 11501 | |
| 11502 | // Must be last. |
| 11503 | |
| 11504 | UPB_INLINE int _upb_vsnprintf(char* buf, size_t size, const char* fmt, |
| 11505 | va_list ap) { |
| 11506 | #if defined(__MINGW64__) || defined(__MINGW32__) || defined(_MSC_VER) |
| 11507 | // The msvc runtime has a non-conforming vsnprintf() that requires the |
| 11508 | // following compatibility code to become conformant. |
| 11509 | int n = -1; |
| 11510 | if (size != 0) n = _vsnprintf_s(buf, size, _TRUNCATE, fmt, ap); |
| 11511 | if (n == -1) n = _vscprintf(fmt, ap); |
| 11512 | return n; |
| 11513 | #else |
| 11514 | return vsnprintf(buf, size, fmt, ap); |
| 11515 | #endif |
| 11516 | } |
| 11517 | |
| 11518 | |
| 11519 | #endif // UPB_PORT_VSNPRINTF_COMPAT_H_ |
| 11520 | |
| 11521 | #ifndef UPB_LEX_STRTOD_H_ |
| 11522 | #define UPB_LEX_STRTOD_H_ |
| 11523 | |
| 11524 | // Must be last. |
| 11525 | |
| 11526 | #ifdef __cplusplus |
| 11527 | extern "C" { |
| 11528 | #endif |
| 11529 | |
| 11530 | double _upb_NoLocaleStrtod(const char *str, char **endptr); |
| 11531 | |
| 11532 | #ifdef __cplusplus |
| 11533 | } /* extern "C" */ |
| 11534 | #endif |
| 11535 | |
| 11536 | |
| 11537 | #endif /* UPB_LEX_STRTOD_H_ */ |
| 11538 | |
Sandy Zhang | e3b0943 | 2023-08-07 09:30:02 -0700 | [diff] [blame] | 11539 | #ifndef UPB_MEM_INTERNAL_ARENA_H_ |
| 11540 | #define UPB_MEM_INTERNAL_ARENA_H_ |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11541 | |
| 11542 | |
| 11543 | // Must be last. |
| 11544 | |
| 11545 | typedef struct _upb_MemBlock _upb_MemBlock; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 11546 | |
| 11547 | struct upb_Arena { |
| 11548 | _upb_ArenaHead head; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 11549 | |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 11550 | // upb_alloc* together with a low bit which signals if there is an initial |
| 11551 | // block. |
| 11552 | uintptr_t block_alloc; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 11553 | |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 11554 | // When multiple arenas are fused together, each arena points to a parent |
| 11555 | // arena (root points to itself). The root tracks how many live arenas |
| 11556 | // reference it. |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 11557 | |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 11558 | // The low bit is tagged: |
| 11559 | // 0: pointer to parent |
| 11560 | // 1: count, left shifted by one |
| 11561 | UPB_ATOMIC(uintptr_t) parent_or_count; |
| 11562 | |
| 11563 | // All nodes that are fused together are in a singly-linked list. |
| 11564 | UPB_ATOMIC(upb_Arena*) next; // NULL at end of list. |
| 11565 | |
| 11566 | // The last element of the linked list. This is present only as an |
| 11567 | // optimization, so that we do not have to iterate over all members for every |
| 11568 | // fuse. Only significant for an arena root. In other cases it is ignored. |
| 11569 | UPB_ATOMIC(upb_Arena*) tail; // == self when no other list members. |
| 11570 | |
| 11571 | // Linked list of blocks to free/cleanup. Atomic only for the benefit of |
| 11572 | // upb_Arena_SpaceAllocated(). |
| 11573 | UPB_ATOMIC(_upb_MemBlock*) blocks; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 11574 | }; |
| 11575 | |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 11576 | UPB_INLINE bool _upb_Arena_IsTaggedRefcount(uintptr_t parent_or_count) { |
| 11577 | return (parent_or_count & 1) == 1; |
| 11578 | } |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11579 | |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 11580 | UPB_INLINE bool _upb_Arena_IsTaggedPointer(uintptr_t parent_or_count) { |
| 11581 | return (parent_or_count & 1) == 0; |
| 11582 | } |
| 11583 | |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 11584 | UPB_INLINE uintptr_t _upb_Arena_RefCountFromTagged(uintptr_t parent_or_count) { |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 11585 | UPB_ASSERT(_upb_Arena_IsTaggedRefcount(parent_or_count)); |
| 11586 | return parent_or_count >> 1; |
| 11587 | } |
| 11588 | |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 11589 | UPB_INLINE uintptr_t _upb_Arena_TaggedFromRefcount(uintptr_t refcount) { |
| 11590 | uintptr_t parent_or_count = (refcount << 1) | 1; |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 11591 | UPB_ASSERT(_upb_Arena_IsTaggedRefcount(parent_or_count)); |
| 11592 | return parent_or_count; |
| 11593 | } |
| 11594 | |
| 11595 | UPB_INLINE upb_Arena* _upb_Arena_PointerFromTagged(uintptr_t parent_or_count) { |
| 11596 | UPB_ASSERT(_upb_Arena_IsTaggedPointer(parent_or_count)); |
| 11597 | return (upb_Arena*)parent_or_count; |
| 11598 | } |
| 11599 | |
| 11600 | UPB_INLINE uintptr_t _upb_Arena_TaggedFromPointer(upb_Arena* a) { |
| 11601 | uintptr_t parent_or_count = (uintptr_t)a; |
| 11602 | UPB_ASSERT(_upb_Arena_IsTaggedPointer(parent_or_count)); |
| 11603 | return parent_or_count; |
| 11604 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 11605 | |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 11606 | UPB_INLINE upb_alloc* upb_Arena_BlockAlloc(upb_Arena* arena) { |
| 11607 | return (upb_alloc*)(arena->block_alloc & ~0x1); |
| 11608 | } |
| 11609 | |
| 11610 | UPB_INLINE uintptr_t upb_Arena_MakeBlockAlloc(upb_alloc* alloc, |
| 11611 | bool has_initial) { |
| 11612 | uintptr_t alloc_uint = (uintptr_t)alloc; |
| 11613 | UPB_ASSERT((alloc_uint & 1) == 0); |
| 11614 | return alloc_uint | (has_initial ? 1 : 0); |
| 11615 | } |
| 11616 | |
| 11617 | UPB_INLINE bool upb_Arena_HasInitialBlock(upb_Arena* arena) { |
| 11618 | return arena->block_alloc & 0x1; |
| 11619 | } |
| 11620 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 11621 | |
Sandy Zhang | e3b0943 | 2023-08-07 09:30:02 -0700 | [diff] [blame] | 11622 | #endif /* UPB_MEM_INTERNAL_ARENA_H_ */ |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11623 | |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 11624 | #ifndef UPB_PORT_ATOMIC_H_ |
| 11625 | #define UPB_PORT_ATOMIC_H_ |
| 11626 | |
| 11627 | |
| 11628 | #ifdef UPB_USE_C11_ATOMICS |
| 11629 | |
Protobuf Team Bot | 743bf92 | 2023-09-14 01:12:11 +0000 | [diff] [blame] | 11630 | // IWYU pragma: begin_exports |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 11631 | #include <stdatomic.h> |
| 11632 | #include <stdbool.h> |
Protobuf Team Bot | 743bf92 | 2023-09-14 01:12:11 +0000 | [diff] [blame] | 11633 | // IWYU pragma: end_exports |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 11634 | |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 11635 | #define upb_Atomic_Init(addr, val) atomic_init(addr, val) |
| 11636 | #define upb_Atomic_Load(addr, order) atomic_load_explicit(addr, order) |
| 11637 | #define upb_Atomic_Store(addr, val, order) \ |
| 11638 | atomic_store_explicit(addr, val, order) |
| 11639 | #define upb_Atomic_Add(addr, val, order) \ |
| 11640 | atomic_fetch_add_explicit(addr, val, order) |
| 11641 | #define upb_Atomic_Sub(addr, val, order) \ |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 11642 | atomic_fetch_sub_explicit(addr, val, order) |
| 11643 | #define upb_Atomic_Exchange(addr, val, order) \ |
| 11644 | atomic_exchange_explicit(addr, val, order) |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 11645 | #define upb_Atomic_CompareExchangeStrong(addr, expected, desired, \ |
| 11646 | success_order, failure_order) \ |
| 11647 | atomic_compare_exchange_strong_explicit(addr, expected, desired, \ |
| 11648 | success_order, failure_order) |
| 11649 | #define upb_Atomic_CompareExchangeWeak(addr, expected, desired, success_order, \ |
| 11650 | failure_order) \ |
| 11651 | atomic_compare_exchange_weak_explicit(addr, expected, desired, \ |
| 11652 | success_order, failure_order) |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 11653 | |
| 11654 | #else // !UPB_USE_C11_ATOMICS |
| 11655 | |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 11656 | #include <string.h> |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 11657 | |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 11658 | #define upb_Atomic_Init(addr, val) (*addr = val) |
| 11659 | #define upb_Atomic_Load(addr, order) (*addr) |
| 11660 | #define upb_Atomic_Store(addr, val, order) (*(addr) = val) |
| 11661 | #define upb_Atomic_Add(addr, val, order) (*(addr) += val) |
| 11662 | #define upb_Atomic_Sub(addr, val, order) (*(addr) -= val) |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 11663 | |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 11664 | UPB_INLINE void* _upb_NonAtomic_Exchange(void* addr, void* value) { |
| 11665 | void* old; |
| 11666 | memcpy(&old, addr, sizeof(value)); |
| 11667 | memcpy(addr, &value, sizeof(value)); |
| 11668 | return old; |
| 11669 | } |
| 11670 | |
| 11671 | #define upb_Atomic_Exchange(addr, val, order) _upb_NonAtomic_Exchange(addr, val) |
| 11672 | |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 11673 | // `addr` and `expected` are logically double pointers. |
| 11674 | UPB_INLINE bool _upb_NonAtomic_CompareExchangeStrongP(void* addr, |
| 11675 | void* expected, |
| 11676 | void* desired) { |
| 11677 | if (memcmp(addr, expected, sizeof(desired)) == 0) { |
| 11678 | memcpy(addr, &desired, sizeof(desired)); |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 11679 | return true; |
| 11680 | } else { |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 11681 | memcpy(expected, addr, sizeof(desired)); |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 11682 | return false; |
| 11683 | } |
| 11684 | } |
| 11685 | |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 11686 | #define upb_Atomic_CompareExchangeStrong(addr, expected, desired, \ |
| 11687 | success_order, failure_order) \ |
| 11688 | _upb_NonAtomic_CompareExchangeStrongP((void*)addr, (void*)expected, \ |
| 11689 | (void*)desired) |
| 11690 | #define upb_Atomic_CompareExchangeWeak(addr, expected, desired, success_order, \ |
| 11691 | failure_order) \ |
| 11692 | upb_Atomic_CompareExchangeStrong(addr, expected, desired, 0, 0) |
| 11693 | |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 11694 | #endif |
| 11695 | |
| 11696 | |
| 11697 | #endif // UPB_PORT_ATOMIC_H_ |
| 11698 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 11699 | #ifndef UPB_WIRE_READER_H_ |
| 11700 | #define UPB_WIRE_READER_H_ |
| 11701 | |
| 11702 | |
Sandy Zhang | e3b0943 | 2023-08-07 09:30:02 -0700 | [diff] [blame] | 11703 | #ifndef UPB_WIRE_INTERNAL_SWAP_H_ |
| 11704 | #define UPB_WIRE_INTERNAL_SWAP_H_ |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 11705 | |
Adam Cozzette | 7d5592e | 2023-08-23 12:15:26 -0700 | [diff] [blame] | 11706 | #include <stdint.h> |
| 11707 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 11708 | // Must be last. |
| 11709 | |
| 11710 | #ifdef __cplusplus |
| 11711 | extern "C" { |
| 11712 | #endif |
| 11713 | |
| 11714 | UPB_INLINE bool _upb_IsLittleEndian(void) { |
| 11715 | int x = 1; |
| 11716 | return *(char*)&x == 1; |
| 11717 | } |
| 11718 | |
| 11719 | UPB_INLINE uint32_t _upb_BigEndian_Swap32(uint32_t val) { |
| 11720 | if (_upb_IsLittleEndian()) return val; |
| 11721 | |
| 11722 | return ((val & 0xff) << 24) | ((val & 0xff00) << 8) | |
| 11723 | ((val & 0xff0000) >> 8) | ((val & 0xff000000) >> 24); |
| 11724 | } |
| 11725 | |
| 11726 | UPB_INLINE uint64_t _upb_BigEndian_Swap64(uint64_t val) { |
| 11727 | if (_upb_IsLittleEndian()) return val; |
| 11728 | |
| 11729 | return ((uint64_t)_upb_BigEndian_Swap32((uint32_t)val) << 32) | |
| 11730 | _upb_BigEndian_Swap32((uint32_t)(val >> 32)); |
| 11731 | } |
| 11732 | |
| 11733 | #ifdef __cplusplus |
| 11734 | } /* extern "C" */ |
| 11735 | #endif |
| 11736 | |
| 11737 | |
Sandy Zhang | e3b0943 | 2023-08-07 09:30:02 -0700 | [diff] [blame] | 11738 | #endif /* UPB_WIRE_INTERNAL_SWAP_H_ */ |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 11739 | |
Protobuf Team Bot | 743bf92 | 2023-09-14 01:12:11 +0000 | [diff] [blame] | 11740 | #ifndef UPB_WIRE_TYPES_H_ |
| 11741 | #define UPB_WIRE_TYPES_H_ |
| 11742 | |
| 11743 | // A list of types as they are encoded on the wire. |
| 11744 | typedef enum { |
| 11745 | kUpb_WireType_Varint = 0, |
| 11746 | kUpb_WireType_64Bit = 1, |
| 11747 | kUpb_WireType_Delimited = 2, |
| 11748 | kUpb_WireType_StartGroup = 3, |
| 11749 | kUpb_WireType_EndGroup = 4, |
| 11750 | kUpb_WireType_32Bit = 5 |
| 11751 | } upb_WireType; |
| 11752 | |
| 11753 | #endif /* UPB_WIRE_TYPES_H_ */ |
| 11754 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 11755 | // Must be last. |
| 11756 | |
| 11757 | #ifdef __cplusplus |
| 11758 | extern "C" { |
| 11759 | #endif |
| 11760 | |
| 11761 | // The upb_WireReader interface is suitable for general-purpose parsing of |
| 11762 | // protobuf binary wire format. It is designed to be used along with |
| 11763 | // upb_EpsCopyInputStream for buffering, and all parsing routines in this file |
| 11764 | // assume that at least kUpb_EpsCopyInputStream_SlopBytes worth of data is |
| 11765 | // available to read without any bounds checks. |
| 11766 | |
| 11767 | #define kUpb_WireReader_WireTypeMask 7 |
| 11768 | #define kUpb_WireReader_WireTypeBits 3 |
| 11769 | |
| 11770 | typedef struct { |
| 11771 | const char* ptr; |
| 11772 | uint64_t val; |
| 11773 | } _upb_WireReader_ReadLongVarintRet; |
| 11774 | |
| 11775 | _upb_WireReader_ReadLongVarintRet _upb_WireReader_ReadLongVarint( |
| 11776 | const char* ptr, uint64_t val); |
| 11777 | |
| 11778 | static UPB_FORCEINLINE const char* _upb_WireReader_ReadVarint(const char* ptr, |
| 11779 | uint64_t* val, |
| 11780 | int maxlen, |
| 11781 | uint64_t maxval) { |
| 11782 | uint64_t byte = (uint8_t)*ptr; |
| 11783 | if (UPB_LIKELY((byte & 0x80) == 0)) { |
| 11784 | *val = (uint32_t)byte; |
| 11785 | return ptr + 1; |
| 11786 | } |
| 11787 | const char* start = ptr; |
| 11788 | _upb_WireReader_ReadLongVarintRet res = |
| 11789 | _upb_WireReader_ReadLongVarint(ptr, byte); |
| 11790 | if (!res.ptr || (maxlen < 10 && res.ptr - start > maxlen) || |
| 11791 | res.val > maxval) { |
| 11792 | return NULL; // Malformed. |
| 11793 | } |
| 11794 | *val = res.val; |
| 11795 | return res.ptr; |
| 11796 | } |
| 11797 | |
| 11798 | // Parses a tag into `tag`, and returns a pointer past the end of the tag, or |
| 11799 | // NULL if there was an error in the tag data. |
| 11800 | // |
| 11801 | // REQUIRES: there must be at least 10 bytes of data available at `ptr`. |
| 11802 | // Bounds checks must be performed before calling this function, preferably |
| 11803 | // by calling upb_EpsCopyInputStream_IsDone(). |
| 11804 | static UPB_FORCEINLINE const char* upb_WireReader_ReadTag(const char* ptr, |
| 11805 | uint32_t* tag) { |
| 11806 | uint64_t val; |
| 11807 | ptr = _upb_WireReader_ReadVarint(ptr, &val, 5, UINT32_MAX); |
| 11808 | if (!ptr) return NULL; |
| 11809 | *tag = val; |
| 11810 | return ptr; |
| 11811 | } |
| 11812 | |
| 11813 | // Given a tag, returns the field number. |
| 11814 | UPB_INLINE uint32_t upb_WireReader_GetFieldNumber(uint32_t tag) { |
| 11815 | return tag >> kUpb_WireReader_WireTypeBits; |
| 11816 | } |
| 11817 | |
| 11818 | // Given a tag, returns the wire type. |
| 11819 | UPB_INLINE uint8_t upb_WireReader_GetWireType(uint32_t tag) { |
| 11820 | return tag & kUpb_WireReader_WireTypeMask; |
| 11821 | } |
| 11822 | |
| 11823 | UPB_INLINE const char* upb_WireReader_ReadVarint(const char* ptr, |
| 11824 | uint64_t* val) { |
| 11825 | return _upb_WireReader_ReadVarint(ptr, val, 10, UINT64_MAX); |
| 11826 | } |
| 11827 | |
| 11828 | // Skips data for a varint, returning a pointer past the end of the varint, or |
| 11829 | // NULL if there was an error in the varint data. |
| 11830 | // |
| 11831 | // REQUIRES: there must be at least 10 bytes of data available at `ptr`. |
| 11832 | // Bounds checks must be performed before calling this function, preferably |
| 11833 | // by calling upb_EpsCopyInputStream_IsDone(). |
| 11834 | UPB_INLINE const char* upb_WireReader_SkipVarint(const char* ptr) { |
| 11835 | uint64_t val; |
| 11836 | return upb_WireReader_ReadVarint(ptr, &val); |
| 11837 | } |
| 11838 | |
| 11839 | // Reads a varint indicating the size of a delimited field into `size`, or |
| 11840 | // NULL if there was an error in the varint data. |
| 11841 | // |
| 11842 | // REQUIRES: there must be at least 10 bytes of data available at `ptr`. |
| 11843 | // Bounds checks must be performed before calling this function, preferably |
| 11844 | // by calling upb_EpsCopyInputStream_IsDone(). |
| 11845 | UPB_INLINE const char* upb_WireReader_ReadSize(const char* ptr, int* size) { |
| 11846 | uint64_t size64; |
| 11847 | ptr = upb_WireReader_ReadVarint(ptr, &size64); |
| 11848 | if (!ptr || size64 >= INT32_MAX) return NULL; |
| 11849 | *size = size64; |
| 11850 | return ptr; |
| 11851 | } |
| 11852 | |
| 11853 | // Reads a fixed32 field, performing byte swapping if necessary. |
| 11854 | // |
| 11855 | // REQUIRES: there must be at least 4 bytes of data available at `ptr`. |
| 11856 | // Bounds checks must be performed before calling this function, preferably |
| 11857 | // by calling upb_EpsCopyInputStream_IsDone(). |
| 11858 | UPB_INLINE const char* upb_WireReader_ReadFixed32(const char* ptr, void* val) { |
| 11859 | uint32_t uval; |
| 11860 | memcpy(&uval, ptr, 4); |
| 11861 | uval = _upb_BigEndian_Swap32(uval); |
| 11862 | memcpy(val, &uval, 4); |
| 11863 | return ptr + 4; |
| 11864 | } |
| 11865 | |
| 11866 | // Reads a fixed64 field, performing byte swapping if necessary. |
| 11867 | // |
| 11868 | // REQUIRES: there must be at least 4 bytes of data available at `ptr`. |
| 11869 | // Bounds checks must be performed before calling this function, preferably |
| 11870 | // by calling upb_EpsCopyInputStream_IsDone(). |
| 11871 | UPB_INLINE const char* upb_WireReader_ReadFixed64(const char* ptr, void* val) { |
| 11872 | uint64_t uval; |
| 11873 | memcpy(&uval, ptr, 8); |
| 11874 | uval = _upb_BigEndian_Swap64(uval); |
| 11875 | memcpy(val, &uval, 8); |
| 11876 | return ptr + 8; |
| 11877 | } |
| 11878 | |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 11879 | const char* _upb_WireReader_SkipGroup(const char* ptr, uint32_t tag, |
| 11880 | int depth_limit, |
| 11881 | upb_EpsCopyInputStream* stream); |
| 11882 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 11883 | // Skips data for a group, returning a pointer past the end of the group, or |
| 11884 | // NULL if there was an error parsing the group. The `tag` argument should be |
| 11885 | // the start group tag that begins the group. The `depth_limit` argument |
| 11886 | // indicates how many levels of recursion the group is allowed to have before |
| 11887 | // reporting a parse error (this limit exists to protect against stack |
| 11888 | // overflow). |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 11889 | // |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 11890 | // TODO: evaluate how the depth_limit should be specified. Do users need |
| 11891 | // control over this? |
| 11892 | UPB_INLINE const char* upb_WireReader_SkipGroup( |
| 11893 | const char* ptr, uint32_t tag, upb_EpsCopyInputStream* stream) { |
| 11894 | return _upb_WireReader_SkipGroup(ptr, tag, 100, stream); |
| 11895 | } |
| 11896 | |
| 11897 | UPB_INLINE const char* _upb_WireReader_SkipValue( |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 11898 | const char* ptr, uint32_t tag, int depth_limit, |
| 11899 | upb_EpsCopyInputStream* stream) { |
| 11900 | switch (upb_WireReader_GetWireType(tag)) { |
| 11901 | case kUpb_WireType_Varint: |
| 11902 | return upb_WireReader_SkipVarint(ptr); |
| 11903 | case kUpb_WireType_32Bit: |
| 11904 | return ptr + 4; |
| 11905 | case kUpb_WireType_64Bit: |
| 11906 | return ptr + 8; |
| 11907 | case kUpb_WireType_Delimited: { |
| 11908 | int size; |
| 11909 | ptr = upb_WireReader_ReadSize(ptr, &size); |
| 11910 | if (!ptr) return NULL; |
| 11911 | ptr += size; |
| 11912 | return ptr; |
| 11913 | } |
| 11914 | case kUpb_WireType_StartGroup: |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 11915 | return _upb_WireReader_SkipGroup(ptr, tag, depth_limit, stream); |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 11916 | case kUpb_WireType_EndGroup: |
| 11917 | return NULL; // Should be handled before now. |
| 11918 | default: |
| 11919 | return NULL; // Unknown wire type. |
| 11920 | } |
| 11921 | } |
| 11922 | |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 11923 | // Skips data for a wire value of any type, returning a pointer past the end of |
| 11924 | // the data, or NULL if there was an error parsing the group. The `tag` argument |
| 11925 | // should be the tag that was just parsed. The `depth_limit` argument indicates |
| 11926 | // how many levels of recursion a group is allowed to have before reporting a |
| 11927 | // parse error (this limit exists to protect against stack overflow). |
| 11928 | // |
| 11929 | // REQUIRES: there must be at least 10 bytes of data available at `ptr`. |
| 11930 | // Bounds checks must be performed before calling this function, preferably |
| 11931 | // by calling upb_EpsCopyInputStream_IsDone(). |
| 11932 | // |
| 11933 | // TODO: evaluate how the depth_limit should be specified. Do users need |
| 11934 | // control over this? |
| 11935 | UPB_INLINE const char* upb_WireReader_SkipValue( |
| 11936 | const char* ptr, uint32_t tag, upb_EpsCopyInputStream* stream) { |
| 11937 | return _upb_WireReader_SkipValue(ptr, tag, 100, stream); |
| 11938 | } |
| 11939 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 11940 | #ifdef __cplusplus |
| 11941 | } /* extern "C" */ |
| 11942 | #endif |
| 11943 | |
| 11944 | |
| 11945 | #endif // UPB_WIRE_READER_H_ |
| 11946 | |
Protobuf Team Bot | ce9dcc2 | 2023-11-03 22:38:26 +0000 | [diff] [blame] | 11947 | #ifndef UPB_MESSAGE_COPY_H_ |
| 11948 | #define UPB_MESSAGE_COPY_H_ |
| 11949 | |
| 11950 | |
| 11951 | // Must be last. |
| 11952 | |
| 11953 | #ifdef __cplusplus |
| 11954 | extern "C" { |
| 11955 | #endif |
| 11956 | |
| 11957 | // Deep clones a message using the provided target arena. |
| 11958 | upb_Message* upb_Message_DeepClone(const upb_Message* message, |
| 11959 | const upb_MiniTable* mini_table, |
| 11960 | upb_Arena* arena); |
| 11961 | |
| 11962 | // Deep clones array contents. |
| 11963 | upb_Array* upb_Array_DeepClone(const upb_Array* array, upb_CType value_type, |
| 11964 | const upb_MiniTable* sub, upb_Arena* arena); |
| 11965 | |
| 11966 | // Deep clones map contents. |
| 11967 | upb_Map* upb_Map_DeepClone(const upb_Map* map, upb_CType key_type, |
| 11968 | upb_CType value_type, |
| 11969 | const upb_MiniTable* map_entry_table, |
| 11970 | upb_Arena* arena); |
| 11971 | |
| 11972 | // Deep copies the message from src to dst. |
| 11973 | bool upb_Message_DeepCopy(upb_Message* dst, const upb_Message* src, |
| 11974 | const upb_MiniTable* mini_table, upb_Arena* arena); |
| 11975 | |
| 11976 | #ifdef __cplusplus |
| 11977 | } /* extern "C" */ |
| 11978 | #endif |
| 11979 | |
| 11980 | |
| 11981 | #endif // UPB_MESSAGE_COPY_H_ |
| 11982 | |
Protobuf Team Bot | 376ba2f | 2023-09-29 22:17:43 +0000 | [diff] [blame] | 11983 | // EVERYTHING BELOW THIS LINE IS INTERNAL - DO NOT USE ///////////////////////// |
| 11984 | |
| 11985 | #ifndef UPB_COLLECTIONS_INTERNAL_MAP_SORTER_H_ |
| 11986 | #define UPB_COLLECTIONS_INTERNAL_MAP_SORTER_H_ |
| 11987 | |
| 11988 | #include <stdlib.h> |
| 11989 | |
| 11990 | |
| 11991 | #ifndef UPB_COLLECTIONS_INTERNAL_MAP_ENTRY_H_ |
| 11992 | #define UPB_COLLECTIONS_INTERNAL_MAP_ENTRY_H_ |
| 11993 | |
| 11994 | |
| 11995 | // Map entries aren't actually stored for map fields, they are only used during |
| 11996 | // parsing. For parsing, it helps a lot if all map entry messages have the same |
| 11997 | // layout. The layout code in mini_table/decode.c will ensure that all map |
| 11998 | // entries have this layout. |
| 11999 | // |
| 12000 | // Note that users can and do create map entries directly, which will also use |
| 12001 | // this layout. |
| 12002 | // |
| 12003 | // NOTE: sync with wire/decode.c. |
| 12004 | typedef struct { |
| 12005 | // We only need 2 hasbits max, but due to alignment we'll use 8 bytes here, |
| 12006 | // and the uint64_t helps make this clear. |
| 12007 | uint64_t hasbits; |
| 12008 | union { |
| 12009 | upb_StringView str; // For str/bytes. |
| 12010 | upb_value val; // For all other types. |
| 12011 | } k; |
| 12012 | union { |
| 12013 | upb_StringView str; // For str/bytes. |
| 12014 | upb_value val; // For all other types. |
| 12015 | } v; |
| 12016 | } upb_MapEntryData; |
| 12017 | |
| 12018 | typedef struct { |
| 12019 | upb_Message_Internal internal; |
| 12020 | upb_MapEntryData data; |
| 12021 | } upb_MapEntry; |
| 12022 | |
| 12023 | #endif // UPB_COLLECTIONS_INTERNAL_MAP_ENTRY_H_ |
| 12024 | |
| 12025 | // Must be last. |
| 12026 | |
| 12027 | #ifdef __cplusplus |
| 12028 | extern "C" { |
| 12029 | #endif |
| 12030 | |
| 12031 | // _upb_mapsorter sorts maps and provides ordered iteration over the entries. |
| 12032 | // Since maps can be recursive (map values can be messages which contain other |
| 12033 | // maps), _upb_mapsorter can contain a stack of maps. |
| 12034 | |
| 12035 | typedef struct { |
| 12036 | void const** entries; |
| 12037 | int size; |
| 12038 | int cap; |
| 12039 | } _upb_mapsorter; |
| 12040 | |
| 12041 | typedef struct { |
| 12042 | int start; |
| 12043 | int pos; |
| 12044 | int end; |
| 12045 | } _upb_sortedmap; |
| 12046 | |
| 12047 | UPB_INLINE void _upb_mapsorter_init(_upb_mapsorter* s) { |
| 12048 | s->entries = NULL; |
| 12049 | s->size = 0; |
| 12050 | s->cap = 0; |
| 12051 | } |
| 12052 | |
| 12053 | UPB_INLINE void _upb_mapsorter_destroy(_upb_mapsorter* s) { |
| 12054 | if (s->entries) free(s->entries); |
| 12055 | } |
| 12056 | |
| 12057 | UPB_INLINE bool _upb_sortedmap_next(_upb_mapsorter* s, const upb_Map* map, |
| 12058 | _upb_sortedmap* sorted, upb_MapEntry* ent) { |
| 12059 | if (sorted->pos == sorted->end) return false; |
| 12060 | const upb_tabent* tabent = (const upb_tabent*)s->entries[sorted->pos++]; |
| 12061 | upb_StringView key = upb_tabstrview(tabent->key); |
| 12062 | _upb_map_fromkey(key, &ent->data.k, map->key_size); |
| 12063 | upb_value val = {tabent->val.val}; |
| 12064 | _upb_map_fromvalue(val, &ent->data.v, map->val_size); |
| 12065 | return true; |
| 12066 | } |
| 12067 | |
| 12068 | UPB_INLINE bool _upb_sortedmap_nextext(_upb_mapsorter* s, |
| 12069 | _upb_sortedmap* sorted, |
| 12070 | const upb_Message_Extension** ext) { |
| 12071 | if (sorted->pos == sorted->end) return false; |
| 12072 | *ext = (const upb_Message_Extension*)s->entries[sorted->pos++]; |
| 12073 | return true; |
| 12074 | } |
| 12075 | |
| 12076 | UPB_INLINE void _upb_mapsorter_popmap(_upb_mapsorter* s, |
| 12077 | _upb_sortedmap* sorted) { |
| 12078 | s->size = sorted->start; |
| 12079 | } |
| 12080 | |
| 12081 | bool _upb_mapsorter_pushmap(_upb_mapsorter* s, upb_FieldType key_type, |
| 12082 | const upb_Map* map, _upb_sortedmap* sorted); |
| 12083 | |
| 12084 | bool _upb_mapsorter_pushexts(_upb_mapsorter* s, |
| 12085 | const upb_Message_Extension* exts, size_t count, |
| 12086 | _upb_sortedmap* sorted); |
| 12087 | |
| 12088 | #ifdef __cplusplus |
| 12089 | } /* extern "C" */ |
| 12090 | #endif |
| 12091 | |
| 12092 | |
| 12093 | #endif /* UPB_COLLECTIONS_INTERNAL_MAP_SORTER_H_ */ |
| 12094 | |
Adam Cozzette | 8059da2 | 2023-08-16 07:57:14 -0700 | [diff] [blame] | 12095 | #ifndef UPB_MINI_DESCRIPTOR_INTERNAL_DECODER_H_ |
| 12096 | #define UPB_MINI_DESCRIPTOR_INTERNAL_DECODER_H_ |
| 12097 | |
| 12098 | |
| 12099 | #ifndef UPB_MINI_DESCRIPTOR_INTERNAL_BASE92_H_ |
| 12100 | #define UPB_MINI_DESCRIPTOR_INTERNAL_BASE92_H_ |
| 12101 | |
Adam Cozzette | 7d5592e | 2023-08-23 12:15:26 -0700 | [diff] [blame] | 12102 | #include <stdint.h> |
| 12103 | |
Adam Cozzette | 8059da2 | 2023-08-16 07:57:14 -0700 | [diff] [blame] | 12104 | |
| 12105 | // Must be last. |
| 12106 | |
| 12107 | #ifdef __cplusplus |
| 12108 | extern "C" { |
| 12109 | #endif |
| 12110 | |
| 12111 | UPB_INLINE char _upb_ToBase92(int8_t ch) { |
| 12112 | extern const char _kUpb_ToBase92[]; |
| 12113 | UPB_ASSERT(0 <= ch && ch < 92); |
| 12114 | return _kUpb_ToBase92[ch]; |
| 12115 | } |
| 12116 | |
| 12117 | UPB_INLINE char _upb_FromBase92(uint8_t ch) { |
| 12118 | extern const int8_t _kUpb_FromBase92[]; |
| 12119 | if (' ' > ch || ch > '~') return -1; |
| 12120 | return _kUpb_FromBase92[ch - ' ']; |
| 12121 | } |
| 12122 | |
| 12123 | UPB_INLINE const char* _upb_Base92_DecodeVarint(const char* ptr, |
| 12124 | const char* end, char first_ch, |
| 12125 | uint8_t min, uint8_t max, |
| 12126 | uint32_t* out_val) { |
| 12127 | uint32_t val = 0; |
| 12128 | uint32_t shift = 0; |
| 12129 | const int bits_per_char = |
| 12130 | upb_Log2Ceiling(_upb_FromBase92(max) - _upb_FromBase92(min)); |
| 12131 | char ch = first_ch; |
| 12132 | while (1) { |
| 12133 | uint32_t bits = _upb_FromBase92(ch) - _upb_FromBase92(min); |
| 12134 | val |= bits << shift; |
| 12135 | if (ptr == end || *ptr < min || max < *ptr) { |
| 12136 | *out_val = val; |
| 12137 | UPB_ASSUME(ptr != NULL); |
| 12138 | return ptr; |
| 12139 | } |
| 12140 | ch = *ptr++; |
| 12141 | shift += bits_per_char; |
| 12142 | if (shift >= 32) return NULL; |
| 12143 | } |
| 12144 | } |
| 12145 | |
| 12146 | #ifdef __cplusplus |
| 12147 | } /* extern "C" */ |
| 12148 | #endif |
| 12149 | |
| 12150 | |
| 12151 | #endif // UPB_MINI_DESCRIPTOR_INTERNAL_BASE92_H_ |
| 12152 | |
| 12153 | // Must be last. |
| 12154 | |
| 12155 | // upb_MdDecoder: used internally for decoding MiniDescriptors for messages, |
| 12156 | // extensions, and enums. |
| 12157 | typedef struct { |
| 12158 | const char* end; |
| 12159 | upb_Status* status; |
| 12160 | jmp_buf err; |
| 12161 | } upb_MdDecoder; |
| 12162 | |
| 12163 | UPB_PRINTF(2, 3) |
| 12164 | UPB_NORETURN UPB_INLINE void upb_MdDecoder_ErrorJmp(upb_MdDecoder* d, |
| 12165 | const char* fmt, ...) { |
| 12166 | if (d->status) { |
| 12167 | va_list argp; |
| 12168 | upb_Status_SetErrorMessage(d->status, "Error building mini table: "); |
| 12169 | va_start(argp, fmt); |
| 12170 | upb_Status_VAppendErrorFormat(d->status, fmt, argp); |
| 12171 | va_end(argp); |
| 12172 | } |
| 12173 | UPB_LONGJMP(d->err, 1); |
| 12174 | } |
| 12175 | |
| 12176 | UPB_INLINE void upb_MdDecoder_CheckOutOfMemory(upb_MdDecoder* d, |
| 12177 | const void* ptr) { |
| 12178 | if (!ptr) upb_MdDecoder_ErrorJmp(d, "Out of memory"); |
| 12179 | } |
| 12180 | |
| 12181 | UPB_INLINE const char* upb_MdDecoder_DecodeBase92Varint( |
| 12182 | upb_MdDecoder* d, const char* ptr, char first_ch, uint8_t min, uint8_t max, |
| 12183 | uint32_t* out_val) { |
| 12184 | ptr = _upb_Base92_DecodeVarint(ptr, d->end, first_ch, min, max, out_val); |
| 12185 | if (!ptr) upb_MdDecoder_ErrorJmp(d, "Overlong varint"); |
| 12186 | return ptr; |
| 12187 | } |
| 12188 | |
| 12189 | |
| 12190 | #endif // UPB_MINI_DESCRIPTOR_INTERNAL_DECODER_H_ |
| 12191 | |
| 12192 | #ifndef UPB_MINI_DESCRIPTOR_INTERNAL_WIRE_CONSTANTS_H_ |
| 12193 | #define UPB_MINI_DESCRIPTOR_INTERNAL_WIRE_CONSTANTS_H_ |
| 12194 | |
| 12195 | |
| 12196 | // Must be last. |
| 12197 | |
| 12198 | typedef enum { |
| 12199 | kUpb_EncodedType_Double = 0, |
| 12200 | kUpb_EncodedType_Float = 1, |
| 12201 | kUpb_EncodedType_Fixed32 = 2, |
| 12202 | kUpb_EncodedType_Fixed64 = 3, |
| 12203 | kUpb_EncodedType_SFixed32 = 4, |
| 12204 | kUpb_EncodedType_SFixed64 = 5, |
| 12205 | kUpb_EncodedType_Int32 = 6, |
| 12206 | kUpb_EncodedType_UInt32 = 7, |
| 12207 | kUpb_EncodedType_SInt32 = 8, |
| 12208 | kUpb_EncodedType_Int64 = 9, |
| 12209 | kUpb_EncodedType_UInt64 = 10, |
| 12210 | kUpb_EncodedType_SInt64 = 11, |
| 12211 | kUpb_EncodedType_OpenEnum = 12, |
| 12212 | kUpb_EncodedType_Bool = 13, |
| 12213 | kUpb_EncodedType_Bytes = 14, |
| 12214 | kUpb_EncodedType_String = 15, |
| 12215 | kUpb_EncodedType_Group = 16, |
| 12216 | kUpb_EncodedType_Message = 17, |
| 12217 | kUpb_EncodedType_ClosedEnum = 18, |
| 12218 | |
| 12219 | kUpb_EncodedType_RepeatedBase = 20, |
| 12220 | } upb_EncodedType; |
| 12221 | |
| 12222 | typedef enum { |
| 12223 | kUpb_EncodedFieldModifier_FlipPacked = 1 << 0, |
| 12224 | kUpb_EncodedFieldModifier_IsRequired = 1 << 1, |
| 12225 | kUpb_EncodedFieldModifier_IsProto3Singular = 1 << 2, |
Protobuf Team Bot | b58bd40 | 2023-09-19 15:42:34 +0000 | [diff] [blame] | 12226 | kUpb_EncodedFieldModifier_FlipValidateUtf8 = 1 << 3, |
Adam Cozzette | 8059da2 | 2023-08-16 07:57:14 -0700 | [diff] [blame] | 12227 | } upb_EncodedFieldModifier; |
| 12228 | |
| 12229 | enum { |
| 12230 | kUpb_EncodedValue_MinField = ' ', |
| 12231 | kUpb_EncodedValue_MaxField = 'I', |
| 12232 | kUpb_EncodedValue_MinModifier = 'L', |
| 12233 | kUpb_EncodedValue_MaxModifier = '[', |
| 12234 | kUpb_EncodedValue_End = '^', |
| 12235 | kUpb_EncodedValue_MinSkip = '_', |
| 12236 | kUpb_EncodedValue_MaxSkip = '~', |
| 12237 | kUpb_EncodedValue_OneofSeparator = '~', |
| 12238 | kUpb_EncodedValue_FieldSeparator = '|', |
| 12239 | kUpb_EncodedValue_MinOneofField = ' ', |
| 12240 | kUpb_EncodedValue_MaxOneofField = 'b', |
| 12241 | kUpb_EncodedValue_MaxEnumMask = 'A', |
| 12242 | }; |
| 12243 | |
| 12244 | enum { |
| 12245 | kUpb_EncodedVersion_EnumV1 = '!', |
| 12246 | kUpb_EncodedVersion_ExtensionV1 = '#', |
| 12247 | kUpb_EncodedVersion_MapV1 = '%', |
| 12248 | kUpb_EncodedVersion_MessageV1 = '$', |
| 12249 | kUpb_EncodedVersion_MessageSetV1 = '&', |
| 12250 | }; |
| 12251 | |
| 12252 | |
| 12253 | #endif // UPB_MINI_DESCRIPTOR_INTERNAL_WIRE_CONSTANTS_H_ |
| 12254 | |
| 12255 | #ifndef UPB_MINI_DESCRIPTOR_INTERNAL_MODIFIERS_H_ |
| 12256 | #define UPB_MINI_DESCRIPTOR_INTERNAL_MODIFIERS_H_ |
| 12257 | |
| 12258 | // Must be last. |
| 12259 | |
| 12260 | typedef enum { |
| 12261 | kUpb_FieldModifier_IsRepeated = 1 << 0, |
| 12262 | kUpb_FieldModifier_IsPacked = 1 << 1, |
| 12263 | kUpb_FieldModifier_IsClosedEnum = 1 << 2, |
| 12264 | kUpb_FieldModifier_IsProto3Singular = 1 << 3, |
| 12265 | kUpb_FieldModifier_IsRequired = 1 << 4, |
Protobuf Team Bot | b58bd40 | 2023-09-19 15:42:34 +0000 | [diff] [blame] | 12266 | kUpb_FieldModifier_ValidateUtf8 = 1 << 5, |
Adam Cozzette | 8059da2 | 2023-08-16 07:57:14 -0700 | [diff] [blame] | 12267 | } kUpb_FieldModifier; |
| 12268 | |
Protobuf Team Bot | b58bd40 | 2023-09-19 15:42:34 +0000 | [diff] [blame] | 12269 | // These modifiers are also used on the wire. |
Adam Cozzette | 8059da2 | 2023-08-16 07:57:14 -0700 | [diff] [blame] | 12270 | typedef enum { |
| 12271 | kUpb_MessageModifier_ValidateUtf8 = 1 << 0, |
| 12272 | kUpb_MessageModifier_DefaultIsPacked = 1 << 1, |
| 12273 | kUpb_MessageModifier_IsExtendable = 1 << 2, |
| 12274 | } kUpb_MessageModifier; |
| 12275 | |
| 12276 | |
| 12277 | #endif // UPB_MINI_DESCRIPTOR_INTERNAL_MODIFIERS_H_ |
| 12278 | |
| 12279 | #ifndef UPB_MINI_DESCRIPTOR_INTERNAL_ENCODE_H_ |
| 12280 | #define UPB_MINI_DESCRIPTOR_INTERNAL_ENCODE_H_ |
| 12281 | |
Adam Cozzette | 7d5592e | 2023-08-23 12:15:26 -0700 | [diff] [blame] | 12282 | #include <stdint.h> |
| 12283 | |
Adam Cozzette | 8059da2 | 2023-08-16 07:57:14 -0700 | [diff] [blame] | 12284 | |
| 12285 | // Must be last. |
| 12286 | |
| 12287 | // If the input buffer has at least this many bytes available, the encoder call |
| 12288 | // is guaranteed to succeed (as long as field number order is maintained). |
| 12289 | #define kUpb_MtDataEncoder_MinSize 16 |
| 12290 | |
| 12291 | typedef struct { |
| 12292 | char* end; // Limit of the buffer passed as a parameter. |
| 12293 | // Aliased to internal-only members in .cc. |
| 12294 | char internal[32]; |
| 12295 | } upb_MtDataEncoder; |
| 12296 | |
| 12297 | #ifdef __cplusplus |
| 12298 | extern "C" { |
| 12299 | #endif |
| 12300 | |
| 12301 | // Encodes field/oneof information for a given message. The sequence of calls |
| 12302 | // should look like: |
| 12303 | // |
| 12304 | // upb_MtDataEncoder e; |
| 12305 | // char buf[256]; |
| 12306 | // char* ptr = buf; |
| 12307 | // e.end = ptr + sizeof(buf); |
| 12308 | // unit64_t msg_mod = ...; // bitwise & of kUpb_MessageModifiers or zero |
| 12309 | // ptr = upb_MtDataEncoder_StartMessage(&e, ptr, msg_mod); |
| 12310 | // // Fields *must* be in field number order. |
| 12311 | // ptr = upb_MtDataEncoder_PutField(&e, ptr, ...); |
| 12312 | // ptr = upb_MtDataEncoder_PutField(&e, ptr, ...); |
| 12313 | // ptr = upb_MtDataEncoder_PutField(&e, ptr, ...); |
| 12314 | // |
| 12315 | // // If oneofs are present. Oneofs must be encoded after regular fields. |
| 12316 | // ptr = upb_MiniTable_StartOneof(&e, ptr) |
| 12317 | // ptr = upb_MiniTable_PutOneofField(&e, ptr, ...); |
| 12318 | // ptr = upb_MiniTable_PutOneofField(&e, ptr, ...); |
| 12319 | // |
| 12320 | // ptr = upb_MiniTable_StartOneof(&e, ptr); |
| 12321 | // ptr = upb_MiniTable_PutOneofField(&e, ptr, ...); |
| 12322 | // ptr = upb_MiniTable_PutOneofField(&e, ptr, ...); |
| 12323 | // |
| 12324 | // Oneofs must be encoded after all regular fields. |
| 12325 | char* upb_MtDataEncoder_StartMessage(upb_MtDataEncoder* e, char* ptr, |
| 12326 | uint64_t msg_mod); |
| 12327 | char* upb_MtDataEncoder_PutField(upb_MtDataEncoder* e, char* ptr, |
| 12328 | upb_FieldType type, uint32_t field_num, |
| 12329 | uint64_t field_mod); |
| 12330 | char* upb_MtDataEncoder_StartOneof(upb_MtDataEncoder* e, char* ptr); |
| 12331 | char* upb_MtDataEncoder_PutOneofField(upb_MtDataEncoder* e, char* ptr, |
| 12332 | uint32_t field_num); |
| 12333 | |
| 12334 | // Encodes the set of values for a given enum. The values must be given in |
| 12335 | // order (after casting to uint32_t), and repeats are not allowed. |
| 12336 | char* upb_MtDataEncoder_StartEnum(upb_MtDataEncoder* e, char* ptr); |
| 12337 | char* upb_MtDataEncoder_PutEnumValue(upb_MtDataEncoder* e, char* ptr, |
| 12338 | uint32_t val); |
| 12339 | char* upb_MtDataEncoder_EndEnum(upb_MtDataEncoder* e, char* ptr); |
| 12340 | |
| 12341 | // Encodes an entire mini descriptor for an extension. |
| 12342 | char* upb_MtDataEncoder_EncodeExtension(upb_MtDataEncoder* e, char* ptr, |
| 12343 | upb_FieldType type, uint32_t field_num, |
| 12344 | uint64_t field_mod); |
| 12345 | |
| 12346 | // Encodes an entire mini descriptor for a map. |
| 12347 | char* upb_MtDataEncoder_EncodeMap(upb_MtDataEncoder* e, char* ptr, |
| 12348 | upb_FieldType key_type, |
| 12349 | upb_FieldType value_type, uint64_t key_mod, |
| 12350 | uint64_t value_mod); |
| 12351 | |
| 12352 | // Encodes an entire mini descriptor for a message set. |
| 12353 | char* upb_MtDataEncoder_EncodeMessageSet(upb_MtDataEncoder* e, char* ptr); |
| 12354 | |
| 12355 | #ifdef __cplusplus |
| 12356 | } /* extern "C" */ |
| 12357 | #endif |
| 12358 | |
| 12359 | |
| 12360 | #endif /* UPB_MINI_DESCRIPTOR_INTERNAL_ENCODE_H_ */ |
| 12361 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12362 | #ifndef UPB_REFLECTION_DEF_POOL_INTERNAL_H_ |
| 12363 | #define UPB_REFLECTION_DEF_POOL_INTERNAL_H_ |
| 12364 | |
| 12365 | |
| 12366 | // Must be last. |
| 12367 | |
| 12368 | #ifdef __cplusplus |
| 12369 | extern "C" { |
| 12370 | #endif |
| 12371 | |
| 12372 | upb_Arena* _upb_DefPool_Arena(const upb_DefPool* s); |
| 12373 | size_t _upb_DefPool_BytesLoaded(const upb_DefPool* s); |
| 12374 | upb_ExtensionRegistry* _upb_DefPool_ExtReg(const upb_DefPool* s); |
| 12375 | |
| 12376 | bool _upb_DefPool_InsertExt(upb_DefPool* s, const upb_MiniTableExtension* ext, |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 12377 | const upb_FieldDef* f); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12378 | bool _upb_DefPool_InsertSym(upb_DefPool* s, upb_StringView sym, upb_value v, |
| 12379 | upb_Status* status); |
| 12380 | bool _upb_DefPool_LookupSym(const upb_DefPool* s, const char* sym, size_t size, |
| 12381 | upb_value* v); |
| 12382 | |
| 12383 | void** _upb_DefPool_ScratchData(const upb_DefPool* s); |
| 12384 | size_t* _upb_DefPool_ScratchSize(const upb_DefPool* s); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 12385 | void _upb_DefPool_SetPlatform(upb_DefPool* s, upb_MiniTablePlatform platform); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12386 | |
| 12387 | // For generated code only: loads a generated descriptor. |
| 12388 | typedef struct _upb_DefPool_Init { |
| 12389 | struct _upb_DefPool_Init** deps; // Dependencies of this file. |
| 12390 | const upb_MiniTableFile* layout; |
| 12391 | const char* filename; |
| 12392 | upb_StringView descriptor; // Serialized descriptor. |
| 12393 | } _upb_DefPool_Init; |
| 12394 | |
| 12395 | bool _upb_DefPool_LoadDefInit(upb_DefPool* s, const _upb_DefPool_Init* init); |
| 12396 | |
| 12397 | // Should only be directly called by tests. This variant lets us suppress |
| 12398 | // the use of compiled-in tables, forcing a rebuild of the tables at runtime. |
| 12399 | bool _upb_DefPool_LoadDefInitEx(upb_DefPool* s, const _upb_DefPool_Init* init, |
| 12400 | bool rebuild_minitable); |
| 12401 | |
| 12402 | #ifdef __cplusplus |
| 12403 | } /* extern "C" */ |
| 12404 | #endif |
| 12405 | |
| 12406 | |
| 12407 | #endif /* UPB_REFLECTION_DEF_POOL_INTERNAL_H_ */ |
| 12408 | |
Protobuf Team Bot | 7be2a45 | 2023-09-13 16:50:05 +0000 | [diff] [blame] | 12409 | #ifndef UPB_REFLECTION_DEF_BUILDER_INTERNAL_H_ |
| 12410 | #define UPB_REFLECTION_DEF_BUILDER_INTERNAL_H_ |
| 12411 | |
| 12412 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12413 | // Must be last. |
| 12414 | |
| 12415 | // We want to copy the options verbatim into the destination options proto. |
| 12416 | // We use serialize+parse as our deep copy. |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 12417 | #define UPB_DEF_SET_OPTIONS(target, desc_type, options_type, proto) \ |
| 12418 | if (UPB_DESC(desc_type##_has_options)(proto)) { \ |
| 12419 | size_t size; \ |
| 12420 | char* pb = UPB_DESC(options_type##_serialize)( \ |
| 12421 | UPB_DESC(desc_type##_options)(proto), ctx->tmp_arena, &size); \ |
| 12422 | if (!pb) _upb_DefBuilder_OomErr(ctx); \ |
| 12423 | target = \ |
| 12424 | UPB_DESC(options_type##_parse)(pb, size, _upb_DefBuilder_Arena(ctx)); \ |
| 12425 | if (!target) _upb_DefBuilder_OomErr(ctx); \ |
| 12426 | } else { \ |
| 12427 | target = (const UPB_DESC(options_type)*)kUpbDefOptDefault; \ |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12428 | } |
| 12429 | |
| 12430 | #ifdef __cplusplus |
| 12431 | extern "C" { |
| 12432 | #endif |
| 12433 | |
| 12434 | struct upb_DefBuilder { |
| 12435 | upb_DefPool* symtab; |
Protobuf Team Bot | ce9dcc2 | 2023-11-03 22:38:26 +0000 | [diff] [blame] | 12436 | upb_strtable feature_cache; // Caches features by identity. |
| 12437 | UPB_DESC(FeatureSet*) legacy_features; // For computing legacy features. |
| 12438 | char* tmp_buf; // Temporary buffer in tmp_arena. |
| 12439 | size_t tmp_buf_size; // Size of temporary buffer. |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12440 | upb_FileDef* file; // File we are building. |
| 12441 | upb_Arena* arena; // Allocate defs here. |
| 12442 | upb_Arena* tmp_arena; // For temporary allocations. |
| 12443 | upb_Status* status; // Record errors here. |
| 12444 | const upb_MiniTableFile* layout; // NULL if we should build layouts. |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 12445 | upb_MiniTablePlatform platform; // Platform we are targeting. |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12446 | int enum_count; // Count of enums built so far. |
| 12447 | int msg_count; // Count of messages built so far. |
| 12448 | int ext_count; // Count of extensions built so far. |
| 12449 | jmp_buf err; // longjmp() on error. |
| 12450 | }; |
| 12451 | |
| 12452 | extern const char* kUpbDefOptDefault; |
| 12453 | |
| 12454 | // ctx->status has already been set elsewhere so just fail/longjmp() |
| 12455 | UPB_NORETURN void _upb_DefBuilder_FailJmp(upb_DefBuilder* ctx); |
| 12456 | |
| 12457 | UPB_NORETURN void _upb_DefBuilder_Errf(upb_DefBuilder* ctx, const char* fmt, |
| 12458 | ...) UPB_PRINTF(2, 3); |
| 12459 | UPB_NORETURN void _upb_DefBuilder_OomErr(upb_DefBuilder* ctx); |
| 12460 | |
| 12461 | const char* _upb_DefBuilder_MakeFullName(upb_DefBuilder* ctx, |
| 12462 | const char* prefix, |
| 12463 | upb_StringView name); |
| 12464 | |
| 12465 | // Given a symbol and the base symbol inside which it is defined, |
| 12466 | // find the symbol's definition. |
| 12467 | const void* _upb_DefBuilder_ResolveAny(upb_DefBuilder* ctx, |
| 12468 | const char* from_name_dbg, |
| 12469 | const char* base, upb_StringView sym, |
| 12470 | upb_deftype_t* type); |
| 12471 | |
| 12472 | const void* _upb_DefBuilder_Resolve(upb_DefBuilder* ctx, |
| 12473 | const char* from_name_dbg, const char* base, |
| 12474 | upb_StringView sym, upb_deftype_t type); |
| 12475 | |
| 12476 | char _upb_DefBuilder_ParseEscape(upb_DefBuilder* ctx, const upb_FieldDef* f, |
| 12477 | const char** src, const char* end); |
| 12478 | |
| 12479 | const char* _upb_DefBuilder_FullToShort(const char* fullname); |
| 12480 | |
| 12481 | UPB_INLINE void* _upb_DefBuilder_Alloc(upb_DefBuilder* ctx, size_t bytes) { |
| 12482 | if (bytes == 0) return NULL; |
| 12483 | void* ret = upb_Arena_Malloc(ctx->arena, bytes); |
| 12484 | if (!ret) _upb_DefBuilder_OomErr(ctx); |
| 12485 | return ret; |
| 12486 | } |
| 12487 | |
| 12488 | // Adds a symbol |v| to the symtab, which must be a def pointer previously |
| 12489 | // packed with pack_def(). The def's pointer to upb_FileDef* must be set before |
| 12490 | // adding, so we know which entries to remove if building this file fails. |
| 12491 | UPB_INLINE void _upb_DefBuilder_Add(upb_DefBuilder* ctx, const char* name, |
| 12492 | upb_value v) { |
| 12493 | upb_StringView sym = {.data = name, .size = strlen(name)}; |
| 12494 | bool ok = _upb_DefPool_InsertSym(ctx->symtab, sym, v, ctx->status); |
| 12495 | if (!ok) _upb_DefBuilder_FailJmp(ctx); |
| 12496 | } |
| 12497 | |
| 12498 | UPB_INLINE upb_Arena* _upb_DefBuilder_Arena(const upb_DefBuilder* ctx) { |
| 12499 | return ctx->arena; |
| 12500 | } |
| 12501 | |
| 12502 | UPB_INLINE upb_FileDef* _upb_DefBuilder_File(const upb_DefBuilder* ctx) { |
| 12503 | return ctx->file; |
| 12504 | } |
| 12505 | |
| 12506 | // This version of CheckIdent() is only called by other, faster versions after |
| 12507 | // they detect a parsing error. |
| 12508 | void _upb_DefBuilder_CheckIdentSlow(upb_DefBuilder* ctx, upb_StringView name, |
| 12509 | bool full); |
| 12510 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12511 | // Verify a full identifier string. This is slightly more complicated than |
| 12512 | // verifying a relative identifier string because we must track '.' chars. |
| 12513 | UPB_INLINE void _upb_DefBuilder_CheckIdentFull(upb_DefBuilder* ctx, |
| 12514 | upb_StringView name) { |
| 12515 | bool good = name.size > 0; |
| 12516 | bool start = true; |
| 12517 | |
| 12518 | for (size_t i = 0; i < name.size; i++) { |
| 12519 | const char c = name.data[i]; |
| 12520 | const char d = c | 0x20; // force lowercase |
| 12521 | const bool is_alpha = (('a' <= d) & (d <= 'z')) | (c == '_'); |
| 12522 | const bool is_numer = ('0' <= c) & (c <= '9') & !start; |
| 12523 | const bool is_dot = (c == '.') & !start; |
| 12524 | |
| 12525 | good &= is_alpha | is_numer | is_dot; |
| 12526 | start = is_dot; |
| 12527 | } |
| 12528 | |
| 12529 | if (!good) _upb_DefBuilder_CheckIdentSlow(ctx, name, true); |
| 12530 | } |
| 12531 | |
Protobuf Team Bot | ce9dcc2 | 2023-11-03 22:38:26 +0000 | [diff] [blame] | 12532 | // Returns true if the returned feature set is new and must be populated. |
| 12533 | bool _upb_DefBuilder_GetOrCreateFeatureSet(upb_DefBuilder* ctx, |
| 12534 | const UPB_DESC(FeatureSet*) parent, |
| 12535 | upb_StringView key, |
| 12536 | UPB_DESC(FeatureSet**) set); |
| 12537 | |
| 12538 | const UPB_DESC(FeatureSet*) |
| 12539 | _upb_DefBuilder_DoResolveFeatures(upb_DefBuilder* ctx, |
| 12540 | const UPB_DESC(FeatureSet*) parent, |
| 12541 | const UPB_DESC(FeatureSet*) child, |
| 12542 | bool is_implicit); |
| 12543 | |
| 12544 | UPB_INLINE const UPB_DESC(FeatureSet*) |
| 12545 | _upb_DefBuilder_ResolveFeatures(upb_DefBuilder* ctx, |
| 12546 | const UPB_DESC(FeatureSet*) parent, |
| 12547 | const UPB_DESC(FeatureSet*) child) { |
| 12548 | return _upb_DefBuilder_DoResolveFeatures(ctx, parent, child, false); |
| 12549 | } |
| 12550 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12551 | #ifdef __cplusplus |
| 12552 | } /* extern "C" */ |
| 12553 | #endif |
| 12554 | |
| 12555 | |
| 12556 | #endif /* UPB_REFLECTION_DEF_BUILDER_INTERNAL_H_ */ |
| 12557 | |
| 12558 | #ifndef UPB_REFLECTION_ENUM_DEF_INTERNAL_H_ |
| 12559 | #define UPB_REFLECTION_ENUM_DEF_INTERNAL_H_ |
| 12560 | |
| 12561 | |
| 12562 | // Must be last. |
| 12563 | |
| 12564 | #ifdef __cplusplus |
| 12565 | extern "C" { |
| 12566 | #endif |
| 12567 | |
| 12568 | upb_EnumDef* _upb_EnumDef_At(const upb_EnumDef* e, int i); |
| 12569 | bool _upb_EnumDef_Insert(upb_EnumDef* e, upb_EnumValueDef* v, upb_Arena* a); |
| 12570 | const upb_MiniTableEnum* _upb_EnumDef_MiniTable(const upb_EnumDef* e); |
| 12571 | |
| 12572 | // Allocate and initialize an array of |n| enum defs. |
Protobuf Team Bot | ce9dcc2 | 2023-11-03 22:38:26 +0000 | [diff] [blame] | 12573 | upb_EnumDef* _upb_EnumDefs_New(upb_DefBuilder* ctx, int n, |
| 12574 | const UPB_DESC(EnumDescriptorProto*) |
| 12575 | const* protos, |
| 12576 | const UPB_DESC(FeatureSet*) parent_features, |
| 12577 | const upb_MessageDef* containing_type); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12578 | |
| 12579 | #ifdef __cplusplus |
| 12580 | } /* extern "C" */ |
| 12581 | #endif |
| 12582 | |
| 12583 | |
| 12584 | #endif /* UPB_REFLECTION_ENUM_DEF_INTERNAL_H_ */ |
| 12585 | |
| 12586 | #ifndef UPB_REFLECTION_ENUM_VALUE_DEF_INTERNAL_H_ |
| 12587 | #define UPB_REFLECTION_ENUM_VALUE_DEF_INTERNAL_H_ |
| 12588 | |
| 12589 | |
| 12590 | // Must be last. |
| 12591 | |
| 12592 | #ifdef __cplusplus |
| 12593 | extern "C" { |
| 12594 | #endif |
| 12595 | |
| 12596 | upb_EnumValueDef* _upb_EnumValueDef_At(const upb_EnumValueDef* v, int i); |
| 12597 | |
| 12598 | // Allocate and initialize an array of |n| enum value defs owned by |e|. |
| 12599 | upb_EnumValueDef* _upb_EnumValueDefs_New( |
| 12600 | upb_DefBuilder* ctx, const char* prefix, int n, |
Protobuf Team Bot | ce9dcc2 | 2023-11-03 22:38:26 +0000 | [diff] [blame] | 12601 | const UPB_DESC(EnumValueDescriptorProto*) const* protos, |
| 12602 | const UPB_DESC(FeatureSet*) parent_features, upb_EnumDef* e, |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12603 | bool* is_sorted); |
| 12604 | |
| 12605 | const upb_EnumValueDef** _upb_EnumValueDefs_Sorted(const upb_EnumValueDef* v, |
| 12606 | int n, upb_Arena* a); |
| 12607 | |
| 12608 | #ifdef __cplusplus |
| 12609 | } /* extern "C" */ |
| 12610 | #endif |
| 12611 | |
| 12612 | |
| 12613 | #endif /* UPB_REFLECTION_ENUM_VALUE_DEF_INTERNAL_H_ */ |
| 12614 | |
| 12615 | #ifndef UPB_REFLECTION_FIELD_DEF_INTERNAL_H_ |
| 12616 | #define UPB_REFLECTION_FIELD_DEF_INTERNAL_H_ |
| 12617 | |
| 12618 | |
| 12619 | // Must be last. |
| 12620 | |
| 12621 | #ifdef __cplusplus |
| 12622 | extern "C" { |
| 12623 | #endif |
| 12624 | |
| 12625 | upb_FieldDef* _upb_FieldDef_At(const upb_FieldDef* f, int i); |
| 12626 | |
| 12627 | const upb_MiniTableExtension* _upb_FieldDef_ExtensionMiniTable( |
| 12628 | const upb_FieldDef* f); |
| 12629 | bool _upb_FieldDef_IsClosedEnum(const upb_FieldDef* f); |
| 12630 | bool _upb_FieldDef_IsProto3Optional(const upb_FieldDef* f); |
| 12631 | int _upb_FieldDef_LayoutIndex(const upb_FieldDef* f); |
| 12632 | uint64_t _upb_FieldDef_Modifiers(const upb_FieldDef* f); |
| 12633 | void _upb_FieldDef_Resolve(upb_DefBuilder* ctx, const char* prefix, |
| 12634 | upb_FieldDef* f); |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 12635 | void _upb_FieldDef_BuildMiniTableExtension(upb_DefBuilder* ctx, |
| 12636 | const upb_FieldDef* f); |
| 12637 | |
| 12638 | // Allocate and initialize an array of |n| extensions (field defs). |
Protobuf Team Bot | ce9dcc2 | 2023-11-03 22:38:26 +0000 | [diff] [blame] | 12639 | upb_FieldDef* _upb_Extensions_New(upb_DefBuilder* ctx, int n, |
| 12640 | const UPB_DESC(FieldDescriptorProto*) |
| 12641 | const* protos, |
| 12642 | const UPB_DESC(FeatureSet*) parent_features, |
| 12643 | const char* prefix, upb_MessageDef* m); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12644 | |
| 12645 | // Allocate and initialize an array of |n| field defs. |
Protobuf Team Bot | ce9dcc2 | 2023-11-03 22:38:26 +0000 | [diff] [blame] | 12646 | upb_FieldDef* _upb_FieldDefs_New(upb_DefBuilder* ctx, int n, |
| 12647 | const UPB_DESC(FieldDescriptorProto*) |
| 12648 | const* protos, |
| 12649 | const UPB_DESC(FeatureSet*) parent_features, |
| 12650 | const char* prefix, upb_MessageDef* m, |
| 12651 | bool* is_sorted); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12652 | |
| 12653 | // Allocate and return a list of pointers to the |n| field defs in |ff|, |
| 12654 | // sorted by field number. |
| 12655 | const upb_FieldDef** _upb_FieldDefs_Sorted(const upb_FieldDef* f, int n, |
| 12656 | upb_Arena* a); |
| 12657 | |
| 12658 | #ifdef __cplusplus |
| 12659 | } /* extern "C" */ |
| 12660 | #endif |
| 12661 | |
| 12662 | |
| 12663 | #endif /* UPB_REFLECTION_FIELD_DEF_INTERNAL_H_ */ |
| 12664 | |
| 12665 | #ifndef UPB_REFLECTION_FILE_DEF_INTERNAL_H_ |
| 12666 | #define UPB_REFLECTION_FILE_DEF_INTERNAL_H_ |
| 12667 | |
| 12668 | |
| 12669 | // Must be last. |
| 12670 | |
| 12671 | #ifdef __cplusplus |
| 12672 | extern "C" { |
| 12673 | #endif |
| 12674 | |
| 12675 | const upb_MiniTableExtension* _upb_FileDef_ExtensionMiniTable( |
| 12676 | const upb_FileDef* f, int i); |
| 12677 | const int32_t* _upb_FileDef_PublicDependencyIndexes(const upb_FileDef* f); |
| 12678 | const int32_t* _upb_FileDef_WeakDependencyIndexes(const upb_FileDef* f); |
| 12679 | |
| 12680 | // upb_FileDef_Package() returns "" if f->package is NULL, this does not. |
| 12681 | const char* _upb_FileDef_RawPackage(const upb_FileDef* f); |
| 12682 | |
| 12683 | void _upb_FileDef_Create(upb_DefBuilder* ctx, |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 12684 | const UPB_DESC(FileDescriptorProto) * file_proto); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12685 | |
| 12686 | #ifdef __cplusplus |
| 12687 | } /* extern "C" */ |
| 12688 | #endif |
| 12689 | |
| 12690 | |
| 12691 | #endif /* UPB_REFLECTION_FILE_DEF_INTERNAL_H_ */ |
| 12692 | |
| 12693 | #ifndef UPB_REFLECTION_MESSAGE_DEF_INTERNAL_H_ |
| 12694 | #define UPB_REFLECTION_MESSAGE_DEF_INTERNAL_H_ |
| 12695 | |
| 12696 | |
| 12697 | // Must be last. |
| 12698 | |
| 12699 | #ifdef __cplusplus |
| 12700 | extern "C" { |
| 12701 | #endif |
| 12702 | |
| 12703 | upb_MessageDef* _upb_MessageDef_At(const upb_MessageDef* m, int i); |
| 12704 | bool _upb_MessageDef_InMessageSet(const upb_MessageDef* m); |
| 12705 | bool _upb_MessageDef_Insert(upb_MessageDef* m, const char* name, size_t size, |
| 12706 | upb_value v, upb_Arena* a); |
| 12707 | void _upb_MessageDef_InsertField(upb_DefBuilder* ctx, upb_MessageDef* m, |
| 12708 | const upb_FieldDef* f); |
| 12709 | bool _upb_MessageDef_IsValidExtensionNumber(const upb_MessageDef* m, int n); |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 12710 | void _upb_MessageDef_CreateMiniTable(upb_DefBuilder* ctx, upb_MessageDef* m); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12711 | void _upb_MessageDef_LinkMiniTable(upb_DefBuilder* ctx, |
| 12712 | const upb_MessageDef* m); |
| 12713 | void _upb_MessageDef_Resolve(upb_DefBuilder* ctx, upb_MessageDef* m); |
| 12714 | |
| 12715 | // Allocate and initialize an array of |n| message defs. |
Protobuf Team Bot | ce9dcc2 | 2023-11-03 22:38:26 +0000 | [diff] [blame] | 12716 | upb_MessageDef* _upb_MessageDefs_New(upb_DefBuilder* ctx, int n, |
| 12717 | const UPB_DESC(DescriptorProto*) |
| 12718 | const* protos, |
| 12719 | const UPB_DESC(FeatureSet*) |
| 12720 | parent_features, |
| 12721 | const upb_MessageDef* containing_type); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12722 | |
| 12723 | #ifdef __cplusplus |
| 12724 | } /* extern "C" */ |
| 12725 | #endif |
| 12726 | |
| 12727 | |
| 12728 | #endif /* UPB_REFLECTION_MESSAGE_DEF_INTERNAL_H_ */ |
| 12729 | |
| 12730 | #ifndef UPB_REFLECTION_SERVICE_DEF_INTERNAL_H_ |
| 12731 | #define UPB_REFLECTION_SERVICE_DEF_INTERNAL_H_ |
| 12732 | |
| 12733 | |
| 12734 | // Must be last. |
| 12735 | |
| 12736 | #ifdef __cplusplus |
| 12737 | extern "C" { |
| 12738 | #endif |
| 12739 | |
| 12740 | upb_ServiceDef* _upb_ServiceDef_At(const upb_ServiceDef* s, int i); |
| 12741 | |
| 12742 | // Allocate and initialize an array of |n| service defs. |
Protobuf Team Bot | ce9dcc2 | 2023-11-03 22:38:26 +0000 | [diff] [blame] | 12743 | upb_ServiceDef* _upb_ServiceDefs_New(upb_DefBuilder* ctx, int n, |
| 12744 | const UPB_DESC(ServiceDescriptorProto*) |
| 12745 | const* protos, |
| 12746 | const UPB_DESC(FeatureSet*) |
| 12747 | parent_features); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12748 | |
| 12749 | #ifdef __cplusplus |
| 12750 | } /* extern "C" */ |
| 12751 | #endif |
| 12752 | |
| 12753 | |
| 12754 | #endif /* UPB_REFLECTION_SERVICE_DEF_INTERNAL_H_ */ |
| 12755 | |
Protobuf Team Bot | ce9dcc2 | 2023-11-03 22:38:26 +0000 | [diff] [blame] | 12756 | #ifndef UPB_REFLECTION_UPB_EDITION_DEFAULTS_H_ |
| 12757 | #define UPB_REFLECTION_UPB_EDITION_DEFAULTS_H_ |
| 12758 | |
| 12759 | // This file contains the serialized FeatureSetDefaults object for |
| 12760 | // language-independent features and (possibly at some point) for upb-specific |
| 12761 | // features. This is used for feature resolution under Editions. |
| 12762 | // NOLINTBEGIN |
| 12763 | // clang-format off |
| 12764 | #define UPB_INTERNAL_UPB_EDITION_DEFAULTS "\n\021\022\014\010\001\020\002\030\002 \001(\0010\002\030\346\007\n\021\022\014\010\002\020\001\030\001 \002(\0010\001\030\347\007\n\021\022\014\010\001\020\001\030\001 \002(\0010\001\030\350\007 \346\007(\350\007" |
| 12765 | // clang-format on |
| 12766 | // NOLINTEND |
| 12767 | |
| 12768 | #endif // UPB_REFLECTION_UPB_EDITION_DEFAULTS_H_ |
| 12769 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12770 | #ifndef UPB_REFLECTION_DESC_STATE_INTERNAL_H_ |
| 12771 | #define UPB_REFLECTION_DESC_STATE_INTERNAL_H_ |
| 12772 | |
| 12773 | |
| 12774 | // Must be last. |
| 12775 | |
| 12776 | // 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] | 12777 | // TODO: Move some of this state directly into the encoder, maybe. |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12778 | typedef struct { |
| 12779 | upb_MtDataEncoder e; |
| 12780 | size_t bufsize; |
| 12781 | char* buf; |
| 12782 | char* ptr; |
| 12783 | } upb_DescState; |
| 12784 | |
| 12785 | #ifdef __cplusplus |
| 12786 | extern "C" { |
| 12787 | #endif |
| 12788 | |
| 12789 | UPB_INLINE void _upb_DescState_Init(upb_DescState* d) { |
| 12790 | d->bufsize = kUpb_MtDataEncoder_MinSize * 2; |
| 12791 | d->buf = NULL; |
| 12792 | d->ptr = NULL; |
| 12793 | } |
| 12794 | |
| 12795 | bool _upb_DescState_Grow(upb_DescState* d, upb_Arena* a); |
| 12796 | |
| 12797 | #ifdef __cplusplus |
| 12798 | } /* extern "C" */ |
| 12799 | #endif |
| 12800 | |
| 12801 | |
| 12802 | #endif /* UPB_REFLECTION_DESC_STATE_INTERNAL_H_ */ |
| 12803 | |
| 12804 | #ifndef UPB_REFLECTION_ENUM_RESERVED_RANGE_INTERNAL_H_ |
| 12805 | #define UPB_REFLECTION_ENUM_RESERVED_RANGE_INTERNAL_H_ |
| 12806 | |
| 12807 | |
Protobuf Team Bot | 0631035 | 2023-09-26 21:54:58 +0000 | [diff] [blame] | 12808 | // IWYU pragma: private, include "upb/reflection/def.h" |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12809 | |
| 12810 | #ifndef UPB_REFLECTION_ENUM_RESERVED_RANGE_H_ |
| 12811 | #define UPB_REFLECTION_ENUM_RESERVED_RANGE_H_ |
| 12812 | |
| 12813 | |
| 12814 | // Must be last. |
| 12815 | |
| 12816 | #ifdef __cplusplus |
| 12817 | extern "C" { |
| 12818 | #endif |
| 12819 | |
| 12820 | int32_t upb_EnumReservedRange_Start(const upb_EnumReservedRange* r); |
| 12821 | int32_t upb_EnumReservedRange_End(const upb_EnumReservedRange* r); |
| 12822 | |
| 12823 | #ifdef __cplusplus |
| 12824 | } /* extern "C" */ |
| 12825 | #endif |
| 12826 | |
| 12827 | |
| 12828 | #endif /* UPB_REFLECTION_ENUM_RESERVED_RANGE_H_ */ |
| 12829 | |
| 12830 | // Must be last. |
| 12831 | |
| 12832 | #ifdef __cplusplus |
| 12833 | extern "C" { |
| 12834 | #endif |
| 12835 | |
| 12836 | upb_EnumReservedRange* _upb_EnumReservedRange_At(const upb_EnumReservedRange* r, |
| 12837 | int i); |
| 12838 | |
| 12839 | // Allocate and initialize an array of |n| reserved ranges owned by |e|. |
| 12840 | upb_EnumReservedRange* _upb_EnumReservedRanges_New( |
| 12841 | upb_DefBuilder* ctx, int n, |
Protobuf Team Bot | ce9dcc2 | 2023-11-03 22:38:26 +0000 | [diff] [blame] | 12842 | const UPB_DESC(EnumDescriptorProto_EnumReservedRange*) const* protos, |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12843 | const upb_EnumDef* e); |
| 12844 | |
| 12845 | #ifdef __cplusplus |
| 12846 | } /* extern "C" */ |
| 12847 | #endif |
| 12848 | |
| 12849 | |
| 12850 | #endif /* UPB_REFLECTION_ENUM_RESERVED_RANGE_INTERNAL_H_ */ |
| 12851 | |
Protobuf Team Bot | 7be2a45 | 2023-09-13 16:50:05 +0000 | [diff] [blame] | 12852 | #ifndef UPB_REFLECTION_INTERNAL_STRDUP2_H_ |
| 12853 | #define UPB_REFLECTION_INTERNAL_STRDUP2_H_ |
| 12854 | |
| 12855 | #include <stddef.h> |
| 12856 | |
| 12857 | |
| 12858 | // Must be last. |
| 12859 | |
| 12860 | #ifdef __cplusplus |
| 12861 | extern "C" { |
| 12862 | #endif |
| 12863 | |
| 12864 | // Variant that works with a length-delimited rather than NULL-delimited string, |
| 12865 | // as supported by strtable. |
| 12866 | char* upb_strdup2(const char* s, size_t len, upb_Arena* a); |
| 12867 | |
| 12868 | #ifdef __cplusplus |
| 12869 | } /* extern "C" */ |
| 12870 | #endif |
| 12871 | |
| 12872 | |
| 12873 | #endif /* UPB_REFLECTION_INTERNAL_STRDUP2_H_ */ |
| 12874 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12875 | #ifndef UPB_REFLECTION_EXTENSION_RANGE_INTERNAL_H_ |
| 12876 | #define UPB_REFLECTION_EXTENSION_RANGE_INTERNAL_H_ |
| 12877 | |
| 12878 | |
| 12879 | // Must be last. |
| 12880 | |
| 12881 | #ifdef __cplusplus |
| 12882 | extern "C" { |
| 12883 | #endif |
| 12884 | |
| 12885 | upb_ExtensionRange* _upb_ExtensionRange_At(const upb_ExtensionRange* r, int i); |
| 12886 | |
| 12887 | // Allocate and initialize an array of |n| extension ranges owned by |m|. |
| 12888 | upb_ExtensionRange* _upb_ExtensionRanges_New( |
| 12889 | upb_DefBuilder* ctx, int n, |
Protobuf Team Bot | ce9dcc2 | 2023-11-03 22:38:26 +0000 | [diff] [blame] | 12890 | const UPB_DESC(DescriptorProto_ExtensionRange*) const* protos, |
| 12891 | const UPB_DESC(FeatureSet*) parent_features, const upb_MessageDef* m); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12892 | |
| 12893 | #ifdef __cplusplus |
| 12894 | } /* extern "C" */ |
| 12895 | #endif |
| 12896 | |
| 12897 | |
| 12898 | #endif /* UPB_REFLECTION_EXTENSION_RANGE_INTERNAL_H_ */ |
| 12899 | |
| 12900 | #ifndef UPB_REFLECTION_ONEOF_DEF_INTERNAL_H_ |
| 12901 | #define UPB_REFLECTION_ONEOF_DEF_INTERNAL_H_ |
| 12902 | |
| 12903 | |
| 12904 | // Must be last. |
| 12905 | |
| 12906 | #ifdef __cplusplus |
| 12907 | extern "C" { |
| 12908 | #endif |
| 12909 | |
| 12910 | upb_OneofDef* _upb_OneofDef_At(const upb_OneofDef* o, int i); |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 12911 | void _upb_OneofDef_Insert(upb_DefBuilder* ctx, upb_OneofDef* o, |
| 12912 | const upb_FieldDef* f, const char* name, size_t size); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12913 | |
| 12914 | // Allocate and initialize an array of |n| oneof defs owned by |m|. |
Protobuf Team Bot | ce9dcc2 | 2023-11-03 22:38:26 +0000 | [diff] [blame] | 12915 | upb_OneofDef* _upb_OneofDefs_New(upb_DefBuilder* ctx, int n, |
| 12916 | const UPB_DESC(OneofDescriptorProto*) |
| 12917 | const* protos, |
| 12918 | const UPB_DESC(FeatureSet*) parent_features, |
| 12919 | upb_MessageDef* m); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12920 | |
| 12921 | size_t _upb_OneofDefs_Finalize(upb_DefBuilder* ctx, upb_MessageDef* m); |
| 12922 | |
| 12923 | #ifdef __cplusplus |
| 12924 | } /* extern "C" */ |
| 12925 | #endif |
| 12926 | |
| 12927 | |
| 12928 | #endif /* UPB_REFLECTION_ONEOF_DEF_INTERNAL_H_ */ |
| 12929 | |
| 12930 | #ifndef UPB_REFLECTION_MESSAGE_RESERVED_RANGE_INTERNAL_H_ |
| 12931 | #define UPB_REFLECTION_MESSAGE_RESERVED_RANGE_INTERNAL_H_ |
| 12932 | |
| 12933 | |
Protobuf Team Bot | 0631035 | 2023-09-26 21:54:58 +0000 | [diff] [blame] | 12934 | // IWYU pragma: private, include "upb/reflection/def.h" |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12935 | |
| 12936 | #ifndef UPB_REFLECTION_MESSAGE_RESERVED_RANGE_H_ |
| 12937 | #define UPB_REFLECTION_MESSAGE_RESERVED_RANGE_H_ |
| 12938 | |
| 12939 | |
| 12940 | // Must be last. |
| 12941 | |
| 12942 | #ifdef __cplusplus |
| 12943 | extern "C" { |
| 12944 | #endif |
| 12945 | |
| 12946 | int32_t upb_MessageReservedRange_Start(const upb_MessageReservedRange* r); |
| 12947 | int32_t upb_MessageReservedRange_End(const upb_MessageReservedRange* r); |
| 12948 | |
| 12949 | #ifdef __cplusplus |
| 12950 | } /* extern "C" */ |
| 12951 | #endif |
| 12952 | |
| 12953 | |
| 12954 | #endif /* UPB_REFLECTION_MESSAGE_RESERVED_RANGE_H_ */ |
| 12955 | |
| 12956 | // Must be last. |
| 12957 | |
| 12958 | #ifdef __cplusplus |
| 12959 | extern "C" { |
| 12960 | #endif |
| 12961 | |
| 12962 | upb_MessageReservedRange* _upb_MessageReservedRange_At( |
| 12963 | const upb_MessageReservedRange* r, int i); |
| 12964 | |
| 12965 | // Allocate and initialize an array of |n| reserved ranges owned by |m|. |
| 12966 | upb_MessageReservedRange* _upb_MessageReservedRanges_New( |
| 12967 | upb_DefBuilder* ctx, int n, |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 12968 | const UPB_DESC(DescriptorProto_ReservedRange) * const* protos, |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12969 | const upb_MessageDef* m); |
| 12970 | |
| 12971 | #ifdef __cplusplus |
| 12972 | } /* extern "C" */ |
| 12973 | #endif |
| 12974 | |
| 12975 | |
| 12976 | #endif /* UPB_REFLECTION_MESSAGE_RESERVED_RANGE_INTERNAL_H_ */ |
| 12977 | |
| 12978 | #ifndef UPB_REFLECTION_METHOD_DEF_INTERNAL_H_ |
| 12979 | #define UPB_REFLECTION_METHOD_DEF_INTERNAL_H_ |
| 12980 | |
| 12981 | |
| 12982 | // Must be last. |
| 12983 | |
| 12984 | #ifdef __cplusplus |
| 12985 | extern "C" { |
| 12986 | #endif |
| 12987 | |
| 12988 | upb_MethodDef* _upb_MethodDef_At(const upb_MethodDef* m, int i); |
| 12989 | |
| 12990 | // Allocate and initialize an array of |n| method defs owned by |s|. |
Protobuf Team Bot | ce9dcc2 | 2023-11-03 22:38:26 +0000 | [diff] [blame] | 12991 | upb_MethodDef* _upb_MethodDefs_New(upb_DefBuilder* ctx, int n, |
| 12992 | const UPB_DESC(MethodDescriptorProto*) |
| 12993 | const* protos, |
| 12994 | const UPB_DESC(FeatureSet*) parent_features, |
| 12995 | upb_ServiceDef* s); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12996 | |
| 12997 | #ifdef __cplusplus |
| 12998 | } /* extern "C" */ |
| 12999 | #endif |
| 13000 | |
| 13001 | |
| 13002 | #endif /* UPB_REFLECTION_METHOD_DEF_INTERNAL_H_ */ |
| 13003 | |
Protobuf Team Bot | 743bf92 | 2023-09-14 01:12:11 +0000 | [diff] [blame] | 13004 | #ifndef UPB_WIRE_INTERNAL_CONSTANTS_H_ |
| 13005 | #define UPB_WIRE_INTERNAL_CONSTANTS_H_ |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 13006 | |
Protobuf Team Bot | 743bf92 | 2023-09-14 01:12:11 +0000 | [diff] [blame] | 13007 | #define kUpb_WireFormat_DefaultDepthLimit 100 |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 13008 | |
| 13009 | // MessageSet wire format is: |
| 13010 | // message MessageSet { |
| 13011 | // repeated group Item = 1 { |
| 13012 | // required int32 type_id = 2; |
| 13013 | // required bytes message = 3; |
| 13014 | // } |
| 13015 | // } |
| 13016 | |
| 13017 | enum { |
| 13018 | kUpb_MsgSet_Item = 1, |
| 13019 | kUpb_MsgSet_TypeId = 2, |
| 13020 | kUpb_MsgSet_Message = 3, |
| 13021 | }; |
| 13022 | |
Protobuf Team Bot | 743bf92 | 2023-09-14 01:12:11 +0000 | [diff] [blame] | 13023 | #endif /* UPB_WIRE_INTERNAL_CONSTANTS_H_ */ |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 13024 | |
| 13025 | /* |
| 13026 | * Internal implementation details of the decoder that are shared between |
| 13027 | * decode.c and decode_fast.c. |
| 13028 | */ |
| 13029 | |
Sandy Zhang | e3b0943 | 2023-08-07 09:30:02 -0700 | [diff] [blame] | 13030 | #ifndef UPB_WIRE_INTERNAL_DECODE_H_ |
| 13031 | #define UPB_WIRE_INTERNAL_DECODE_H_ |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 13032 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 13033 | #include "utf8_range.h" |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 13034 | |
| 13035 | // Must be last. |
| 13036 | |
| 13037 | #define DECODE_NOGROUP (uint32_t) - 1 |
| 13038 | |
| 13039 | typedef struct upb_Decoder { |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 13040 | upb_EpsCopyInputStream input; |
| 13041 | const upb_ExtensionRegistry* extreg; |
| 13042 | const char* unknown; // Start of unknown data, preserve at buffer flip |
| 13043 | upb_Message* unknown_msg; // Pointer to preserve data to |
| 13044 | int depth; // Tracks recursion depth to bound stack usage. |
| 13045 | 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] | 13046 | uint16_t options; |
| 13047 | bool missing_required; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 13048 | upb_Arena arena; |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 13049 | upb_DecodeStatus status; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 13050 | jmp_buf err; |
| 13051 | |
| 13052 | #ifndef NDEBUG |
| 13053 | const char* debug_tagstart; |
| 13054 | const char* debug_valstart; |
| 13055 | #endif |
| 13056 | } upb_Decoder; |
| 13057 | |
| 13058 | /* Error function that will abort decoding with longjmp(). We can't declare this |
| 13059 | * UPB_NORETURN, even though it is appropriate, because if we do then compilers |
| 13060 | * will "helpfully" refuse to tailcall to it |
| 13061 | * (see: https://stackoverflow.com/a/55657013), which will defeat a major goal |
| 13062 | * of our optimizations. That is also why we must declare it in a separate file, |
| 13063 | * otherwise the compiler will see that it calls longjmp() and deduce that it is |
| 13064 | * noreturn. */ |
| 13065 | const char* _upb_FastDecoder_ErrorJmp(upb_Decoder* d, int status); |
| 13066 | |
| 13067 | extern const uint8_t upb_utf8_offsets[]; |
| 13068 | |
| 13069 | UPB_INLINE |
| 13070 | bool _upb_Decoder_VerifyUtf8Inline(const char* ptr, int len) { |
| 13071 | const char* end = ptr + len; |
| 13072 | |
| 13073 | // Check 8 bytes at a time for any non-ASCII char. |
| 13074 | while (end - ptr >= 8) { |
| 13075 | uint64_t data; |
| 13076 | memcpy(&data, ptr, 8); |
| 13077 | if (data & 0x8080808080808080) goto non_ascii; |
| 13078 | ptr += 8; |
| 13079 | } |
| 13080 | |
| 13081 | // Check one byte at a time for non-ASCII. |
| 13082 | while (ptr < end) { |
| 13083 | if (*ptr & 0x80) goto non_ascii; |
| 13084 | ptr++; |
| 13085 | } |
| 13086 | |
| 13087 | return true; |
| 13088 | |
| 13089 | non_ascii: |
| 13090 | return utf8_range2((const unsigned char*)ptr, end - ptr) == 0; |
| 13091 | } |
| 13092 | |
| 13093 | const char* _upb_Decoder_CheckRequired(upb_Decoder* d, const char* ptr, |
| 13094 | const upb_Message* msg, |
| 13095 | const upb_MiniTable* l); |
| 13096 | |
| 13097 | /* x86-64 pointers always have the high 16 bits matching. So we can shift |
| 13098 | * left 8 and right 8 without loss of information. */ |
| 13099 | UPB_INLINE intptr_t decode_totable(const upb_MiniTable* tablep) { |
| 13100 | return ((intptr_t)tablep << 8) | tablep->table_mask; |
| 13101 | } |
| 13102 | |
| 13103 | UPB_INLINE const upb_MiniTable* decode_totablep(intptr_t table) { |
| 13104 | return (const upb_MiniTable*)(table >> 8); |
| 13105 | } |
| 13106 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 13107 | const char* _upb_Decoder_IsDoneFallback(upb_EpsCopyInputStream* e, |
| 13108 | const char* ptr, int overrun); |
| 13109 | |
| 13110 | UPB_INLINE bool _upb_Decoder_IsDone(upb_Decoder* d, const char** ptr) { |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 13111 | return upb_EpsCopyInputStream_IsDoneWithCallback( |
| 13112 | &d->input, ptr, &_upb_Decoder_IsDoneFallback); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 13113 | } |
| 13114 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 13115 | UPB_INLINE const char* _upb_Decoder_BufferFlipCallback( |
| 13116 | upb_EpsCopyInputStream* e, const char* old_end, const char* new_start) { |
| 13117 | upb_Decoder* d = (upb_Decoder*)e; |
| 13118 | if (!old_end) _upb_FastDecoder_ErrorJmp(d, kUpb_DecodeStatus_Malformed); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 13119 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 13120 | if (d->unknown) { |
| 13121 | if (!_upb_Message_AddUnknown(d->unknown_msg, d->unknown, |
| 13122 | old_end - d->unknown, &d->arena)) { |
| 13123 | _upb_FastDecoder_ErrorJmp(d, kUpb_DecodeStatus_OutOfMemory); |
| 13124 | } |
| 13125 | d->unknown = new_start; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 13126 | } |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 13127 | return new_start; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 13128 | } |
| 13129 | |
| 13130 | #if UPB_FASTTABLE |
| 13131 | UPB_INLINE |
| 13132 | const char* _upb_FastDecoder_TagDispatch(upb_Decoder* d, const char* ptr, |
| 13133 | upb_Message* msg, intptr_t table, |
| 13134 | uint64_t hasbits, uint64_t tag) { |
| 13135 | const upb_MiniTable* table_p = decode_totablep(table); |
| 13136 | uint8_t mask = table; |
| 13137 | uint64_t data; |
| 13138 | size_t idx = tag & mask; |
| 13139 | UPB_ASSUME((idx & 7) == 0); |
| 13140 | idx >>= 3; |
| 13141 | data = table_p->fasttable[idx].field_data ^ tag; |
| 13142 | UPB_MUSTTAIL return table_p->fasttable[idx].field_parser(d, ptr, msg, table, |
| 13143 | hasbits, data); |
| 13144 | } |
| 13145 | #endif |
| 13146 | |
| 13147 | UPB_INLINE uint32_t _upb_FastDecoder_LoadTag(const char* ptr) { |
| 13148 | uint16_t tag; |
| 13149 | memcpy(&tag, ptr, 2); |
| 13150 | return tag; |
| 13151 | } |
| 13152 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 13153 | |
Sandy Zhang | e3b0943 | 2023-08-07 09:30:02 -0700 | [diff] [blame] | 13154 | #endif /* UPB_WIRE_INTERNAL_DECODE_H_ */ |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 13155 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 13156 | // This should #undef all macros #defined in def.inc |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 13157 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 13158 | #undef UPB_SIZE |
| 13159 | #undef UPB_PTR_AT |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 13160 | #undef UPB_MAPTYPE_STRING |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 13161 | #undef UPB_EXPORT |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 13162 | #undef UPB_INLINE |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 13163 | #undef UPB_API |
| 13164 | #undef UPB_API_INLINE |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 13165 | #undef UPB_ALIGN_UP |
| 13166 | #undef UPB_ALIGN_DOWN |
| 13167 | #undef UPB_ALIGN_MALLOC |
| 13168 | #undef UPB_ALIGN_OF |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 13169 | #undef UPB_MALLOC_ALIGN |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 13170 | #undef UPB_LIKELY |
| 13171 | #undef UPB_UNLIKELY |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 13172 | #undef UPB_FORCEINLINE |
| 13173 | #undef UPB_NOINLINE |
| 13174 | #undef UPB_NORETURN |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 13175 | #undef UPB_PRINTF |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 13176 | #undef UPB_MAX |
| 13177 | #undef UPB_MIN |
| 13178 | #undef UPB_UNUSED |
| 13179 | #undef UPB_ASSUME |
| 13180 | #undef UPB_ASSERT |
| 13181 | #undef UPB_UNREACHABLE |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 13182 | #undef UPB_SETJMP |
| 13183 | #undef UPB_LONGJMP |
| 13184 | #undef UPB_PTRADD |
| 13185 | #undef UPB_MUSTTAIL |
| 13186 | #undef UPB_FASTTABLE_SUPPORTED |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 13187 | #undef UPB_FASTTABLE_MASK |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 13188 | #undef UPB_FASTTABLE |
| 13189 | #undef UPB_FASTTABLE_INIT |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 13190 | #undef UPB_POISON_MEMORY_REGION |
| 13191 | #undef UPB_UNPOISON_MEMORY_REGION |
| 13192 | #undef UPB_ASAN |
Sandy Zhang | e3b0943 | 2023-08-07 09:30:02 -0700 | [diff] [blame] | 13193 | #undef UPB_ASAN_GUARD_SIZE |
| 13194 | #undef UPB_CLANG_ASAN |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 13195 | #undef UPB_TREAT_PROTO2_ENUMS_LIKE_PROTO3 |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 13196 | #undef UPB_DEPRECATED |
| 13197 | #undef UPB_GNUC_MIN |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 13198 | #undef UPB_DESCRIPTOR_UPB_H_FILENAME |
| 13199 | #undef UPB_DESC |
Protobuf Team Bot | ce9dcc2 | 2023-11-03 22:38:26 +0000 | [diff] [blame] | 13200 | #undef UPB_DESC_MINITABLE |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 13201 | #undef UPB_IS_GOOGLE3 |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 13202 | #undef UPB_ATOMIC |
| 13203 | #undef UPB_USE_C11_ATOMICS |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 13204 | #undef UPB_PRIVATE |