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 | * |
| 12 | * #include "upb/foobar.h" |
| 13 | * #include "upb/baz.h" |
| 14 | * |
| 15 | * // MUST be last included header. |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [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. |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [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 |
| 323 | #else |
| 324 | #define UPB_DESC(sym) google_protobuf_##sym |
| 325 | #endif |
| 326 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 327 | #ifndef UPB_BASE_STATUS_H_ |
| 328 | #define UPB_BASE_STATUS_H_ |
| 329 | |
| 330 | #include <stdarg.h> |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 331 | |
| 332 | // Must be last. |
| 333 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 334 | #define _kUpb_Status_MaxMessage 127 |
| 335 | |
| 336 | typedef struct { |
| 337 | bool ok; |
| 338 | char msg[_kUpb_Status_MaxMessage]; // Error message; NULL-terminated. |
| 339 | } upb_Status; |
| 340 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 341 | #ifdef __cplusplus |
| 342 | extern "C" { |
| 343 | #endif |
| 344 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 345 | UPB_API const char* upb_Status_ErrorMessage(const upb_Status* status); |
| 346 | UPB_API bool upb_Status_IsOk(const upb_Status* status); |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 347 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 348 | // These are no-op if |status| is NULL. |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 349 | UPB_API void upb_Status_Clear(upb_Status* status); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 350 | void upb_Status_SetErrorMessage(upb_Status* status, const char* msg); |
| 351 | void upb_Status_SetErrorFormat(upb_Status* status, const char* fmt, ...) |
| 352 | UPB_PRINTF(2, 3); |
| 353 | void upb_Status_VSetErrorFormat(upb_Status* status, const char* fmt, |
| 354 | va_list args) UPB_PRINTF(2, 0); |
| 355 | void upb_Status_VAppendErrorFormat(upb_Status* status, const char* fmt, |
| 356 | va_list args) UPB_PRINTF(2, 0); |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 357 | |
| 358 | #ifdef __cplusplus |
| 359 | } /* extern "C" */ |
| 360 | #endif |
| 361 | |
| 362 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 363 | #endif /* UPB_BASE_STATUS_H_ */ |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 364 | |
Adam Cozzette | 8059da2 | 2023-08-16 07:57:14 -0700 | [diff] [blame] | 365 | #ifndef UPB_COLLECTIONS_INTERNAL_ARRAY_H_ |
| 366 | #define UPB_COLLECTIONS_INTERNAL_ARRAY_H_ |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 367 | |
| 368 | #include <string.h> |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 369 | |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 370 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 371 | #ifndef UPB_COLLECTIONS_ARRAY_H_ |
| 372 | #define UPB_COLLECTIONS_ARRAY_H_ |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 373 | |
| 374 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 375 | #ifndef UPB_BASE_DESCRIPTOR_CONSTANTS_H_ |
| 376 | #define UPB_BASE_DESCRIPTOR_CONSTANTS_H_ |
| 377 | |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 378 | // Must be last. |
| 379 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 380 | // The types a field can have. Note that this list is not identical to the |
| 381 | // types defined in descriptor.proto, which gives INT32 and SINT32 separate |
| 382 | // types (we distinguish the two with the "integer encoding" enum below). |
| 383 | // This enum is an internal convenience only and has no meaning outside of upb. |
| 384 | typedef enum { |
| 385 | kUpb_CType_Bool = 1, |
| 386 | kUpb_CType_Float = 2, |
| 387 | kUpb_CType_Int32 = 3, |
| 388 | kUpb_CType_UInt32 = 4, |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 389 | kUpb_CType_Enum = 5, // Enum values are int32. TODO(b/279178239): rename |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 390 | kUpb_CType_Message = 6, |
| 391 | kUpb_CType_Double = 7, |
| 392 | kUpb_CType_Int64 = 8, |
| 393 | kUpb_CType_UInt64 = 9, |
| 394 | kUpb_CType_String = 10, |
| 395 | kUpb_CType_Bytes = 11 |
| 396 | } upb_CType; |
| 397 | |
| 398 | // The repeated-ness of each field; this matches descriptor.proto. |
| 399 | typedef enum { |
| 400 | kUpb_Label_Optional = 1, |
| 401 | kUpb_Label_Required = 2, |
| 402 | kUpb_Label_Repeated = 3 |
| 403 | } upb_Label; |
| 404 | |
| 405 | // Descriptor types, as defined in descriptor.proto. |
| 406 | typedef enum { |
| 407 | kUpb_FieldType_Double = 1, |
| 408 | kUpb_FieldType_Float = 2, |
| 409 | kUpb_FieldType_Int64 = 3, |
| 410 | kUpb_FieldType_UInt64 = 4, |
| 411 | kUpb_FieldType_Int32 = 5, |
| 412 | kUpb_FieldType_Fixed64 = 6, |
| 413 | kUpb_FieldType_Fixed32 = 7, |
| 414 | kUpb_FieldType_Bool = 8, |
| 415 | kUpb_FieldType_String = 9, |
| 416 | kUpb_FieldType_Group = 10, |
| 417 | kUpb_FieldType_Message = 11, |
| 418 | kUpb_FieldType_Bytes = 12, |
| 419 | kUpb_FieldType_UInt32 = 13, |
| 420 | kUpb_FieldType_Enum = 14, |
| 421 | kUpb_FieldType_SFixed32 = 15, |
| 422 | kUpb_FieldType_SFixed64 = 16, |
| 423 | kUpb_FieldType_SInt32 = 17, |
| 424 | kUpb_FieldType_SInt64 = 18, |
| 425 | } upb_FieldType; |
| 426 | |
| 427 | #define kUpb_FieldType_SizeOf 19 |
| 428 | |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 429 | #ifdef __cplusplus |
| 430 | extern "C" { |
| 431 | #endif |
| 432 | |
| 433 | UPB_INLINE bool upb_FieldType_IsPackable(upb_FieldType type) { |
| 434 | // clang-format off |
| 435 | const unsigned kUnpackableTypes = |
| 436 | (1 << kUpb_FieldType_String) | |
| 437 | (1 << kUpb_FieldType_Bytes) | |
| 438 | (1 << kUpb_FieldType_Message) | |
| 439 | (1 << kUpb_FieldType_Group); |
| 440 | // clang-format on |
| 441 | return (1 << type) & ~kUnpackableTypes; |
| 442 | } |
| 443 | |
| 444 | #ifdef __cplusplus |
| 445 | } /* extern "C" */ |
| 446 | #endif |
| 447 | |
| 448 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 449 | #endif /* UPB_BASE_DESCRIPTOR_CONSTANTS_H_ */ |
| 450 | |
| 451 | // Users should include array.h or map.h instead. |
| 452 | // IWYU pragma: private, include "upb/collections/array.h" |
| 453 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 454 | #ifndef UPB_MESSAGE_VALUE_H_ |
| 455 | #define UPB_MESSAGE_VALUE_H_ |
| 456 | |
| 457 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 458 | #ifndef UPB_BASE_STRING_VIEW_H_ |
| 459 | #define UPB_BASE_STRING_VIEW_H_ |
| 460 | |
| 461 | #include <string.h> |
| 462 | |
| 463 | // Must be last. |
| 464 | |
| 465 | #define UPB_STRINGVIEW_INIT(ptr, len) \ |
| 466 | { ptr, len } |
| 467 | |
| 468 | #define UPB_STRINGVIEW_FORMAT "%.*s" |
| 469 | #define UPB_STRINGVIEW_ARGS(view) (int)(view).size, (view).data |
| 470 | |
| 471 | // LINT.IfChange(struct_definition) |
| 472 | typedef struct { |
| 473 | const char* data; |
| 474 | size_t size; |
| 475 | } upb_StringView; |
Adam Cozzette | 7d5592e | 2023-08-23 12:15:26 -0700 | [diff] [blame] | 476 | // LINT.ThenChange( |
| 477 | // GoogleInternalName0, |
| 478 | // //depot/google3/third_party/upb/bits/golang/accessor.go:map_go_string |
| 479 | // ) |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 480 | |
| 481 | #ifdef __cplusplus |
| 482 | extern "C" { |
| 483 | #endif |
| 484 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 485 | UPB_API_INLINE upb_StringView upb_StringView_FromDataAndSize(const char* data, |
| 486 | size_t size) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 487 | upb_StringView ret; |
| 488 | ret.data = data; |
| 489 | ret.size = size; |
| 490 | return ret; |
| 491 | } |
| 492 | |
| 493 | UPB_INLINE upb_StringView upb_StringView_FromString(const char* data) { |
| 494 | return upb_StringView_FromDataAndSize(data, strlen(data)); |
| 495 | } |
| 496 | |
| 497 | UPB_INLINE bool upb_StringView_IsEqual(upb_StringView a, upb_StringView b) { |
| 498 | return a.size == b.size && memcmp(a.data, b.data, a.size) == 0; |
| 499 | } |
| 500 | |
| 501 | #ifdef __cplusplus |
| 502 | } /* extern "C" */ |
| 503 | #endif |
| 504 | |
| 505 | |
| 506 | #endif /* UPB_BASE_STRING_VIEW_H_ */ |
| 507 | |
| 508 | #ifndef UPB_MINI_TABLE_TYPES_H_ |
| 509 | #define UPB_MINI_TABLE_TYPES_H_ |
| 510 | |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 511 | #include <stdint.h> |
| 512 | |
Sandy Zhang | e3b0943 | 2023-08-07 09:30:02 -0700 | [diff] [blame] | 513 | |
Adam Cozzette | 7d5592e | 2023-08-23 12:15:26 -0700 | [diff] [blame] | 514 | #ifndef UPB_MESSAGE_TYPES_H_ |
| 515 | #define UPB_MESSAGE_TYPES_H_ |
Sandy Zhang | e3b0943 | 2023-08-07 09:30:02 -0700 | [diff] [blame] | 516 | |
Adam Cozzette | 7d5592e | 2023-08-23 12:15:26 -0700 | [diff] [blame] | 517 | // This typedef is in a leaf header to resolve a circular dependency between |
Sandy Zhang | e3b0943 | 2023-08-07 09:30:02 -0700 | [diff] [blame] | 518 | // messages and mini tables. |
| 519 | typedef void upb_Message; |
| 520 | |
Adam Cozzette | 7d5592e | 2023-08-23 12:15:26 -0700 | [diff] [blame] | 521 | #endif /* UPB_MESSAGE_TYPES_H_ */ |
Sandy Zhang | e3b0943 | 2023-08-07 09:30:02 -0700 | [diff] [blame] | 522 | |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 523 | // Must be last. |
| 524 | |
| 525 | #ifdef __cplusplus |
| 526 | extern "C" { |
| 527 | #endif |
| 528 | |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 529 | // When a upb_Message* is stored in a message, array, or map, it is stored in a |
| 530 | // tagged form. If the tag bit is set, the referenced upb_Message is of type |
| 531 | // _kUpb_MiniTable_Empty (a sentinel message type with no fields) instead of |
| 532 | // that field's true message type. This forms the basis of what we call |
| 533 | // "dynamic tree shaking." |
| 534 | // |
| 535 | // See the documentation for kUpb_DecodeOption_ExperimentalAllowUnlinked for |
| 536 | // more information. |
| 537 | typedef uintptr_t upb_TaggedMessagePtr; |
| 538 | |
| 539 | // Internal-only because empty messages cannot be created by the user. |
| 540 | UPB_INLINE upb_TaggedMessagePtr _upb_TaggedMessagePtr_Pack(upb_Message* ptr, |
| 541 | bool empty) { |
| 542 | UPB_ASSERT(((uintptr_t)ptr & 1) == 0); |
| 543 | return (uintptr_t)ptr | (empty ? 1 : 0); |
| 544 | } |
| 545 | |
| 546 | // Users who enable unlinked sub-messages must use this to test whether a |
| 547 | // message is empty before accessing it. If a message is empty, it must be |
| 548 | // first promoted using the interfaces in message/promote.h. |
| 549 | UPB_INLINE bool upb_TaggedMessagePtr_IsEmpty(upb_TaggedMessagePtr ptr) { |
| 550 | return ptr & 1; |
| 551 | } |
| 552 | |
| 553 | UPB_INLINE upb_Message* _upb_TaggedMessagePtr_GetMessage( |
| 554 | upb_TaggedMessagePtr ptr) { |
| 555 | return (upb_Message*)(ptr & ~(uintptr_t)1); |
| 556 | } |
| 557 | |
| 558 | UPB_INLINE upb_Message* upb_TaggedMessagePtr_GetNonEmptyMessage( |
| 559 | upb_TaggedMessagePtr ptr) { |
| 560 | UPB_ASSERT(!upb_TaggedMessagePtr_IsEmpty(ptr)); |
| 561 | return _upb_TaggedMessagePtr_GetMessage(ptr); |
| 562 | } |
| 563 | |
| 564 | UPB_INLINE upb_Message* _upb_TaggedMessagePtr_GetEmptyMessage( |
| 565 | upb_TaggedMessagePtr ptr) { |
| 566 | UPB_ASSERT(upb_TaggedMessagePtr_IsEmpty(ptr)); |
| 567 | return _upb_TaggedMessagePtr_GetMessage(ptr); |
| 568 | } |
| 569 | |
| 570 | #ifdef __cplusplus |
| 571 | } /* extern "C" */ |
| 572 | #endif |
| 573 | |
| 574 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 575 | #endif /* UPB_MINI_TABLE_TYPES_H_ */ |
| 576 | |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 577 | #ifndef UPB_MINI_TABLE_MESSAGE_H_ |
| 578 | #define UPB_MINI_TABLE_MESSAGE_H_ |
| 579 | |
| 580 | |
| 581 | #ifndef UPB_MINI_TABLE_ENUM_H_ |
| 582 | #define UPB_MINI_TABLE_ENUM_H_ |
| 583 | |
| 584 | |
| 585 | #ifndef UPB_MINI_TABLE_INTERNAL_ENUM_H_ |
| 586 | #define UPB_MINI_TABLE_INTERNAL_ENUM_H_ |
| 587 | |
Adam Cozzette | 7d5592e | 2023-08-23 12:15:26 -0700 | [diff] [blame] | 588 | #include <stdint.h> |
| 589 | |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 590 | // Must be last. |
| 591 | |
| 592 | struct upb_MiniTableEnum { |
| 593 | uint32_t mask_limit; // Limit enum value that can be tested with mask. |
| 594 | uint32_t value_count; // Number of values after the bitfield. |
| 595 | uint32_t data[]; // Bitmask + enumerated values follow. |
| 596 | }; |
| 597 | |
| 598 | typedef enum { |
| 599 | _kUpb_FastEnumCheck_ValueIsInEnum = 0, |
| 600 | _kUpb_FastEnumCheck_ValueIsNotInEnum = 1, |
| 601 | _kUpb_FastEnumCheck_CannotCheckFast = 2, |
| 602 | } _kUpb_FastEnumCheck_Status; |
| 603 | |
| 604 | #ifdef __cplusplus |
| 605 | extern "C" { |
| 606 | #endif |
| 607 | |
| 608 | UPB_INLINE _kUpb_FastEnumCheck_Status _upb_MiniTable_CheckEnumValueFast( |
| 609 | const struct upb_MiniTableEnum* e, uint32_t val) { |
| 610 | if (UPB_UNLIKELY(val >= 64)) return _kUpb_FastEnumCheck_CannotCheckFast; |
| 611 | uint64_t mask = e->data[0] | ((uint64_t)e->data[1] << 32); |
| 612 | return (mask & (1ULL << val)) ? _kUpb_FastEnumCheck_ValueIsInEnum |
| 613 | : _kUpb_FastEnumCheck_ValueIsNotInEnum; |
| 614 | } |
| 615 | |
| 616 | UPB_INLINE bool _upb_MiniTable_CheckEnumValueSlow( |
| 617 | const struct upb_MiniTableEnum* e, uint32_t val) { |
| 618 | if (val < e->mask_limit) return e->data[val / 32] & (1ULL << (val % 32)); |
| 619 | // OPT: binary search long lists? |
| 620 | const uint32_t* start = &e->data[e->mask_limit / 32]; |
| 621 | const uint32_t* limit = &e->data[(e->mask_limit / 32) + e->value_count]; |
| 622 | for (const uint32_t* p = start; p < limit; p++) { |
| 623 | if (*p == val) return true; |
| 624 | } |
| 625 | return false; |
| 626 | } |
| 627 | |
| 628 | #ifdef __cplusplus |
| 629 | } /* extern "C" */ |
| 630 | #endif |
| 631 | |
| 632 | |
| 633 | #endif /* UPB_MINI_TABLE_INTERNAL_ENUM_H_ */ |
| 634 | |
| 635 | // Must be last |
| 636 | |
| 637 | typedef struct upb_MiniTableEnum upb_MiniTableEnum; |
| 638 | |
| 639 | // Validates enum value against range defined by enum mini table. |
| 640 | UPB_INLINE bool upb_MiniTableEnum_CheckValue(const struct upb_MiniTableEnum* e, |
| 641 | uint32_t val) { |
| 642 | _kUpb_FastEnumCheck_Status status = _upb_MiniTable_CheckEnumValueFast(e, val); |
| 643 | if (UPB_UNLIKELY(status == _kUpb_FastEnumCheck_CannotCheckFast)) { |
| 644 | return _upb_MiniTable_CheckEnumValueSlow(e, val); |
| 645 | } |
| 646 | return status == _kUpb_FastEnumCheck_ValueIsInEnum ? true : false; |
| 647 | } |
| 648 | |
| 649 | |
| 650 | #endif /* UPB_MINI_TABLE_ENUM_H_ */ |
| 651 | |
| 652 | #ifndef UPB_MINI_TABLE_FIELD_H_ |
| 653 | #define UPB_MINI_TABLE_FIELD_H_ |
| 654 | |
| 655 | |
| 656 | #ifndef UPB_MINI_TABLE_INTERNAL_FIELD_H_ |
| 657 | #define UPB_MINI_TABLE_INTERNAL_FIELD_H_ |
| 658 | |
Adam Cozzette | 7d5592e | 2023-08-23 12:15:26 -0700 | [diff] [blame] | 659 | #include <stdint.h> |
| 660 | |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 661 | |
| 662 | // Must be last. |
| 663 | |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 664 | struct upb_MiniTableField { |
| 665 | uint32_t number; |
| 666 | uint16_t offset; |
| 667 | int16_t presence; // If >0, hasbit_index. If <0, ~oneof_index |
| 668 | |
| 669 | // Indexes into `upb_MiniTable.subs` |
| 670 | // Will be set to `kUpb_NoSub` if `descriptortype` != MESSAGE/GROUP/ENUM |
| 671 | uint16_t UPB_PRIVATE(submsg_index); |
| 672 | |
| 673 | uint8_t UPB_PRIVATE(descriptortype); |
| 674 | |
| 675 | // upb_FieldMode | upb_LabelFlags | (upb_FieldRep << kUpb_FieldRep_Shift) |
| 676 | uint8_t mode; |
| 677 | }; |
| 678 | |
| 679 | #define kUpb_NoSub ((uint16_t)-1) |
| 680 | |
| 681 | typedef enum { |
| 682 | kUpb_FieldMode_Map = 0, |
| 683 | kUpb_FieldMode_Array = 1, |
| 684 | kUpb_FieldMode_Scalar = 2, |
| 685 | } upb_FieldMode; |
| 686 | |
| 687 | // Mask to isolate the upb_FieldMode from field.mode. |
| 688 | #define kUpb_FieldMode_Mask 3 |
| 689 | |
| 690 | // Extra flags on the mode field. |
| 691 | typedef enum { |
| 692 | kUpb_LabelFlags_IsPacked = 4, |
| 693 | kUpb_LabelFlags_IsExtension = 8, |
| 694 | // Indicates that this descriptor type is an "alternate type": |
| 695 | // - for Int32, this indicates that the actual type is Enum (but was |
| 696 | // rewritten to Int32 because it is an open enum that requires no check). |
| 697 | // - for Bytes, this indicates that the actual type is String (but does |
| 698 | // not require any UTF-8 check). |
| 699 | kUpb_LabelFlags_IsAlternate = 16, |
| 700 | } upb_LabelFlags; |
| 701 | |
| 702 | // Note: we sort by this number when calculating layout order. |
| 703 | typedef enum { |
| 704 | kUpb_FieldRep_1Byte = 0, |
| 705 | kUpb_FieldRep_4Byte = 1, |
| 706 | kUpb_FieldRep_StringView = 2, |
| 707 | kUpb_FieldRep_8Byte = 3, |
| 708 | |
| 709 | kUpb_FieldRep_NativePointer = |
| 710 | UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte), |
| 711 | kUpb_FieldRep_Max = kUpb_FieldRep_8Byte, |
| 712 | } upb_FieldRep; |
| 713 | |
| 714 | #define kUpb_FieldRep_Shift 6 |
| 715 | |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 716 | UPB_INLINE upb_FieldRep |
| 717 | _upb_MiniTableField_GetRep(const struct upb_MiniTableField* field) { |
| 718 | return (upb_FieldRep)(field->mode >> kUpb_FieldRep_Shift); |
| 719 | } |
| 720 | |
| 721 | #ifdef __cplusplus |
| 722 | extern "C" { |
| 723 | #endif |
| 724 | |
| 725 | UPB_INLINE upb_FieldMode |
| 726 | upb_FieldMode_Get(const struct upb_MiniTableField* field) { |
| 727 | return (upb_FieldMode)(field->mode & 3); |
| 728 | } |
| 729 | |
| 730 | UPB_INLINE void _upb_MiniTableField_CheckIsArray( |
| 731 | const struct upb_MiniTableField* field) { |
| 732 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_NativePointer); |
| 733 | UPB_ASSUME(upb_FieldMode_Get(field) == kUpb_FieldMode_Array); |
| 734 | UPB_ASSUME(field->presence == 0); |
| 735 | } |
| 736 | |
| 737 | UPB_INLINE void _upb_MiniTableField_CheckIsMap( |
| 738 | const struct upb_MiniTableField* field) { |
| 739 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_NativePointer); |
| 740 | UPB_ASSUME(upb_FieldMode_Get(field) == kUpb_FieldMode_Map); |
| 741 | UPB_ASSUME(field->presence == 0); |
| 742 | } |
| 743 | |
| 744 | UPB_INLINE bool upb_IsRepeatedOrMap(const struct upb_MiniTableField* field) { |
| 745 | // This works because upb_FieldMode has no value 3. |
| 746 | return !(field->mode & kUpb_FieldMode_Scalar); |
| 747 | } |
| 748 | |
| 749 | UPB_INLINE bool upb_IsSubMessage(const struct upb_MiniTableField* field) { |
| 750 | return field->UPB_PRIVATE(descriptortype) == kUpb_FieldType_Message || |
| 751 | field->UPB_PRIVATE(descriptortype) == kUpb_FieldType_Group; |
| 752 | } |
| 753 | |
| 754 | #ifdef __cplusplus |
| 755 | } /* extern "C" */ |
| 756 | #endif |
| 757 | |
| 758 | |
| 759 | #endif /* UPB_MINI_TABLE_INTERNAL_FIELD_H_ */ |
| 760 | |
| 761 | #ifndef UPB_MINI_TABLE_INTERNAL_MESSAGE_H_ |
| 762 | #define UPB_MINI_TABLE_INTERNAL_MESSAGE_H_ |
| 763 | |
| 764 | |
| 765 | // Must be last. |
| 766 | |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 767 | struct upb_Decoder; |
| 768 | typedef const char* _upb_FieldParser(struct upb_Decoder* d, const char* ptr, |
| 769 | upb_Message* msg, intptr_t table, |
| 770 | uint64_t hasbits, uint64_t data); |
| 771 | typedef struct { |
| 772 | uint64_t field_data; |
| 773 | _upb_FieldParser* field_parser; |
| 774 | } _upb_FastTable_Entry; |
| 775 | |
| 776 | typedef enum { |
| 777 | kUpb_ExtMode_NonExtendable = 0, // Non-extendable message. |
| 778 | kUpb_ExtMode_Extendable = 1, // Normal extendable message. |
| 779 | kUpb_ExtMode_IsMessageSet = 2, // MessageSet message. |
| 780 | kUpb_ExtMode_IsMessageSet_ITEM = |
| 781 | 3, // MessageSet item (temporary only, see decode.c) |
| 782 | |
| 783 | // During table building we steal a bit to indicate that the message is a map |
| 784 | // entry. *Only* used during table building! |
| 785 | kUpb_ExtMode_IsMapEntry = 4, |
| 786 | } upb_ExtMode; |
| 787 | |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 788 | union upb_MiniTableSub; |
| 789 | |
| 790 | // upb_MiniTable represents the memory layout of a given upb_MessageDef. |
| 791 | // The members are public so generated code can initialize them, |
| 792 | // but users MUST NOT directly read or write any of its members. |
| 793 | struct upb_MiniTable { |
| 794 | const union upb_MiniTableSub* subs; |
| 795 | const struct upb_MiniTableField* fields; |
| 796 | |
| 797 | // Must be aligned to sizeof(void*). Doesn't include internal members like |
| 798 | // unknown fields, extension dict, pointer to msglayout, etc. |
| 799 | uint16_t size; |
| 800 | |
| 801 | uint16_t field_count; |
| 802 | uint8_t ext; // upb_ExtMode, declared as uint8_t so sizeof(ext) == 1 |
| 803 | uint8_t dense_below; |
| 804 | uint8_t table_mask; |
| 805 | uint8_t required_count; // Required fields have the lowest hasbits. |
| 806 | |
| 807 | // To statically initialize the tables of variable length, we need a flexible |
| 808 | // array member, and we need to compile in gnu99 mode (constant initialization |
| 809 | // of flexible array members is a GNU extension, not in C99 unfortunately. |
| 810 | _upb_FastTable_Entry fasttable[]; |
| 811 | }; |
| 812 | |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 813 | #ifdef __cplusplus |
| 814 | extern "C" { |
| 815 | #endif |
| 816 | |
| 817 | // A MiniTable for an empty message, used for unlinked sub-messages. |
| 818 | extern const struct upb_MiniTable _kUpb_MiniTable_Empty; |
| 819 | |
| 820 | // Computes a bitmask in which the |l->required_count| lowest bits are set, |
| 821 | // except that we skip the lowest bit (because upb never uses hasbit 0). |
| 822 | // |
| 823 | // Sample output: |
| 824 | // requiredmask(1) => 0b10 (0x2) |
| 825 | // requiredmask(5) => 0b111110 (0x3e) |
| 826 | UPB_INLINE uint64_t upb_MiniTable_requiredmask(const struct upb_MiniTable* l) { |
| 827 | int n = l->required_count; |
| 828 | assert(0 < n && n <= 63); |
| 829 | return ((1ULL << n) - 1) << 1; |
| 830 | } |
| 831 | |
| 832 | #ifdef __cplusplus |
| 833 | } /* extern "C" */ |
| 834 | #endif |
| 835 | |
| 836 | |
| 837 | #endif /* UPB_MINI_TABLE_INTERNAL_MESSAGE_H_ */ |
| 838 | |
| 839 | #ifndef UPB_MINI_TABLE_INTERNAL_SUB_H_ |
| 840 | #define UPB_MINI_TABLE_INTERNAL_SUB_H_ |
| 841 | |
| 842 | |
| 843 | union upb_MiniTableSub { |
| 844 | const struct upb_MiniTable* submsg; |
| 845 | const struct upb_MiniTableEnum* subenum; |
| 846 | }; |
| 847 | |
| 848 | #endif /* UPB_MINI_TABLE_INTERNAL_SUB_H_ */ |
| 849 | |
| 850 | // Must be last. |
| 851 | |
| 852 | #ifdef __cplusplus |
| 853 | extern "C" { |
| 854 | #endif |
| 855 | |
| 856 | typedef struct upb_MiniTableField upb_MiniTableField; |
| 857 | |
| 858 | UPB_API_INLINE upb_FieldType |
| 859 | upb_MiniTableField_Type(const upb_MiniTableField* field) { |
| 860 | if (field->mode & kUpb_LabelFlags_IsAlternate) { |
| 861 | if (field->UPB_PRIVATE(descriptortype) == kUpb_FieldType_Int32) { |
| 862 | return kUpb_FieldType_Enum; |
| 863 | } else if (field->UPB_PRIVATE(descriptortype) == kUpb_FieldType_Bytes) { |
| 864 | return kUpb_FieldType_String; |
| 865 | } else { |
| 866 | UPB_ASSERT(false); |
| 867 | } |
| 868 | } |
| 869 | return (upb_FieldType)field->UPB_PRIVATE(descriptortype); |
| 870 | } |
| 871 | |
| 872 | UPB_API_INLINE upb_CType upb_MiniTableField_CType(const upb_MiniTableField* f) { |
| 873 | switch (upb_MiniTableField_Type(f)) { |
| 874 | case kUpb_FieldType_Double: |
| 875 | return kUpb_CType_Double; |
| 876 | case kUpb_FieldType_Float: |
| 877 | return kUpb_CType_Float; |
| 878 | case kUpb_FieldType_Int64: |
| 879 | case kUpb_FieldType_SInt64: |
| 880 | case kUpb_FieldType_SFixed64: |
| 881 | return kUpb_CType_Int64; |
| 882 | case kUpb_FieldType_Int32: |
| 883 | case kUpb_FieldType_SFixed32: |
| 884 | case kUpb_FieldType_SInt32: |
| 885 | return kUpb_CType_Int32; |
| 886 | case kUpb_FieldType_UInt64: |
| 887 | case kUpb_FieldType_Fixed64: |
| 888 | return kUpb_CType_UInt64; |
| 889 | case kUpb_FieldType_UInt32: |
| 890 | case kUpb_FieldType_Fixed32: |
| 891 | return kUpb_CType_UInt32; |
| 892 | case kUpb_FieldType_Enum: |
| 893 | return kUpb_CType_Enum; |
| 894 | case kUpb_FieldType_Bool: |
| 895 | return kUpb_CType_Bool; |
| 896 | case kUpb_FieldType_String: |
| 897 | return kUpb_CType_String; |
| 898 | case kUpb_FieldType_Bytes: |
| 899 | return kUpb_CType_Bytes; |
| 900 | case kUpb_FieldType_Group: |
| 901 | case kUpb_FieldType_Message: |
| 902 | return kUpb_CType_Message; |
| 903 | } |
| 904 | UPB_UNREACHABLE(); |
| 905 | } |
| 906 | |
| 907 | UPB_API_INLINE bool upb_MiniTableField_IsExtension( |
| 908 | const upb_MiniTableField* field) { |
| 909 | return field->mode & kUpb_LabelFlags_IsExtension; |
| 910 | } |
| 911 | |
| 912 | UPB_API_INLINE bool upb_MiniTableField_IsClosedEnum( |
| 913 | const upb_MiniTableField* field) { |
| 914 | return field->UPB_PRIVATE(descriptortype) == kUpb_FieldType_Enum; |
| 915 | } |
| 916 | |
| 917 | UPB_API_INLINE bool upb_MiniTableField_HasPresence( |
| 918 | const upb_MiniTableField* field) { |
| 919 | if (upb_MiniTableField_IsExtension(field)) { |
| 920 | return !upb_IsRepeatedOrMap(field); |
| 921 | } else { |
| 922 | return field->presence != 0; |
| 923 | } |
| 924 | } |
| 925 | |
| 926 | #ifdef __cplusplus |
| 927 | } /* extern "C" */ |
| 928 | #endif |
| 929 | |
| 930 | |
| 931 | #endif /* UPB_MINI_TABLE_FIELD_H_ */ |
| 932 | |
| 933 | // Must be last. |
| 934 | |
| 935 | #ifdef __cplusplus |
| 936 | extern "C" { |
| 937 | #endif |
| 938 | |
| 939 | typedef struct upb_MiniTable upb_MiniTable; |
| 940 | |
| 941 | UPB_API const upb_MiniTableField* upb_MiniTable_FindFieldByNumber( |
| 942 | const upb_MiniTable* table, uint32_t number); |
| 943 | |
| 944 | UPB_API_INLINE const upb_MiniTableField* upb_MiniTable_GetFieldByIndex( |
| 945 | const upb_MiniTable* t, uint32_t index) { |
| 946 | return &t->fields[index]; |
| 947 | } |
| 948 | |
| 949 | // Returns the MiniTable for this message field. If the field is unlinked, |
| 950 | // returns NULL. |
| 951 | UPB_API_INLINE const upb_MiniTable* upb_MiniTable_GetSubMessageTable( |
| 952 | const upb_MiniTable* mini_table, const upb_MiniTableField* field) { |
| 953 | UPB_ASSERT(upb_MiniTableField_CType(field) == kUpb_CType_Message); |
| 954 | const upb_MiniTable* ret = |
| 955 | mini_table->subs[field->UPB_PRIVATE(submsg_index)].submsg; |
| 956 | UPB_ASSUME(ret); |
| 957 | return ret == &_kUpb_MiniTable_Empty ? NULL : ret; |
| 958 | } |
| 959 | |
| 960 | // Returns the MiniTableEnum for this enum field. If the field is unlinked, |
| 961 | // returns NULL. |
| 962 | UPB_API_INLINE const upb_MiniTableEnum* upb_MiniTable_GetSubEnumTable( |
| 963 | const upb_MiniTable* mini_table, const upb_MiniTableField* field) { |
| 964 | UPB_ASSERT(upb_MiniTableField_CType(field) == kUpb_CType_Enum); |
| 965 | return mini_table->subs[field->UPB_PRIVATE(submsg_index)].subenum; |
| 966 | } |
| 967 | |
| 968 | // Returns true if this MiniTable field is linked to a MiniTable for the |
| 969 | // sub-message. |
| 970 | UPB_API_INLINE bool upb_MiniTable_MessageFieldIsLinked( |
| 971 | const upb_MiniTable* mini_table, const upb_MiniTableField* field) { |
| 972 | return upb_MiniTable_GetSubMessageTable(mini_table, field) != NULL; |
| 973 | } |
| 974 | |
| 975 | // If this field is in a oneof, returns the first field in the oneof. |
| 976 | // |
| 977 | // Otherwise returns NULL. |
| 978 | // |
| 979 | // Usage: |
| 980 | // const upb_MiniTableField* field = upb_MiniTable_GetOneof(m, f); |
| 981 | // do { |
| 982 | // .. |
| 983 | // } while (upb_MiniTable_NextOneofField(m, &field); |
| 984 | // |
| 985 | const upb_MiniTableField* upb_MiniTable_GetOneof(const upb_MiniTable* m, |
| 986 | const upb_MiniTableField* f); |
| 987 | |
| 988 | // Iterates to the next field in the oneof. If this is the last field in the |
| 989 | // oneof, returns false. The ordering of fields in the oneof is not |
| 990 | // guaranteed. |
| 991 | // REQUIRES: |f| is the field initialized by upb_MiniTable_GetOneof and updated |
| 992 | // by prior upb_MiniTable_NextOneofField calls. |
| 993 | bool upb_MiniTable_NextOneofField(const upb_MiniTable* m, |
| 994 | const upb_MiniTableField** f); |
| 995 | |
| 996 | #ifdef __cplusplus |
| 997 | } /* extern "C" */ |
| 998 | #endif |
| 999 | |
| 1000 | |
| 1001 | #endif /* UPB_MINI_TABLE_MESSAGE_H_ */ |
| 1002 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1003 | // Must be last. |
| 1004 | |
| 1005 | typedef struct upb_Array upb_Array; |
| 1006 | typedef struct upb_Map upb_Map; |
| 1007 | |
| 1008 | typedef union { |
| 1009 | bool bool_val; |
| 1010 | float float_val; |
| 1011 | double double_val; |
| 1012 | int32_t int32_val; |
| 1013 | int64_t int64_val; |
| 1014 | uint32_t uint32_val; |
| 1015 | uint64_t uint64_val; |
| 1016 | const upb_Array* array_val; |
| 1017 | const upb_Map* map_val; |
| 1018 | const upb_Message* msg_val; |
| 1019 | upb_StringView str_val; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 1020 | |
| 1021 | // EXPERIMENTAL: A tagged upb_Message*. Users must use this instead of |
| 1022 | // msg_val if unlinked sub-messages may possibly be in use. See the |
| 1023 | // documentation in kUpb_DecodeOption_ExperimentalAllowUnlinked for more |
| 1024 | // information. |
| 1025 | upb_TaggedMessagePtr tagged_msg_val; |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1026 | } upb_MessageValue; |
| 1027 | |
| 1028 | typedef union { |
| 1029 | upb_Array* array; |
| 1030 | upb_Map* map; |
| 1031 | upb_Message* msg; |
| 1032 | } upb_MutableMessageValue; |
| 1033 | |
| 1034 | |
| 1035 | #endif /* UPB_MESSAGE_VALUE_H_ */ |
| 1036 | |
| 1037 | /* upb_Arena is a specific allocator implementation that uses arena allocation. |
| 1038 | * The user provides an allocator that will be used to allocate the underlying |
| 1039 | * arena blocks. Arenas by nature do not require the individual allocations |
| 1040 | * to be freed. However the Arena does allow users to register cleanup |
| 1041 | * functions that will run when the arena is destroyed. |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 1042 | * |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1043 | * A upb_Arena is *not* thread-safe. |
| 1044 | * |
| 1045 | * You could write a thread-safe arena allocator that satisfies the |
| 1046 | * upb_alloc interface, but it would not be as efficient for the |
| 1047 | * single-threaded case. */ |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1048 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 1049 | #ifndef UPB_MEM_ARENA_H_ |
| 1050 | #define UPB_MEM_ARENA_H_ |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 1051 | |
Adam Cozzette | 7d5592e | 2023-08-23 12:15:26 -0700 | [diff] [blame] | 1052 | #include <stddef.h> |
| 1053 | #include <stdint.h> |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1054 | #include <string.h> |
| 1055 | |
| 1056 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 1057 | #ifndef UPB_MEM_ALLOC_H_ |
| 1058 | #define UPB_MEM_ALLOC_H_ |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1059 | |
| 1060 | // Must be last. |
| 1061 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1062 | #ifdef __cplusplus |
| 1063 | extern "C" { |
| 1064 | #endif |
| 1065 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1066 | typedef struct upb_alloc upb_alloc; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1067 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1068 | /* A combined `malloc()`/`free()` function. |
| 1069 | * If `size` is 0 then the function acts like `free()`, otherwise it acts like |
| 1070 | * `realloc()`. Only `oldsize` bytes from a previous allocation are |
| 1071 | * preserved. */ |
| 1072 | typedef void* upb_alloc_func(upb_alloc* alloc, void* ptr, size_t oldsize, |
| 1073 | size_t size); |
| 1074 | |
| 1075 | /* A upb_alloc is a possibly-stateful allocator object. |
| 1076 | * |
| 1077 | * It could either be an arena allocator (which doesn't require individual |
| 1078 | * `free()` calls) or a regular `malloc()` (which does). The client must |
| 1079 | * therefore free memory unless it knows that the allocator is an arena |
| 1080 | * allocator. */ |
| 1081 | struct upb_alloc { |
| 1082 | upb_alloc_func* func; |
| 1083 | }; |
| 1084 | |
| 1085 | UPB_INLINE void* upb_malloc(upb_alloc* alloc, size_t size) { |
| 1086 | UPB_ASSERT(alloc); |
| 1087 | return alloc->func(alloc, NULL, 0, size); |
| 1088 | } |
| 1089 | |
| 1090 | UPB_INLINE void* upb_realloc(upb_alloc* alloc, void* ptr, size_t oldsize, |
| 1091 | size_t size) { |
| 1092 | UPB_ASSERT(alloc); |
| 1093 | return alloc->func(alloc, ptr, oldsize, size); |
| 1094 | } |
| 1095 | |
| 1096 | UPB_INLINE void upb_free(upb_alloc* alloc, void* ptr) { |
| 1097 | UPB_ASSERT(alloc); |
| 1098 | alloc->func(alloc, ptr, 0, 0); |
| 1099 | } |
| 1100 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 1101 | // The global allocator used by upb. Uses the standard malloc()/free(). |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1102 | |
| 1103 | extern upb_alloc upb_alloc_global; |
| 1104 | |
| 1105 | /* Functions that hard-code the global malloc. |
| 1106 | * |
| 1107 | * We still get benefit because we can put custom logic into our global |
| 1108 | * allocator, like injecting out-of-memory faults in debug/testing builds. */ |
| 1109 | |
| 1110 | UPB_INLINE void* upb_gmalloc(size_t size) { |
| 1111 | return upb_malloc(&upb_alloc_global, size); |
| 1112 | } |
| 1113 | |
| 1114 | UPB_INLINE void* upb_grealloc(void* ptr, size_t oldsize, size_t size) { |
| 1115 | return upb_realloc(&upb_alloc_global, ptr, oldsize, size); |
| 1116 | } |
| 1117 | |
| 1118 | UPB_INLINE void upb_gfree(void* ptr) { upb_free(&upb_alloc_global, ptr); } |
| 1119 | |
| 1120 | #ifdef __cplusplus |
| 1121 | } /* extern "C" */ |
| 1122 | #endif |
| 1123 | |
| 1124 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 1125 | #endif /* UPB_MEM_ALLOC_H_ */ |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1126 | |
| 1127 | // Must be last. |
| 1128 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1129 | typedef struct upb_Arena upb_Arena; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1130 | |
| 1131 | typedef struct { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1132 | char *ptr, *end; |
| 1133 | } _upb_ArenaHead; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1134 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1135 | #ifdef __cplusplus |
| 1136 | extern "C" { |
| 1137 | #endif |
| 1138 | |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 1139 | // Creates an arena from the given initial block (if any -- n may be 0). |
| 1140 | // Additional blocks will be allocated from |alloc|. If |alloc| is NULL, this |
| 1141 | // is a fixed-size arena and cannot grow. |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 1142 | 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] | 1143 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 1144 | UPB_API void upb_Arena_Free(upb_Arena* a); |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 1145 | UPB_API bool upb_Arena_Fuse(upb_Arena* a, upb_Arena* b); |
| 1146 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1147 | void* _upb_Arena_SlowMalloc(upb_Arena* a, size_t size); |
| 1148 | size_t upb_Arena_SpaceAllocated(upb_Arena* arena); |
| 1149 | uint32_t upb_Arena_DebugRefCount(upb_Arena* arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1150 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1151 | UPB_INLINE size_t _upb_ArenaHas(upb_Arena* a) { |
| 1152 | _upb_ArenaHead* h = (_upb_ArenaHead*)a; |
| 1153 | return (size_t)(h->end - h->ptr); |
| 1154 | } |
| 1155 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 1156 | 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] | 1157 | size = UPB_ALIGN_MALLOC(size); |
Sandy Zhang | e3b0943 | 2023-08-07 09:30:02 -0700 | [diff] [blame] | 1158 | size_t span = size + UPB_ASAN_GUARD_SIZE; |
| 1159 | if (UPB_UNLIKELY(_upb_ArenaHas(a) < span)) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1160 | return _upb_Arena_SlowMalloc(a, size); |
| 1161 | } |
| 1162 | |
| 1163 | // We have enough space to do a fast malloc. |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1164 | _upb_ArenaHead* h = (_upb_ArenaHead*)a; |
| 1165 | void* ret = h->ptr; |
| 1166 | UPB_ASSERT(UPB_ALIGN_MALLOC((uintptr_t)ret) == (uintptr_t)ret); |
| 1167 | UPB_ASSERT(UPB_ALIGN_MALLOC(size) == size); |
| 1168 | UPB_UNPOISON_MEMORY_REGION(ret, size); |
| 1169 | |
Sandy Zhang | e3b0943 | 2023-08-07 09:30:02 -0700 | [diff] [blame] | 1170 | h->ptr += span; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1171 | |
| 1172 | return ret; |
| 1173 | } |
| 1174 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1175 | // Shrinks the last alloc from arena. |
| 1176 | // REQUIRES: (ptr, oldsize) was the last malloc/realloc from this arena. |
| 1177 | // We could also add a upb_Arena_TryShrinkLast() which is simply a no-op if |
| 1178 | // this was not the last alloc. |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 1179 | UPB_API_INLINE void upb_Arena_ShrinkLast(upb_Arena* a, void* ptr, |
| 1180 | size_t oldsize, size_t size) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1181 | _upb_ArenaHead* h = (_upb_ArenaHead*)a; |
| 1182 | oldsize = UPB_ALIGN_MALLOC(oldsize); |
| 1183 | size = UPB_ALIGN_MALLOC(size); |
Sandy Zhang | e3b0943 | 2023-08-07 09:30:02 -0700 | [diff] [blame] | 1184 | // Must be the last alloc. |
| 1185 | UPB_ASSERT((char*)ptr + oldsize == h->ptr - UPB_ASAN_GUARD_SIZE); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1186 | UPB_ASSERT(size <= oldsize); |
| 1187 | h->ptr = (char*)ptr + size; |
| 1188 | } |
| 1189 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 1190 | UPB_API_INLINE void* upb_Arena_Realloc(upb_Arena* a, void* ptr, size_t oldsize, |
| 1191 | size_t size) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1192 | _upb_ArenaHead* h = (_upb_ArenaHead*)a; |
| 1193 | oldsize = UPB_ALIGN_MALLOC(oldsize); |
| 1194 | size = UPB_ALIGN_MALLOC(size); |
| 1195 | bool is_most_recent_alloc = (uintptr_t)ptr + oldsize == (uintptr_t)h->ptr; |
| 1196 | |
| 1197 | if (is_most_recent_alloc) { |
| 1198 | ptrdiff_t diff = size - oldsize; |
| 1199 | if ((ptrdiff_t)_upb_ArenaHas(a) >= diff) { |
| 1200 | h->ptr += diff; |
| 1201 | return ptr; |
| 1202 | } |
| 1203 | } else if (size <= oldsize) { |
| 1204 | return ptr; |
| 1205 | } |
| 1206 | |
| 1207 | void* ret = upb_Arena_Malloc(a, size); |
| 1208 | |
| 1209 | if (ret && oldsize > 0) { |
| 1210 | memcpy(ret, ptr, UPB_MIN(oldsize, size)); |
| 1211 | } |
| 1212 | |
| 1213 | return ret; |
| 1214 | } |
| 1215 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 1216 | UPB_API_INLINE upb_Arena* upb_Arena_New(void) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1217 | return upb_Arena_Init(NULL, 0, &upb_alloc_global); |
| 1218 | } |
| 1219 | |
| 1220 | #ifdef __cplusplus |
| 1221 | } /* extern "C" */ |
| 1222 | #endif |
| 1223 | |
| 1224 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 1225 | #endif /* UPB_MEM_ARENA_H_ */ |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1226 | |
| 1227 | // Must be last. |
| 1228 | |
| 1229 | #ifdef __cplusplus |
| 1230 | extern "C" { |
| 1231 | #endif |
| 1232 | |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 1233 | // Creates a new array on the given arena that holds elements of this type. |
| 1234 | 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] | 1235 | |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 1236 | // Returns the number of elements in the array. |
| 1237 | UPB_API size_t upb_Array_Size(const upb_Array* arr); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1238 | |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 1239 | // Returns the given element, which must be within the array's current size. |
| 1240 | 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] | 1241 | |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 1242 | // Sets the given element, which must be within the array's current size. |
| 1243 | 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] | 1244 | |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 1245 | // Appends an element to the array. Returns false on allocation failure. |
| 1246 | UPB_API bool upb_Array_Append(upb_Array* array, upb_MessageValue val, |
| 1247 | upb_Arena* arena); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1248 | |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 1249 | // Moves elements within the array using memmove(). |
| 1250 | // Like memmove(), the source and destination elements may be overlapping. |
| 1251 | UPB_API void upb_Array_Move(upb_Array* array, size_t dst_idx, size_t src_idx, |
| 1252 | size_t count); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1253 | |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 1254 | // Inserts one or more empty elements into the array. |
| 1255 | // Existing elements are shifted right. |
| 1256 | // The new elements have undefined state and must be set with `upb_Array_Set()`. |
| 1257 | // REQUIRES: `i <= upb_Array_Size(arr)` |
| 1258 | UPB_API bool upb_Array_Insert(upb_Array* array, size_t i, size_t count, |
| 1259 | upb_Arena* arena); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1260 | |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 1261 | // Deletes one or more elements from the array. |
| 1262 | // Existing elements are shifted left. |
| 1263 | // REQUIRES: `i + count <= upb_Array_Size(arr)` |
| 1264 | 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] | 1265 | |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 1266 | // Changes the size of a vector. New elements are initialized to NULL/0. |
| 1267 | // Returns false on allocation failure. |
| 1268 | 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] | 1269 | |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 1270 | // Returns pointer to array data. |
| 1271 | UPB_API const void* upb_Array_DataPtr(const upb_Array* arr); |
| 1272 | |
| 1273 | // Returns mutable pointer to array data. |
| 1274 | UPB_API void* upb_Array_MutableDataPtr(upb_Array* arr); |
| 1275 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1276 | #ifdef __cplusplus |
| 1277 | } /* extern "C" */ |
| 1278 | #endif |
| 1279 | |
| 1280 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 1281 | #endif /* UPB_COLLECTIONS_ARRAY_H_ */ |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1282 | |
| 1283 | // Must be last. |
| 1284 | |
| 1285 | #ifdef __cplusplus |
| 1286 | extern "C" { |
| 1287 | #endif |
| 1288 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1289 | // LINT.IfChange(struct_definition) |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 1290 | // Our internal representation for repeated fields. |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1291 | struct upb_Array { |
| 1292 | uintptr_t data; /* Tagged ptr: low 3 bits of ptr are lg2(elem size). */ |
| 1293 | size_t size; /* The number of elements in the array. */ |
| 1294 | size_t capacity; /* Allocated storage. Measured in elements. */ |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1295 | }; |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1296 | // LINT.ThenChange(GoogleInternalName1) |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1297 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 1298 | UPB_INLINE size_t _upb_Array_ElementSizeLg2(const upb_Array* arr) { |
| 1299 | size_t ret = arr->data & 7; |
| 1300 | UPB_ASSERT(ret <= 4); |
| 1301 | return ret; |
| 1302 | } |
| 1303 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1304 | UPB_INLINE const void* _upb_array_constptr(const upb_Array* arr) { |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 1305 | _upb_Array_ElementSizeLg2(arr); // Check assertion. |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1306 | return (void*)(arr->data & ~(uintptr_t)7); |
| 1307 | } |
| 1308 | |
| 1309 | UPB_INLINE uintptr_t _upb_array_tagptr(void* ptr, int elem_size_lg2) { |
| 1310 | UPB_ASSERT(elem_size_lg2 <= 4); |
| 1311 | return (uintptr_t)ptr | elem_size_lg2; |
| 1312 | } |
| 1313 | |
| 1314 | UPB_INLINE void* _upb_array_ptr(upb_Array* arr) { |
| 1315 | return (void*)_upb_array_constptr(arr); |
| 1316 | } |
| 1317 | |
| 1318 | UPB_INLINE uintptr_t _upb_tag_arrptr(void* ptr, int elem_size_lg2) { |
| 1319 | UPB_ASSERT(elem_size_lg2 <= 4); |
| 1320 | UPB_ASSERT(((uintptr_t)ptr & 7) == 0); |
| 1321 | return (uintptr_t)ptr | (unsigned)elem_size_lg2; |
| 1322 | } |
| 1323 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 1324 | extern const char _upb_Array_CTypeSizeLg2Table[]; |
| 1325 | |
| 1326 | UPB_INLINE size_t _upb_Array_CTypeSizeLg2(upb_CType ctype) { |
| 1327 | return _upb_Array_CTypeSizeLg2Table[ctype]; |
| 1328 | } |
| 1329 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1330 | UPB_INLINE upb_Array* _upb_Array_New(upb_Arena* a, size_t init_capacity, |
| 1331 | int elem_size_lg2) { |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 1332 | UPB_ASSERT(elem_size_lg2 <= 4); |
Joshua Haberman | 7755973 | 2022-10-03 11:13:05 -0700 | [diff] [blame] | 1333 | const size_t arr_size = UPB_ALIGN_UP(sizeof(upb_Array), UPB_MALLOC_ALIGN); |
| 1334 | const size_t bytes = arr_size + (init_capacity << elem_size_lg2); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1335 | upb_Array* arr = (upb_Array*)upb_Arena_Malloc(a, bytes); |
| 1336 | if (!arr) return NULL; |
| 1337 | arr->data = _upb_tag_arrptr(UPB_PTR_AT(arr, arr_size, void), elem_size_lg2); |
| 1338 | arr->size = 0; |
| 1339 | arr->capacity = init_capacity; |
| 1340 | return arr; |
| 1341 | } |
| 1342 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 1343 | // Resizes the capacity of the array to be at least min_size. |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1344 | bool _upb_array_realloc(upb_Array* arr, size_t min_size, upb_Arena* arena); |
| 1345 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1346 | UPB_INLINE bool _upb_array_reserve(upb_Array* arr, size_t size, |
| 1347 | upb_Arena* arena) { |
| 1348 | if (arr->capacity < size) return _upb_array_realloc(arr, size, arena); |
| 1349 | return true; |
| 1350 | } |
| 1351 | |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 1352 | // Resize without initializing new elements. |
| 1353 | UPB_INLINE bool _upb_Array_ResizeUninitialized(upb_Array* arr, size_t size, |
| 1354 | upb_Arena* arena) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 1355 | UPB_ASSERT(size <= arr->size || arena); // Allow NULL arena when shrinking. |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1356 | if (!_upb_array_reserve(arr, size, arena)) return false; |
| 1357 | arr->size = size; |
| 1358 | return true; |
| 1359 | } |
| 1360 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 1361 | // This function is intended for situations where elem_size is compile-time |
| 1362 | // constant or a known expression of the form (1 << lg2), so that the expression |
| 1363 | // i*elem_size does not result in an actual multiplication. |
| 1364 | UPB_INLINE void _upb_Array_Set(upb_Array* arr, size_t i, const void* data, |
| 1365 | size_t elem_size) { |
| 1366 | UPB_ASSERT(i < arr->size); |
| 1367 | UPB_ASSERT(elem_size == 1U << _upb_Array_ElementSizeLg2(arr)); |
| 1368 | char* arr_data = (char*)_upb_array_ptr(arr); |
| 1369 | memcpy(arr_data + (i * elem_size), data, elem_size); |
| 1370 | } |
| 1371 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1372 | UPB_INLINE void _upb_array_detach(const void* msg, size_t ofs) { |
| 1373 | *UPB_PTR_AT(msg, ofs, upb_Array*) = NULL; |
| 1374 | } |
| 1375 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1376 | #ifdef __cplusplus |
| 1377 | } /* extern "C" */ |
| 1378 | #endif |
| 1379 | |
| 1380 | |
Adam Cozzette | 8059da2 | 2023-08-16 07:57:14 -0700 | [diff] [blame] | 1381 | #endif /* UPB_COLLECTIONS_INTERNAL_ARRAY_H_ */ |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1382 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 1383 | #ifndef UPB_COLLECTIONS_MAP_H_ |
| 1384 | #define UPB_COLLECTIONS_MAP_H_ |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1385 | |
| 1386 | |
| 1387 | // Must be last. |
| 1388 | |
| 1389 | #ifdef __cplusplus |
| 1390 | extern "C" { |
| 1391 | #endif |
| 1392 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 1393 | // Creates a new map on the given arena with the given key/value size. |
| 1394 | UPB_API upb_Map* upb_Map_New(upb_Arena* a, upb_CType key_type, |
| 1395 | upb_CType value_type); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1396 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 1397 | // Returns the number of entries in the map. |
| 1398 | UPB_API size_t upb_Map_Size(const upb_Map* map); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1399 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 1400 | // Stores a value for the given key into |*val| (or the zero value if the key is |
| 1401 | // not present). Returns whether the key was present. The |val| pointer may be |
| 1402 | // NULL, in which case the function tests whether the given key is present. |
| 1403 | UPB_API bool upb_Map_Get(const upb_Map* map, upb_MessageValue key, |
| 1404 | upb_MessageValue* val); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1405 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 1406 | // Removes all entries in the map. |
| 1407 | UPB_API void upb_Map_Clear(upb_Map* map); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1408 | |
| 1409 | typedef enum { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1410 | kUpb_MapInsertStatus_Inserted = 0, |
| 1411 | kUpb_MapInsertStatus_Replaced = 1, |
| 1412 | kUpb_MapInsertStatus_OutOfMemory = 2, |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1413 | } upb_MapInsertStatus; |
| 1414 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 1415 | // Sets the given key to the given value, returning whether the key was inserted |
| 1416 | // or replaced. If the key was inserted, then any existing iterators will be |
| 1417 | // invalidated. |
| 1418 | UPB_API upb_MapInsertStatus upb_Map_Insert(upb_Map* map, upb_MessageValue key, |
| 1419 | upb_MessageValue val, |
| 1420 | upb_Arena* arena); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1421 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 1422 | // Sets the given key to the given value. Returns false if memory allocation |
| 1423 | // failed. If the key is newly inserted, then any existing iterators will be |
| 1424 | // invalidated. |
| 1425 | UPB_API_INLINE bool upb_Map_Set(upb_Map* map, upb_MessageValue key, |
| 1426 | upb_MessageValue val, upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1427 | return upb_Map_Insert(map, key, val, arena) != |
| 1428 | kUpb_MapInsertStatus_OutOfMemory; |
| 1429 | } |
| 1430 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1431 | // Deletes this key from the table. Returns true if the key was present. |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 1432 | // If present and |val| is non-NULL, stores the deleted value. |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 1433 | UPB_API bool upb_Map_Delete(upb_Map* map, upb_MessageValue key, |
| 1434 | upb_MessageValue* val); |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 1435 | |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 1436 | // (DEPRECATED and going away soon. Do not use.) |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 1437 | UPB_INLINE bool upb_Map_Delete2(upb_Map* map, upb_MessageValue key, |
| 1438 | upb_MessageValue* val) { |
| 1439 | return upb_Map_Delete(map, key, val); |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 1440 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1441 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1442 | // Map iteration: |
| 1443 | // |
| 1444 | // size_t iter = kUpb_Map_Begin; |
| 1445 | // upb_MessageValue key, val; |
| 1446 | // while (upb_Map_Next(map, &key, &val, &iter)) { |
| 1447 | // ... |
| 1448 | // } |
| 1449 | |
| 1450 | #define kUpb_Map_Begin ((size_t)-1) |
| 1451 | |
| 1452 | // Advances to the next entry. Returns false if no more entries are present. |
| 1453 | // Otherwise returns true and populates both *key and *value. |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 1454 | UPB_API bool upb_Map_Next(const upb_Map* map, upb_MessageValue* key, |
| 1455 | upb_MessageValue* val, size_t* iter); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1456 | |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 1457 | // Sets the value for the entry pointed to by iter. |
| 1458 | // WARNING: this does not currently work for string values! |
| 1459 | UPB_API void upb_Map_SetEntryValue(upb_Map* map, size_t iter, |
| 1460 | upb_MessageValue val); |
| 1461 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1462 | // DEPRECATED iterator, slated for removal. |
| 1463 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1464 | /* Map iteration: |
| 1465 | * |
| 1466 | * size_t iter = kUpb_Map_Begin; |
| 1467 | * while (upb_MapIterator_Next(map, &iter)) { |
| 1468 | * upb_MessageValue key = upb_MapIterator_Key(map, iter); |
| 1469 | * upb_MessageValue val = upb_MapIterator_Value(map, iter); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1470 | * } |
| 1471 | */ |
| 1472 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1473 | // Advances to the next entry. Returns false if no more entries are present. |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 1474 | UPB_API bool upb_MapIterator_Next(const upb_Map* map, size_t* iter); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1475 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 1476 | // Returns true if the iterator still points to a valid entry, or false if the |
| 1477 | // iterator is past the last element. It is an error to call this function with |
| 1478 | // kUpb_Map_Begin (you must call next() at least once first). |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 1479 | UPB_API bool upb_MapIterator_Done(const upb_Map* map, size_t iter); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1480 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 1481 | // Returns the key and value for this entry of the map. |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 1482 | UPB_API upb_MessageValue upb_MapIterator_Key(const upb_Map* map, size_t iter); |
| 1483 | UPB_API upb_MessageValue upb_MapIterator_Value(const upb_Map* map, size_t iter); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1484 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1485 | #ifdef __cplusplus |
| 1486 | } /* extern "C" */ |
| 1487 | #endif |
| 1488 | |
| 1489 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 1490 | #endif /* UPB_COLLECTIONS_MAP_H_ */ |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1491 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1492 | // EVERYTHING BELOW THIS LINE IS INTERNAL - DO NOT USE ///////////////////////// |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1493 | |
Adam Cozzette | 8059da2 | 2023-08-16 07:57:14 -0700 | [diff] [blame] | 1494 | #ifndef UPB_COLLECTIONS_INTERNAL_MAP_H_ |
| 1495 | #define UPB_COLLECTIONS_INTERNAL_MAP_H_ |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1496 | |
| 1497 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1498 | #ifndef UPB_HASH_STR_TABLE_H_ |
| 1499 | #define UPB_HASH_STR_TABLE_H_ |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1500 | |
| 1501 | |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 1502 | /* |
| 1503 | * upb_table |
| 1504 | * |
| 1505 | * This header is INTERNAL-ONLY! Its interfaces are not public or stable! |
| 1506 | * This file defines very fast int->upb_value (inttable) and string->upb_value |
| 1507 | * (strtable) hash tables. |
| 1508 | * |
| 1509 | * The table uses chained scatter with Brent's variation (inspired by the Lua |
| 1510 | * implementation of hash tables). The hash function for strings is Austin |
| 1511 | * Appleby's "MurmurHash." |
| 1512 | * |
| 1513 | * The inttable uses uintptr_t as its key, which guarantees it can be used to |
| 1514 | * store pointers or integers of at least 32 bits (upb isn't really useful on |
| 1515 | * systems where sizeof(void*) < 4). |
| 1516 | * |
| 1517 | * The table must be homogeneous (all values of the same type). In debug |
| 1518 | * mode, we check this on insert and lookup. |
| 1519 | */ |
| 1520 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1521 | #ifndef UPB_HASH_COMMON_H_ |
| 1522 | #define UPB_HASH_COMMON_H_ |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 1523 | |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 1524 | #include <string.h> |
| 1525 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1526 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1527 | // Must be last. |
| 1528 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1529 | #ifdef __cplusplus |
| 1530 | extern "C" { |
| 1531 | #endif |
| 1532 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1533 | /* upb_value ******************************************************************/ |
| 1534 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1535 | typedef struct { |
| 1536 | uint64_t val; |
| 1537 | } upb_value; |
| 1538 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1539 | /* Variant that works with a length-delimited rather than NULL-delimited string, |
| 1540 | * as supported by strtable. */ |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1541 | char* upb_strdup2(const char* s, size_t len, upb_Arena* a); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1542 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1543 | UPB_INLINE void _upb_value_setval(upb_value* v, uint64_t val) { v->val = val; } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1544 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1545 | /* For each value ctype, define the following set of functions: |
| 1546 | * |
| 1547 | * // Get/set an int32 from a upb_value. |
| 1548 | * int32_t upb_value_getint32(upb_value val); |
| 1549 | * void upb_value_setint32(upb_value *val, int32_t cval); |
| 1550 | * |
| 1551 | * // Construct a new upb_value from an int32. |
| 1552 | * upb_value upb_value_int32(int32_t val); */ |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1553 | #define FUNCS(name, membername, type_t, converter, proto_type) \ |
| 1554 | UPB_INLINE void upb_value_set##name(upb_value* val, type_t cval) { \ |
| 1555 | val->val = (converter)cval; \ |
| 1556 | } \ |
| 1557 | UPB_INLINE upb_value upb_value_##name(type_t val) { \ |
| 1558 | upb_value ret; \ |
| 1559 | upb_value_set##name(&ret, val); \ |
| 1560 | return ret; \ |
| 1561 | } \ |
| 1562 | UPB_INLINE type_t upb_value_get##name(upb_value val) { \ |
| 1563 | return (type_t)(converter)val.val; \ |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1564 | } |
| 1565 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1566 | FUNCS(int32, int32, int32_t, int32_t, UPB_CTYPE_INT32) |
| 1567 | FUNCS(int64, int64, int64_t, int64_t, UPB_CTYPE_INT64) |
| 1568 | FUNCS(uint32, uint32, uint32_t, uint32_t, UPB_CTYPE_UINT32) |
| 1569 | FUNCS(uint64, uint64, uint64_t, uint64_t, UPB_CTYPE_UINT64) |
| 1570 | FUNCS(bool, _bool, bool, bool, UPB_CTYPE_BOOL) |
| 1571 | FUNCS(cstr, cstr, char*, uintptr_t, UPB_CTYPE_CSTR) |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 1572 | FUNCS(uintptr, uptr, uintptr_t, uintptr_t, UPB_CTYPE_UPTR) |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1573 | FUNCS(ptr, ptr, void*, uintptr_t, UPB_CTYPE_PTR) |
| 1574 | FUNCS(constptr, constptr, const void*, uintptr_t, UPB_CTYPE_CONSTPTR) |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1575 | |
| 1576 | #undef FUNCS |
| 1577 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1578 | UPB_INLINE void upb_value_setfloat(upb_value* val, float cval) { |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1579 | memcpy(&val->val, &cval, sizeof(cval)); |
| 1580 | } |
| 1581 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1582 | UPB_INLINE void upb_value_setdouble(upb_value* val, double cval) { |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1583 | memcpy(&val->val, &cval, sizeof(cval)); |
| 1584 | } |
| 1585 | |
| 1586 | UPB_INLINE upb_value upb_value_float(float cval) { |
| 1587 | upb_value ret; |
| 1588 | upb_value_setfloat(&ret, cval); |
| 1589 | return ret; |
| 1590 | } |
| 1591 | |
| 1592 | UPB_INLINE upb_value upb_value_double(double cval) { |
| 1593 | upb_value ret; |
| 1594 | upb_value_setdouble(&ret, cval); |
| 1595 | return ret; |
| 1596 | } |
| 1597 | |
| 1598 | #undef SET_TYPE |
| 1599 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1600 | /* upb_tabkey *****************************************************************/ |
| 1601 | |
| 1602 | /* Either: |
| 1603 | * 1. an actual integer key, or |
| 1604 | * 2. a pointer to a string prefixed by its uint32_t length, owned by us. |
| 1605 | * |
| 1606 | * ...depending on whether this is a string table or an int table. We would |
| 1607 | * make this a union of those two types, but C89 doesn't support statically |
| 1608 | * initializing a non-first union member. */ |
| 1609 | typedef uintptr_t upb_tabkey; |
| 1610 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1611 | UPB_INLINE char* upb_tabstr(upb_tabkey key, uint32_t* len) { |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1612 | char* mem = (char*)key; |
| 1613 | if (len) memcpy(len, mem, sizeof(*len)); |
| 1614 | return mem + sizeof(*len); |
| 1615 | } |
| 1616 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1617 | UPB_INLINE upb_StringView upb_tabstrview(upb_tabkey key) { |
| 1618 | upb_StringView ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1619 | uint32_t len; |
| 1620 | ret.data = upb_tabstr(key, &len); |
| 1621 | ret.size = len; |
| 1622 | return ret; |
| 1623 | } |
| 1624 | |
| 1625 | /* upb_tabval *****************************************************************/ |
| 1626 | |
| 1627 | typedef struct upb_tabval { |
| 1628 | uint64_t val; |
| 1629 | } upb_tabval; |
| 1630 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1631 | #define UPB_TABVALUE_EMPTY_INIT \ |
| 1632 | { -1 } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1633 | |
| 1634 | /* upb_table ******************************************************************/ |
| 1635 | |
| 1636 | typedef struct _upb_tabent { |
| 1637 | upb_tabkey key; |
| 1638 | upb_tabval val; |
| 1639 | |
| 1640 | /* Internal chaining. This is const so we can create static initializers for |
| 1641 | * tables. We cast away const sometimes, but *only* when the containing |
| 1642 | * upb_table is known to be non-const. This requires a bit of care, but |
| 1643 | * the subtlety is confined to table.c. */ |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1644 | const struct _upb_tabent* next; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1645 | } upb_tabent; |
| 1646 | |
| 1647 | typedef struct { |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1648 | size_t count; /* Number of entries in the hash part. */ |
| 1649 | uint32_t mask; /* Mask to turn hash value -> bucket. */ |
| 1650 | uint32_t max_count; /* Max count before we hit our load limit. */ |
| 1651 | uint8_t size_lg2; /* Size of the hashtable part is 2^size_lg2 entries. */ |
| 1652 | upb_tabent* entries; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1653 | } upb_table; |
| 1654 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1655 | UPB_INLINE size_t upb_table_size(const upb_table* t) { |
| 1656 | return t->size_lg2 ? 1 << t->size_lg2 : 0; |
| 1657 | } |
| 1658 | |
| 1659 | // Internal-only functions, in .h file only out of necessity. |
Mike Kruskal | 04e8135 | 2022-11-23 11:07:53 -0800 | [diff] [blame] | 1660 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1661 | UPB_INLINE bool upb_tabent_isempty(const upb_tabent* e) { return e->key == 0; } |
| 1662 | |
Mike Kruskal | 04e8135 | 2022-11-23 11:07:53 -0800 | [diff] [blame] | 1663 | uint32_t _upb_Hash(const void* p, size_t n, uint64_t seed); |
| 1664 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1665 | #ifdef __cplusplus |
| 1666 | } /* extern "C" */ |
| 1667 | #endif |
| 1668 | |
| 1669 | |
| 1670 | #endif /* UPB_HASH_COMMON_H_ */ |
| 1671 | |
| 1672 | // Must be last. |
| 1673 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1674 | typedef struct { |
| 1675 | upb_table t; |
| 1676 | } upb_strtable; |
| 1677 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1678 | #ifdef __cplusplus |
| 1679 | extern "C" { |
| 1680 | #endif |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1681 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1682 | // Initialize a table. If memory allocation failed, false is returned and |
| 1683 | // the table is uninitialized. |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1684 | bool upb_strtable_init(upb_strtable* table, size_t expected_size, upb_Arena* a); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1685 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1686 | // Returns the number of values in the table. |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1687 | UPB_INLINE size_t upb_strtable_count(const upb_strtable* t) { |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1688 | return t->t.count; |
| 1689 | } |
| 1690 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1691 | void upb_strtable_clear(upb_strtable* t); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1692 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1693 | // Inserts the given key into the hashtable with the given value. |
| 1694 | // The key must not already exist in the hash table. The key is not required |
| 1695 | // to be NULL-terminated, and the table will make an internal copy of the key. |
| 1696 | // |
| 1697 | // If a table resize was required but memory allocation failed, false is |
| 1698 | // returned and the table is unchanged. */ |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1699 | bool upb_strtable_insert(upb_strtable* t, const char* key, size_t len, |
| 1700 | upb_value val, upb_Arena* a); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1701 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1702 | // Looks up key in this table, returning "true" if the key was found. |
| 1703 | // If v is non-NULL, copies the value for this key into *v. |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1704 | bool upb_strtable_lookup2(const upb_strtable* t, const char* key, size_t len, |
| 1705 | upb_value* v); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1706 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1707 | // For NULL-terminated strings. |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1708 | UPB_INLINE bool upb_strtable_lookup(const upb_strtable* t, const char* key, |
| 1709 | upb_value* v) { |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1710 | return upb_strtable_lookup2(t, key, strlen(key), v); |
| 1711 | } |
| 1712 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1713 | // Removes an item from the table. Returns true if the remove was successful, |
| 1714 | // and stores the removed item in *val if non-NULL. |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1715 | bool upb_strtable_remove2(upb_strtable* t, const char* key, size_t len, |
| 1716 | upb_value* val); |
| 1717 | |
| 1718 | UPB_INLINE bool upb_strtable_remove(upb_strtable* t, const char* key, |
| 1719 | upb_value* v) { |
| 1720 | return upb_strtable_remove2(t, key, strlen(key), v); |
| 1721 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1722 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1723 | // Exposed for testing only. |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1724 | bool upb_strtable_resize(upb_strtable* t, size_t size_lg2, upb_Arena* a); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1725 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1726 | /* Iteration over strtable: |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1727 | * |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1728 | * intptr_t iter = UPB_STRTABLE_BEGIN; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1729 | * upb_StringView key; |
| 1730 | * upb_value val; |
| 1731 | * while (upb_strtable_next2(t, &key, &val, &iter)) { |
| 1732 | * // ... |
| 1733 | * } |
| 1734 | */ |
| 1735 | |
| 1736 | #define UPB_STRTABLE_BEGIN -1 |
| 1737 | |
| 1738 | bool upb_strtable_next2(const upb_strtable* t, upb_StringView* key, |
| 1739 | upb_value* val, intptr_t* iter); |
| 1740 | void upb_strtable_removeiter(upb_strtable* t, intptr_t* iter); |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 1741 | void upb_strtable_setentryvalue(upb_strtable* t, intptr_t iter, upb_value v); |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1742 | |
| 1743 | /* DEPRECATED iterators, slated for removal. |
| 1744 | * |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1745 | * Iterators for string tables. We are subject to some kind of unusual |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1746 | * design constraints: |
| 1747 | * |
| 1748 | * For high-level languages: |
| 1749 | * - we must be able to guarantee that we don't crash or corrupt memory even if |
| 1750 | * the program accesses an invalidated iterator. |
| 1751 | * |
| 1752 | * For C++11 range-based for: |
| 1753 | * - iterators must be copyable |
| 1754 | * - iterators must be comparable |
| 1755 | * - it must be possible to construct an "end" value. |
| 1756 | * |
| 1757 | * Iteration order is undefined. |
| 1758 | * |
| 1759 | * Modifying the table invalidates iterators. upb_{str,int}table_done() is |
| 1760 | * guaranteed to work even on an invalidated iterator, as long as the table it |
| 1761 | * is iterating over has not been freed. Calling next() or accessing data from |
| 1762 | * an invalidated iterator yields unspecified elements from the table, but it is |
| 1763 | * guaranteed not to crash and to return real table elements (except when done() |
| 1764 | * is true). */ |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1765 | /* upb_strtable_iter **********************************************************/ |
| 1766 | |
| 1767 | /* upb_strtable_iter i; |
| 1768 | * upb_strtable_begin(&i, t); |
| 1769 | * for(; !upb_strtable_done(&i); upb_strtable_next(&i)) { |
| 1770 | * const char *key = upb_strtable_iter_key(&i); |
| 1771 | * const upb_value val = upb_strtable_iter_value(&i); |
| 1772 | * // ... |
| 1773 | * } |
| 1774 | */ |
| 1775 | |
| 1776 | typedef struct { |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1777 | const upb_strtable* t; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1778 | size_t index; |
| 1779 | } upb_strtable_iter; |
| 1780 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1781 | UPB_INLINE const upb_tabent* str_tabent(const upb_strtable_iter* i) { |
| 1782 | return &i->t->t.entries[i->index]; |
| 1783 | } |
| 1784 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1785 | void upb_strtable_begin(upb_strtable_iter* i, const upb_strtable* t); |
| 1786 | void upb_strtable_next(upb_strtable_iter* i); |
| 1787 | bool upb_strtable_done(const upb_strtable_iter* i); |
| 1788 | upb_StringView upb_strtable_iter_key(const upb_strtable_iter* i); |
| 1789 | upb_value upb_strtable_iter_value(const upb_strtable_iter* i); |
| 1790 | void upb_strtable_iter_setdone(upb_strtable_iter* i); |
| 1791 | bool upb_strtable_iter_isequal(const upb_strtable_iter* i1, |
| 1792 | const upb_strtable_iter* i2); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1793 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1794 | #ifdef __cplusplus |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1795 | } /* extern "C" */ |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1796 | #endif |
| 1797 | |
| 1798 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1799 | #endif /* UPB_HASH_STR_TABLE_H_ */ |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1800 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1801 | // Must be last. |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1802 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1803 | struct upb_Map { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1804 | // Size of key and val, based on the map type. |
| 1805 | // Strings are represented as '0' because they must be handled specially. |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1806 | char key_size; |
| 1807 | char val_size; |
| 1808 | |
| 1809 | upb_strtable table; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1810 | }; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1811 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1812 | #ifdef __cplusplus |
| 1813 | extern "C" { |
| 1814 | #endif |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1815 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1816 | // Converting between internal table representation and user values. |
| 1817 | // |
| 1818 | // _upb_map_tokey() and _upb_map_fromkey() are inverses. |
| 1819 | // _upb_map_tovalue() and _upb_map_fromvalue() are inverses. |
| 1820 | // |
| 1821 | // These functions account for the fact that strings are treated differently |
| 1822 | // from other types when stored in a map. |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1823 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1824 | UPB_INLINE upb_StringView _upb_map_tokey(const void* key, size_t size) { |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1825 | if (size == UPB_MAPTYPE_STRING) { |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1826 | return *(upb_StringView*)key; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1827 | } else { |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1828 | return upb_StringView_FromDataAndSize((const char*)key, size); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1829 | } |
| 1830 | } |
| 1831 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1832 | UPB_INLINE void _upb_map_fromkey(upb_StringView key, void* out, size_t size) { |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1833 | if (size == UPB_MAPTYPE_STRING) { |
| 1834 | memcpy(out, &key, sizeof(key)); |
| 1835 | } else { |
| 1836 | memcpy(out, key.data, size); |
| 1837 | } |
| 1838 | } |
| 1839 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1840 | UPB_INLINE bool _upb_map_tovalue(const void* val, size_t size, |
| 1841 | upb_value* msgval, upb_Arena* a) { |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1842 | if (size == UPB_MAPTYPE_STRING) { |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1843 | upb_StringView* strp = (upb_StringView*)upb_Arena_Malloc(a, sizeof(*strp)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1844 | if (!strp) return false; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1845 | *strp = *(upb_StringView*)val; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1846 | *msgval = upb_value_ptr(strp); |
| 1847 | } else { |
| 1848 | memcpy(msgval, val, size); |
| 1849 | } |
| 1850 | return true; |
| 1851 | } |
| 1852 | |
| 1853 | UPB_INLINE void _upb_map_fromvalue(upb_value val, void* out, size_t size) { |
| 1854 | if (size == UPB_MAPTYPE_STRING) { |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1855 | const upb_StringView* strp = (const upb_StringView*)upb_value_getptr(val); |
| 1856 | memcpy(out, strp, sizeof(upb_StringView)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1857 | } else { |
| 1858 | memcpy(out, &val, size); |
| 1859 | } |
| 1860 | } |
| 1861 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1862 | UPB_INLINE void* _upb_map_next(const upb_Map* map, size_t* iter) { |
| 1863 | upb_strtable_iter it; |
| 1864 | it.t = &map->table; |
| 1865 | it.index = *iter; |
| 1866 | upb_strtable_next(&it); |
| 1867 | *iter = it.index; |
| 1868 | if (upb_strtable_done(&it)) return NULL; |
| 1869 | return (void*)str_tabent(&it); |
| 1870 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1871 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1872 | UPB_INLINE void _upb_Map_Clear(upb_Map* map) { |
| 1873 | upb_strtable_clear(&map->table); |
| 1874 | } |
| 1875 | |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 1876 | UPB_INLINE bool _upb_Map_Delete(upb_Map* map, const void* key, size_t key_size, |
| 1877 | upb_value* val) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1878 | upb_StringView k = _upb_map_tokey(key, key_size); |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 1879 | return upb_strtable_remove2(&map->table, k.data, k.size, val); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1880 | } |
| 1881 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1882 | UPB_INLINE bool _upb_Map_Get(const upb_Map* map, const void* key, |
| 1883 | size_t key_size, void* val, size_t val_size) { |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1884 | upb_value tabval; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1885 | upb_StringView k = _upb_map_tokey(key, key_size); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1886 | bool ret = upb_strtable_lookup2(&map->table, k.data, k.size, &tabval); |
| 1887 | if (ret && val) { |
| 1888 | _upb_map_fromvalue(tabval, val, val_size); |
| 1889 | } |
| 1890 | return ret; |
| 1891 | } |
| 1892 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1893 | UPB_INLINE upb_MapInsertStatus _upb_Map_Insert(upb_Map* map, const void* key, |
| 1894 | size_t key_size, void* val, |
| 1895 | size_t val_size, upb_Arena* a) { |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1896 | upb_StringView strkey = _upb_map_tokey(key, key_size); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1897 | upb_value tabval = {0}; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1898 | if (!_upb_map_tovalue(val, val_size, &tabval, a)) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1899 | return kUpb_MapInsertStatus_OutOfMemory; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1900 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1901 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1902 | // TODO(haberman): add overwrite operation to minimize number of lookups. |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1903 | bool removed = |
| 1904 | upb_strtable_remove2(&map->table, strkey.data, strkey.size, NULL); |
| 1905 | if (!upb_strtable_insert(&map->table, strkey.data, strkey.size, tabval, a)) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1906 | return kUpb_MapInsertStatus_OutOfMemory; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1907 | } |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1908 | return removed ? kUpb_MapInsertStatus_Replaced |
| 1909 | : kUpb_MapInsertStatus_Inserted; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1910 | } |
| 1911 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1912 | UPB_INLINE size_t _upb_Map_Size(const upb_Map* map) { |
| 1913 | return map->table.t.count; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1914 | } |
| 1915 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 1916 | // Strings/bytes are special-cased in maps. |
| 1917 | extern char _upb_Map_CTypeSizeTable[12]; |
| 1918 | |
| 1919 | UPB_INLINE size_t _upb_Map_CTypeSize(upb_CType ctype) { |
| 1920 | return _upb_Map_CTypeSizeTable[ctype]; |
| 1921 | } |
| 1922 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1923 | // Creates a new map on the given arena with this key/value type. |
| 1924 | upb_Map* _upb_Map_New(upb_Arena* a, size_t key_size, size_t value_size); |
| 1925 | |
| 1926 | #ifdef __cplusplus |
| 1927 | } /* extern "C" */ |
| 1928 | #endif |
| 1929 | |
| 1930 | |
Adam Cozzette | 8059da2 | 2023-08-16 07:57:14 -0700 | [diff] [blame] | 1931 | #endif /* UPB_COLLECTIONS_INTERNAL_MAP_H_ */ |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 1932 | |
| 1933 | // EVERYTHING BELOW THIS LINE IS INTERNAL - DO NOT USE ///////////////////////// |
| 1934 | |
Adam Cozzette | 8059da2 | 2023-08-16 07:57:14 -0700 | [diff] [blame] | 1935 | #ifndef UPB_COLLECTIONS_INTERNAL_MAP_SORTER_H_ |
| 1936 | #define UPB_COLLECTIONS_INTERNAL_MAP_SORTER_H_ |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 1937 | |
| 1938 | #include <stdlib.h> |
| 1939 | |
| 1940 | |
Protobuf Team Bot | dcc1f61 | 2023-09-05 21:56:25 +0000 | [diff] [blame] | 1941 | #ifndef UPB_COLLECTIONS_INTERNAL_MAP_ENTRY_H_ |
| 1942 | #define UPB_COLLECTIONS_INTERNAL_MAP_ENTRY_H_ |
| 1943 | |
| 1944 | |
| 1945 | #ifndef UPB_MINI_TABLE_INTERNAL_TYPES_H_ |
| 1946 | #define UPB_MINI_TABLE_INTERNAL_TYPES_H_ |
| 1947 | |
| 1948 | typedef struct upb_Message_InternalData upb_Message_InternalData; |
| 1949 | |
| 1950 | typedef struct { |
| 1951 | union { |
| 1952 | upb_Message_InternalData* internal; |
| 1953 | |
| 1954 | // Force 8-byte alignment, since the data members may contain members that |
| 1955 | // require 8-byte alignment. |
| 1956 | double d; |
| 1957 | }; |
| 1958 | } upb_Message_Internal; |
| 1959 | |
| 1960 | #endif // UPB_MINI_TABLE_INTERNAL_TYPES_H_ |
| 1961 | |
| 1962 | // Map entries aren't actually stored for map fields, they are only used during |
| 1963 | // parsing. For parsing, it helps a lot if all map entry messages have the same |
| 1964 | // layout. The layout code in mini_table/decode.c will ensure that all map |
| 1965 | // entries have this layout. |
| 1966 | // |
| 1967 | // Note that users can and do create map entries directly, which will also use |
| 1968 | // this layout. |
| 1969 | // |
| 1970 | // NOTE: sync with wire/decode.c. |
| 1971 | typedef struct { |
| 1972 | // We only need 2 hasbits max, but due to alignment we'll use 8 bytes here, |
| 1973 | // and the uint64_t helps make this clear. |
| 1974 | uint64_t hasbits; |
| 1975 | union { |
| 1976 | upb_StringView str; // For str/bytes. |
| 1977 | upb_value val; // For all other types. |
| 1978 | } k; |
| 1979 | union { |
| 1980 | upb_StringView str; // For str/bytes. |
| 1981 | upb_value val; // For all other types. |
| 1982 | } v; |
| 1983 | } upb_MapEntryData; |
| 1984 | |
| 1985 | typedef struct { |
| 1986 | upb_Message_Internal internal; |
| 1987 | upb_MapEntryData data; |
| 1988 | } upb_MapEntry; |
| 1989 | |
| 1990 | #endif // UPB_COLLECTIONS_INTERNAL_MAP_ENTRY_H_ |
| 1991 | |
Adam Cozzette | 8059da2 | 2023-08-16 07:57:14 -0700 | [diff] [blame] | 1992 | #ifndef UPB_MESSAGE_INTERNAL_EXTENSION_H_ |
| 1993 | #define UPB_MESSAGE_INTERNAL_EXTENSION_H_ |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 1994 | |
| 1995 | |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 1996 | // Public APIs for message operations that do not depend on the schema. |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1997 | // |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 1998 | // MiniTable-based accessors live in accessors.h. |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1999 | |
| 2000 | #ifndef UPB_MESSAGE_MESSAGE_H_ |
| 2001 | #define UPB_MESSAGE_MESSAGE_H_ |
| 2002 | |
Protobuf Team Bot | 75af7f9 | 2023-09-06 18:07:53 +0000 | [diff] [blame] | 2003 | #include <stddef.h> |
| 2004 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2005 | |
| 2006 | // Must be last. |
| 2007 | |
| 2008 | #ifdef __cplusplus |
| 2009 | extern "C" { |
| 2010 | #endif |
| 2011 | |
| 2012 | // 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] | 2013 | UPB_API upb_Message* upb_Message_New(const upb_MiniTable* mini_table, |
| 2014 | upb_Arena* arena); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2015 | |
| 2016 | // Adds unknown data (serialized protobuf data) to the given message. |
| 2017 | // The data is copied into the message instance. |
| 2018 | void upb_Message_AddUnknown(upb_Message* msg, const char* data, size_t len, |
| 2019 | upb_Arena* arena); |
| 2020 | |
| 2021 | // Returns a reference to the message's unknown data. |
| 2022 | const char* upb_Message_GetUnknown(const upb_Message* msg, size_t* len); |
| 2023 | |
| 2024 | // Removes partial unknown data from message. |
| 2025 | void upb_Message_DeleteUnknown(upb_Message* msg, const char* data, size_t len); |
| 2026 | |
| 2027 | // Returns the number of extensions present in this message. |
| 2028 | size_t upb_Message_ExtensionCount(const upb_Message* msg); |
| 2029 | |
| 2030 | #ifdef __cplusplus |
| 2031 | } /* extern "C" */ |
| 2032 | #endif |
| 2033 | |
| 2034 | |
| 2035 | #endif /* UPB_MESSAGE_MESSAGE_H_ */ |
| 2036 | |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 2037 | #ifndef UPB_MINI_TABLE_EXTENSION_H_ |
| 2038 | #define UPB_MINI_TABLE_EXTENSION_H_ |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2039 | |
| 2040 | |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 2041 | #ifndef UPB_MINI_TABLE_INTERNAL_EXTENSION_H_ |
| 2042 | #define UPB_MINI_TABLE_INTERNAL_EXTENSION_H_ |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2043 | |
| 2044 | |
| 2045 | // Must be last. |
| 2046 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2047 | struct upb_MiniTableExtension { |
Deanna Garcia | 59cfc2f | 2023-01-31 13:19:28 -0800 | [diff] [blame] | 2048 | // 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] | 2049 | struct upb_MiniTableField field; |
Deanna Garcia | 59cfc2f | 2023-01-31 13:19:28 -0800 | [diff] [blame] | 2050 | |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 2051 | const struct upb_MiniTable* extendee; |
| 2052 | union upb_MiniTableSub sub; // NULL unless submessage or proto2 enum |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2053 | }; |
| 2054 | |
| 2055 | |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 2056 | #endif /* UPB_MINI_TABLE_INTERNAL_EXTENSION_H_ */ |
| 2057 | |
| 2058 | // Must be last. |
| 2059 | |
| 2060 | typedef struct upb_MiniTableExtension upb_MiniTableExtension; |
| 2061 | |
| 2062 | |
| 2063 | #endif /* UPB_MINI_TABLE_EXTENSION_H_ */ |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2064 | |
| 2065 | // Must be last. |
| 2066 | |
| 2067 | // The internal representation of an extension is self-describing: it contains |
| 2068 | // enough information that we can serialize it to binary format without needing |
| 2069 | // to look it up in a upb_ExtensionRegistry. |
| 2070 | // |
| 2071 | // This representation allocates 16 bytes to data on 64-bit platforms. |
| 2072 | // This is rather wasteful for scalars (in the extreme case of bool, |
| 2073 | // it wastes 15 bytes). We accept this because we expect messages to be |
| 2074 | // the most common extension type. |
| 2075 | typedef struct { |
| 2076 | const upb_MiniTableExtension* ext; |
| 2077 | union { |
| 2078 | upb_StringView str; |
| 2079 | void* ptr; |
| 2080 | char scalar_data[8]; |
| 2081 | } data; |
| 2082 | } upb_Message_Extension; |
| 2083 | |
| 2084 | #ifdef __cplusplus |
| 2085 | extern "C" { |
| 2086 | #endif |
| 2087 | |
| 2088 | // Adds the given extension data to the given message. |
| 2089 | // |ext| is copied into the message instance. |
| 2090 | // This logically replaces any previously-added extension with this number. |
| 2091 | upb_Message_Extension* _upb_Message_GetOrCreateExtension( |
| 2092 | upb_Message* msg, const upb_MiniTableExtension* ext, upb_Arena* arena); |
| 2093 | |
| 2094 | // Returns an array of extensions for this message. |
| 2095 | // Note: the array is ordered in reverse relative to the order of creation. |
| 2096 | const upb_Message_Extension* _upb_Message_Getexts(const upb_Message* msg, |
| 2097 | size_t* count); |
| 2098 | |
| 2099 | // Returns an extension for the given field number, or NULL if no extension |
| 2100 | // exists for this field number. |
| 2101 | const upb_Message_Extension* _upb_Message_Getext( |
| 2102 | const upb_Message* msg, const upb_MiniTableExtension* ext); |
| 2103 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2104 | #ifdef __cplusplus |
| 2105 | } /* extern "C" */ |
| 2106 | #endif |
| 2107 | |
| 2108 | |
Adam Cozzette | 8059da2 | 2023-08-16 07:57:14 -0700 | [diff] [blame] | 2109 | #endif /* UPB_MESSAGE_INTERNAL_EXTENSION_H_ */ |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2110 | |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 2111 | // Must be last. |
| 2112 | |
| 2113 | #ifdef __cplusplus |
| 2114 | extern "C" { |
| 2115 | #endif |
| 2116 | |
| 2117 | // _upb_mapsorter sorts maps and provides ordered iteration over the entries. |
| 2118 | // Since maps can be recursive (map values can be messages which contain other |
| 2119 | // maps), _upb_mapsorter can contain a stack of maps. |
| 2120 | |
| 2121 | typedef struct { |
| 2122 | void const** entries; |
| 2123 | int size; |
| 2124 | int cap; |
| 2125 | } _upb_mapsorter; |
| 2126 | |
| 2127 | typedef struct { |
| 2128 | int start; |
| 2129 | int pos; |
| 2130 | int end; |
| 2131 | } _upb_sortedmap; |
| 2132 | |
| 2133 | UPB_INLINE void _upb_mapsorter_init(_upb_mapsorter* s) { |
| 2134 | s->entries = NULL; |
| 2135 | s->size = 0; |
| 2136 | s->cap = 0; |
| 2137 | } |
| 2138 | |
| 2139 | UPB_INLINE void _upb_mapsorter_destroy(_upb_mapsorter* s) { |
| 2140 | if (s->entries) free(s->entries); |
| 2141 | } |
| 2142 | |
| 2143 | UPB_INLINE bool _upb_sortedmap_next(_upb_mapsorter* s, const upb_Map* map, |
| 2144 | _upb_sortedmap* sorted, upb_MapEntry* ent) { |
| 2145 | if (sorted->pos == sorted->end) return false; |
| 2146 | const upb_tabent* tabent = (const upb_tabent*)s->entries[sorted->pos++]; |
| 2147 | upb_StringView key = upb_tabstrview(tabent->key); |
| 2148 | _upb_map_fromkey(key, &ent->data.k, map->key_size); |
| 2149 | upb_value val = {tabent->val.val}; |
| 2150 | _upb_map_fromvalue(val, &ent->data.v, map->val_size); |
| 2151 | return true; |
| 2152 | } |
| 2153 | |
| 2154 | UPB_INLINE bool _upb_sortedmap_nextext(_upb_mapsorter* s, |
| 2155 | _upb_sortedmap* sorted, |
| 2156 | const upb_Message_Extension** ext) { |
| 2157 | if (sorted->pos == sorted->end) return false; |
| 2158 | *ext = (const upb_Message_Extension*)s->entries[sorted->pos++]; |
| 2159 | return true; |
| 2160 | } |
| 2161 | |
| 2162 | UPB_INLINE void _upb_mapsorter_popmap(_upb_mapsorter* s, |
| 2163 | _upb_sortedmap* sorted) { |
| 2164 | s->size = sorted->start; |
| 2165 | } |
| 2166 | |
| 2167 | bool _upb_mapsorter_pushmap(_upb_mapsorter* s, upb_FieldType key_type, |
| 2168 | const upb_Map* map, _upb_sortedmap* sorted); |
| 2169 | |
| 2170 | bool _upb_mapsorter_pushexts(_upb_mapsorter* s, |
| 2171 | const upb_Message_Extension* exts, size_t count, |
| 2172 | _upb_sortedmap* sorted); |
| 2173 | |
| 2174 | #ifdef __cplusplus |
| 2175 | } /* extern "C" */ |
| 2176 | #endif |
| 2177 | |
| 2178 | |
Adam Cozzette | 8059da2 | 2023-08-16 07:57:14 -0700 | [diff] [blame] | 2179 | #endif /* UPB_COLLECTIONS_INTERNAL_MAP_SORTER_H_ */ |
| 2180 | |
| 2181 | #ifndef UPB_BASE_LOG2_H_ |
| 2182 | #define UPB_BASE_LOG2_H_ |
| 2183 | |
| 2184 | // Must be last. |
| 2185 | |
| 2186 | #ifdef __cplusplus |
| 2187 | extern "C" { |
| 2188 | #endif |
| 2189 | |
| 2190 | UPB_INLINE int upb_Log2Ceiling(int x) { |
| 2191 | if (x <= 1) return 0; |
| 2192 | #ifdef __GNUC__ |
| 2193 | return 32 - __builtin_clz(x - 1); |
| 2194 | #else |
| 2195 | int lg2 = 0; |
| 2196 | while ((1 << lg2) < x) lg2++; |
| 2197 | return lg2; |
| 2198 | #endif |
| 2199 | } |
| 2200 | |
| 2201 | UPB_INLINE int upb_Log2CeilingSize(int x) { return 1 << upb_Log2Ceiling(x); } |
| 2202 | |
| 2203 | #ifdef __cplusplus |
| 2204 | } /* extern "C" */ |
| 2205 | #endif |
| 2206 | |
| 2207 | |
| 2208 | #endif /* UPB_BASE_LOG2_H_ */ |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 2209 | |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 2210 | #ifndef UPB_GENERATED_CODE_SUPPORT_H_ |
| 2211 | #define UPB_GENERATED_CODE_SUPPORT_H_ |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 2212 | |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 2213 | // IWYU pragma: begin_exports |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 2214 | |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 2215 | // These functions are only used by generated code. |
| 2216 | |
| 2217 | #ifndef UPB_COLLECTIONS_MAP_GENCODE_UTIL_H_ |
| 2218 | #define UPB_COLLECTIONS_MAP_GENCODE_UTIL_H_ |
| 2219 | |
| 2220 | |
| 2221 | // Must be last. |
| 2222 | |
| 2223 | #ifdef __cplusplus |
| 2224 | extern "C" { |
| 2225 | #endif |
| 2226 | |
| 2227 | // Message map operations, these get the map from the message first. |
| 2228 | |
| 2229 | UPB_INLINE void _upb_msg_map_key(const void* msg, void* key, size_t size) { |
| 2230 | const upb_tabent* ent = (const upb_tabent*)msg; |
| 2231 | uint32_t u32len; |
| 2232 | upb_StringView k; |
| 2233 | k.data = upb_tabstr(ent->key, &u32len); |
| 2234 | k.size = u32len; |
| 2235 | _upb_map_fromkey(k, key, size); |
| 2236 | } |
| 2237 | |
| 2238 | UPB_INLINE void _upb_msg_map_value(const void* msg, void* val, size_t size) { |
| 2239 | const upb_tabent* ent = (const upb_tabent*)msg; |
| 2240 | upb_value v = {ent->val.val}; |
| 2241 | _upb_map_fromvalue(v, val, size); |
| 2242 | } |
| 2243 | |
| 2244 | UPB_INLINE void _upb_msg_map_set_value(void* msg, const void* val, |
| 2245 | size_t size) { |
| 2246 | upb_tabent* ent = (upb_tabent*)msg; |
| 2247 | // This is like _upb_map_tovalue() except the entry already exists |
| 2248 | // so we can reuse the allocated upb_StringView for string fields. |
| 2249 | if (size == UPB_MAPTYPE_STRING) { |
| 2250 | upb_StringView* strp = (upb_StringView*)(uintptr_t)ent->val.val; |
| 2251 | memcpy(strp, val, sizeof(*strp)); |
| 2252 | } else { |
| 2253 | memcpy(&ent->val.val, val, size); |
| 2254 | } |
| 2255 | } |
| 2256 | |
| 2257 | #ifdef __cplusplus |
| 2258 | } /* extern "C" */ |
| 2259 | #endif |
| 2260 | |
| 2261 | |
| 2262 | #endif /* UPB_COLLECTIONS_MAP_GENCODE_UTIL_H_ */ |
| 2263 | |
Sandy Zhang | e3b0943 | 2023-08-07 09:30:02 -0700 | [diff] [blame] | 2264 | #ifndef UPB_MESSAGE_ACCESSORS_H_ |
| 2265 | #define UPB_MESSAGE_ACCESSORS_H_ |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 2266 | |
Sandy Zhang | e3b0943 | 2023-08-07 09:30:02 -0700 | [diff] [blame] | 2267 | |
Adam Cozzette | 8059da2 | 2023-08-16 07:57:14 -0700 | [diff] [blame] | 2268 | #ifndef UPB_MESSAGE_INTERNAL_ACCESSORS_H_ |
| 2269 | #define UPB_MESSAGE_INTERNAL_ACCESSORS_H_ |
| 2270 | |
| 2271 | |
Sandy Zhang | e3b0943 | 2023-08-07 09:30:02 -0700 | [diff] [blame] | 2272 | /* |
| 2273 | ** Our memory representation for parsing tables and messages themselves. |
| 2274 | ** Functions in this file are used by generated code and possibly reflection. |
| 2275 | ** |
| 2276 | ** The definitions in this file are internal to upb. |
| 2277 | **/ |
| 2278 | |
| 2279 | #ifndef UPB_MESSAGE_INTERNAL_H_ |
| 2280 | #define UPB_MESSAGE_INTERNAL_H_ |
| 2281 | |
| 2282 | #include <stdlib.h> |
| 2283 | #include <string.h> |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 2284 | |
| 2285 | |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 2286 | #ifndef UPB_MINI_TABLE_EXTENSION_REGISTRY_H_ |
| 2287 | #define UPB_MINI_TABLE_EXTENSION_REGISTRY_H_ |
| 2288 | |
| 2289 | |
| 2290 | // Must be last. |
| 2291 | |
| 2292 | #ifdef __cplusplus |
| 2293 | extern "C" { |
| 2294 | #endif |
| 2295 | |
| 2296 | /* Extension registry: a dynamic data structure that stores a map of: |
| 2297 | * (upb_MiniTable, number) -> extension info |
| 2298 | * |
| 2299 | * upb_decode() uses upb_ExtensionRegistry to look up extensions while parsing |
| 2300 | * binary format. |
| 2301 | * |
| 2302 | * upb_ExtensionRegistry is part of the mini-table (msglayout) family of |
| 2303 | * objects. Like all mini-table objects, it is suitable for reflection-less |
| 2304 | * builds that do not want to expose names into the binary. |
| 2305 | * |
| 2306 | * Unlike most mini-table types, upb_ExtensionRegistry requires dynamic memory |
| 2307 | * allocation and dynamic initialization: |
| 2308 | * * If reflection is being used, then upb_DefPool will construct an appropriate |
| 2309 | * upb_ExtensionRegistry automatically. |
| 2310 | * * For a mini-table only build, the user must manually construct the |
| 2311 | * upb_ExtensionRegistry and populate it with all of the extensions the user |
| 2312 | * cares about. |
| 2313 | * * A third alternative is to manually unpack relevant extensions after the |
| 2314 | * main parse is complete, similar to how Any works. This is perhaps the |
| 2315 | * nicest solution from the perspective of reducing dependencies, avoiding |
| 2316 | * dynamic memory allocation, and avoiding the need to parse uninteresting |
| 2317 | * extensions. The downsides are: |
| 2318 | * (1) parse errors are not caught during the main parse |
| 2319 | * (2) the CPU hit of parsing comes during access, which could cause an |
| 2320 | * undesirable stutter in application performance. |
| 2321 | * |
| 2322 | * Users cannot directly get or put into this map. Users can only add the |
| 2323 | * extensions from a generated module and pass the extension registry to the |
| 2324 | * binary decoder. |
| 2325 | * |
| 2326 | * A upb_DefPool provides a upb_ExtensionRegistry, so any users who use |
| 2327 | * reflection do not need to populate a upb_ExtensionRegistry directly. |
| 2328 | */ |
| 2329 | |
| 2330 | typedef struct upb_ExtensionRegistry upb_ExtensionRegistry; |
| 2331 | |
| 2332 | // Creates a upb_ExtensionRegistry in the given arena. |
| 2333 | // The arena must outlive any use of the extreg. |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2334 | UPB_API upb_ExtensionRegistry* upb_ExtensionRegistry_New(upb_Arena* arena); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 2335 | |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 2336 | UPB_API bool upb_ExtensionRegistry_Add(upb_ExtensionRegistry* r, |
| 2337 | const upb_MiniTableExtension* e); |
| 2338 | |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 2339 | // Adds the given extension info for the array |e| of size |count| into the |
| 2340 | // registry. If there are any errors, the entire array is backed out. |
| 2341 | // The extensions must outlive the registry. |
| 2342 | // Possible errors include OOM or an extension number that already exists. |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 2343 | // TODO(salo): There is currently no way to know the exact reason for failure. |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 2344 | bool upb_ExtensionRegistry_AddArray(upb_ExtensionRegistry* r, |
| 2345 | const upb_MiniTableExtension** e, |
| 2346 | size_t count); |
| 2347 | |
| 2348 | // Looks up the extension (if any) defined for message type |t| and field |
| 2349 | // number |num|. Returns the extension if found, otherwise NULL. |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 2350 | UPB_API const upb_MiniTableExtension* upb_ExtensionRegistry_Lookup( |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 2351 | const upb_ExtensionRegistry* r, const upb_MiniTable* t, uint32_t num); |
| 2352 | |
| 2353 | #ifdef __cplusplus |
| 2354 | } /* extern "C" */ |
| 2355 | #endif |
| 2356 | |
| 2357 | |
| 2358 | #endif /* UPB_MINI_TABLE_EXTENSION_REGISTRY_H_ */ |
| 2359 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2360 | // Must be last. |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 2361 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2362 | #ifdef __cplusplus |
| 2363 | extern "C" { |
| 2364 | #endif |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 2365 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2366 | extern const float kUpb_FltInfinity; |
| 2367 | extern const double kUpb_Infinity; |
| 2368 | extern const double kUpb_NaN; |
| 2369 | |
| 2370 | /* Internal members of a upb_Message that track unknown fields and/or |
| 2371 | * extensions. We can change this without breaking binary compatibility. We put |
| 2372 | * these before the user's data. The user's upb_Message* points after the |
| 2373 | * upb_Message_Internal. */ |
| 2374 | |
Protobuf Team Bot | dcc1f61 | 2023-09-05 21:56:25 +0000 | [diff] [blame] | 2375 | struct upb_Message_InternalData { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2376 | /* Total size of this structure, including the data that follows. |
| 2377 | * Must be aligned to 8, which is alignof(upb_Message_Extension) */ |
| 2378 | uint32_t size; |
| 2379 | |
| 2380 | /* Offsets relative to the beginning of this structure. |
| 2381 | * |
| 2382 | * Unknown data grows forward from the beginning to unknown_end. |
| 2383 | * Extension data grows backward from size to ext_begin. |
| 2384 | * When the two meet, we're out of data and have to realloc. |
| 2385 | * |
| 2386 | * If we imagine that the final member of this struct is: |
| 2387 | * char data[size - overhead]; // overhead = |
| 2388 | * sizeof(upb_Message_InternalData) |
| 2389 | * |
| 2390 | * Then we have: |
| 2391 | * unknown data: data[0 .. (unknown_end - overhead)] |
| 2392 | * extensions data: data[(ext_begin - overhead) .. (size - overhead)] */ |
| 2393 | uint32_t unknown_end; |
| 2394 | uint32_t ext_begin; |
| 2395 | /* Data follows, as if there were an array: |
| 2396 | * char data[size - sizeof(upb_Message_InternalData)]; */ |
Protobuf Team Bot | dcc1f61 | 2023-09-05 21:56:25 +0000 | [diff] [blame] | 2397 | }; |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2398 | |
| 2399 | /* Maps upb_CType -> memory size. */ |
| 2400 | extern char _upb_CTypeo_size[12]; |
| 2401 | |
| 2402 | UPB_INLINE size_t upb_msg_sizeof(const upb_MiniTable* t) { |
| 2403 | return t->size + sizeof(upb_Message_Internal); |
| 2404 | } |
| 2405 | |
| 2406 | // Inline version upb_Message_New(), for internal use. |
| 2407 | UPB_INLINE upb_Message* _upb_Message_New(const upb_MiniTable* mini_table, |
| 2408 | upb_Arena* arena) { |
| 2409 | size_t size = upb_msg_sizeof(mini_table); |
| 2410 | void* mem = upb_Arena_Malloc(arena, size + sizeof(upb_Message_Internal)); |
| 2411 | if (UPB_UNLIKELY(!mem)) return NULL; |
| 2412 | upb_Message* msg = UPB_PTR_AT(mem, sizeof(upb_Message_Internal), upb_Message); |
| 2413 | memset(mem, 0, size); |
| 2414 | return msg; |
| 2415 | } |
| 2416 | |
| 2417 | UPB_INLINE upb_Message_Internal* upb_Message_Getinternal( |
| 2418 | const upb_Message* msg) { |
| 2419 | ptrdiff_t size = sizeof(upb_Message_Internal); |
| 2420 | return (upb_Message_Internal*)((char*)msg - size); |
| 2421 | } |
| 2422 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2423 | // Discards the unknown fields for this message only. |
| 2424 | void _upb_Message_DiscardUnknown_shallow(upb_Message* msg); |
| 2425 | |
| 2426 | // Adds unknown data (serialized protobuf data) to the given message. |
| 2427 | // The data is copied into the message instance. |
| 2428 | bool _upb_Message_AddUnknown(upb_Message* msg, const char* data, size_t len, |
| 2429 | upb_Arena* arena); |
| 2430 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2431 | #ifdef __cplusplus |
| 2432 | } /* extern "C" */ |
| 2433 | #endif |
| 2434 | |
| 2435 | |
| 2436 | #endif /* UPB_MESSAGE_INTERNAL_H_ */ |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 2437 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2438 | // Must be last. |
| 2439 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 2440 | #if defined(__GNUC__) && !defined(__clang__) |
| 2441 | // GCC raises incorrect warnings in these functions. It thinks that we are |
| 2442 | // overrunning buffers, but we carefully write the functions in this file to |
| 2443 | // guarantee that this is impossible. GCC gets this wrong due it its failure |
| 2444 | // to perform constant propagation as we expect: |
| 2445 | // - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108217 |
| 2446 | // - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108226 |
| 2447 | // |
| 2448 | // Unfortunately this also indicates that GCC is not optimizing away the |
| 2449 | // switch() in cases where it should be, compromising the performance. |
| 2450 | #pragma GCC diagnostic push |
| 2451 | #pragma GCC diagnostic ignored "-Warray-bounds" |
| 2452 | #pragma GCC diagnostic ignored "-Wstringop-overflow" |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 2453 | #if __GNUC__ >= 11 |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 2454 | #pragma GCC diagnostic ignored "-Wstringop-overread" |
| 2455 | #endif |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 2456 | #endif |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 2457 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2458 | #ifdef __cplusplus |
| 2459 | extern "C" { |
| 2460 | #endif |
| 2461 | |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 2462 | // LINT.IfChange(presence_logic) |
| 2463 | |
| 2464 | // Hasbit access /////////////////////////////////////////////////////////////// |
| 2465 | |
| 2466 | UPB_INLINE size_t _upb_hasbit_ofs(size_t idx) { return idx / 8; } |
| 2467 | |
| 2468 | UPB_INLINE char _upb_hasbit_mask(size_t idx) { return 1 << (idx % 8); } |
| 2469 | |
| 2470 | UPB_INLINE bool _upb_hasbit(const upb_Message* msg, size_t idx) { |
| 2471 | return (*UPB_PTR_AT(msg, _upb_hasbit_ofs(idx), const char) & |
| 2472 | _upb_hasbit_mask(idx)) != 0; |
| 2473 | } |
| 2474 | |
| 2475 | UPB_INLINE void _upb_sethas(const upb_Message* msg, size_t idx) { |
| 2476 | (*UPB_PTR_AT(msg, _upb_hasbit_ofs(idx), char)) |= _upb_hasbit_mask(idx); |
| 2477 | } |
| 2478 | |
| 2479 | UPB_INLINE void _upb_clearhas(const upb_Message* msg, size_t idx) { |
| 2480 | (*UPB_PTR_AT(msg, _upb_hasbit_ofs(idx), char)) &= ~_upb_hasbit_mask(idx); |
| 2481 | } |
| 2482 | |
| 2483 | UPB_INLINE size_t _upb_Message_Hasidx(const upb_MiniTableField* f) { |
| 2484 | UPB_ASSERT(f->presence > 0); |
| 2485 | return f->presence; |
| 2486 | } |
| 2487 | |
| 2488 | UPB_INLINE bool _upb_hasbit_field(const upb_Message* msg, |
| 2489 | const upb_MiniTableField* f) { |
| 2490 | return _upb_hasbit(msg, _upb_Message_Hasidx(f)); |
| 2491 | } |
| 2492 | |
| 2493 | UPB_INLINE void _upb_sethas_field(const upb_Message* msg, |
| 2494 | const upb_MiniTableField* f) { |
| 2495 | _upb_sethas(msg, _upb_Message_Hasidx(f)); |
| 2496 | } |
| 2497 | |
| 2498 | // Oneof case access /////////////////////////////////////////////////////////// |
| 2499 | |
| 2500 | UPB_INLINE size_t _upb_oneofcase_ofs(const upb_MiniTableField* f) { |
| 2501 | UPB_ASSERT(f->presence < 0); |
| 2502 | return ~(ptrdiff_t)f->presence; |
| 2503 | } |
| 2504 | |
| 2505 | UPB_INLINE uint32_t* _upb_oneofcase_field(upb_Message* msg, |
| 2506 | const upb_MiniTableField* f) { |
| 2507 | return UPB_PTR_AT(msg, _upb_oneofcase_ofs(f), uint32_t); |
| 2508 | } |
| 2509 | |
| 2510 | UPB_INLINE uint32_t _upb_getoneofcase_field(const upb_Message* msg, |
| 2511 | const upb_MiniTableField* f) { |
| 2512 | return *_upb_oneofcase_field((upb_Message*)msg, f); |
| 2513 | } |
| 2514 | |
| 2515 | // LINT.ThenChange(GoogleInternalName2) |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 2516 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2517 | UPB_INLINE bool _upb_MiniTableField_InOneOf(const upb_MiniTableField* field) { |
| 2518 | return field->presence < 0; |
| 2519 | } |
| 2520 | |
| 2521 | UPB_INLINE void* _upb_MiniTableField_GetPtr(upb_Message* msg, |
| 2522 | const upb_MiniTableField* field) { |
| 2523 | return (char*)msg + field->offset; |
| 2524 | } |
| 2525 | |
| 2526 | UPB_INLINE const void* _upb_MiniTableField_GetConstPtr( |
| 2527 | const upb_Message* msg, const upb_MiniTableField* field) { |
| 2528 | return (char*)msg + field->offset; |
| 2529 | } |
| 2530 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2531 | UPB_INLINE void _upb_Message_SetPresence(upb_Message* msg, |
| 2532 | const upb_MiniTableField* field) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2533 | if (field->presence > 0) { |
| 2534 | _upb_sethas_field(msg, field); |
| 2535 | } else if (_upb_MiniTableField_InOneOf(field)) { |
| 2536 | *_upb_oneofcase_field(msg, field) = field->number; |
| 2537 | } |
| 2538 | } |
| 2539 | |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 2540 | UPB_INLINE bool _upb_MiniTable_ValueIsNonZero(const void* default_val, |
| 2541 | const upb_MiniTableField* field) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2542 | char zero[16] = {0}; |
| 2543 | switch (_upb_MiniTableField_GetRep(field)) { |
| 2544 | case kUpb_FieldRep_1Byte: |
| 2545 | return memcmp(&zero, default_val, 1) != 0; |
| 2546 | case kUpb_FieldRep_4Byte: |
| 2547 | return memcmp(&zero, default_val, 4) != 0; |
| 2548 | case kUpb_FieldRep_8Byte: |
| 2549 | return memcmp(&zero, default_val, 8) != 0; |
| 2550 | case kUpb_FieldRep_StringView: { |
| 2551 | const upb_StringView* sv = (const upb_StringView*)default_val; |
| 2552 | return sv->size != 0; |
| 2553 | } |
| 2554 | } |
| 2555 | UPB_UNREACHABLE(); |
| 2556 | } |
| 2557 | |
| 2558 | UPB_INLINE void _upb_MiniTable_CopyFieldData(void* to, const void* from, |
| 2559 | const upb_MiniTableField* field) { |
| 2560 | switch (_upb_MiniTableField_GetRep(field)) { |
| 2561 | case kUpb_FieldRep_1Byte: |
| 2562 | memcpy(to, from, 1); |
| 2563 | return; |
| 2564 | case kUpb_FieldRep_4Byte: |
| 2565 | memcpy(to, from, 4); |
| 2566 | return; |
| 2567 | case kUpb_FieldRep_8Byte: |
| 2568 | memcpy(to, from, 8); |
| 2569 | return; |
| 2570 | case kUpb_FieldRep_StringView: { |
| 2571 | memcpy(to, from, sizeof(upb_StringView)); |
| 2572 | return; |
| 2573 | } |
| 2574 | } |
| 2575 | UPB_UNREACHABLE(); |
| 2576 | } |
| 2577 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 2578 | UPB_INLINE size_t |
| 2579 | _upb_MiniTable_ElementSizeLg2(const upb_MiniTableField* field) { |
| 2580 | const unsigned char table[] = { |
| 2581 | 0, |
| 2582 | 3, // kUpb_FieldType_Double = 1, |
| 2583 | 2, // kUpb_FieldType_Float = 2, |
| 2584 | 3, // kUpb_FieldType_Int64 = 3, |
| 2585 | 3, // kUpb_FieldType_UInt64 = 4, |
| 2586 | 2, // kUpb_FieldType_Int32 = 5, |
| 2587 | 3, // kUpb_FieldType_Fixed64 = 6, |
| 2588 | 2, // kUpb_FieldType_Fixed32 = 7, |
| 2589 | 0, // kUpb_FieldType_Bool = 8, |
| 2590 | UPB_SIZE(3, 4), // kUpb_FieldType_String = 9, |
| 2591 | UPB_SIZE(2, 3), // kUpb_FieldType_Group = 10, |
| 2592 | UPB_SIZE(2, 3), // kUpb_FieldType_Message = 11, |
| 2593 | UPB_SIZE(3, 4), // kUpb_FieldType_Bytes = 12, |
| 2594 | 2, // kUpb_FieldType_UInt32 = 13, |
| 2595 | 2, // kUpb_FieldType_Enum = 14, |
| 2596 | 2, // kUpb_FieldType_SFixed32 = 15, |
| 2597 | 3, // kUpb_FieldType_SFixed64 = 16, |
| 2598 | 2, // kUpb_FieldType_SInt32 = 17, |
| 2599 | 3, // kUpb_FieldType_SInt64 = 18, |
| 2600 | }; |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2601 | return table[field->UPB_PRIVATE(descriptortype)]; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 2602 | } |
| 2603 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2604 | // Here we define universal getter/setter functions for message fields. |
| 2605 | // These look very branchy and inefficient, but as long as the MiniTableField |
| 2606 | // values are known at compile time, all the branches are optimized away and |
| 2607 | // we are left with ideal code. This can happen either through through |
| 2608 | // literals or UPB_ASSUME(): |
| 2609 | // |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 2610 | // // Via struct literals. |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2611 | // bool FooMessage_set_bool_field(const upb_Message* msg, bool val) { |
| 2612 | // const upb_MiniTableField field = {1, 0, 0, /* etc... */}; |
| 2613 | // // All value in "field" are compile-time known. |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2614 | // _upb_Message_SetNonExtensionField(msg, &field, &value); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2615 | // } |
| 2616 | // |
| 2617 | // // Via UPB_ASSUME(). |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2618 | // UPB_INLINE bool upb_Message_SetBool(upb_Message* msg, |
| 2619 | // const upb_MiniTableField* field, |
| 2620 | // bool value, upb_Arena* a) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2621 | // UPB_ASSUME(field->UPB_PRIVATE(descriptortype) == kUpb_FieldType_Bool); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2622 | // UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
| 2623 | // UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_1Byte); |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2624 | // _upb_Message_SetField(msg, field, &value, a); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2625 | // } |
| 2626 | // |
| 2627 | // As a result, we can use these universal getters/setters for *all* message |
| 2628 | // accessors: generated code, MiniTable accessors, and reflection. The only |
| 2629 | // 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] | 2630 | // about how they read/write the message data, for efficiency. |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2631 | // |
| 2632 | // These functions work on both extensions and non-extensions. If the field |
| 2633 | // of a setter is known to be a non-extension, the arena may be NULL and the |
| 2634 | // returned bool value may be ignored since it will always succeed. |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2635 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2636 | UPB_INLINE bool _upb_Message_HasExtensionField( |
| 2637 | const upb_Message* msg, const upb_MiniTableExtension* ext) { |
| 2638 | UPB_ASSERT(upb_MiniTableField_HasPresence(&ext->field)); |
| 2639 | return _upb_Message_Getext(msg, ext) != NULL; |
| 2640 | } |
| 2641 | |
| 2642 | UPB_INLINE bool _upb_Message_HasNonExtensionField( |
| 2643 | const upb_Message* msg, const upb_MiniTableField* field) { |
| 2644 | UPB_ASSERT(upb_MiniTableField_HasPresence(field)); |
| 2645 | UPB_ASSUME(!upb_MiniTableField_IsExtension(field)); |
| 2646 | if (_upb_MiniTableField_InOneOf(field)) { |
| 2647 | return _upb_getoneofcase_field(msg, field) == field->number; |
| 2648 | } else { |
| 2649 | return _upb_hasbit_field(msg, field); |
| 2650 | } |
| 2651 | } |
| 2652 | |
| 2653 | static UPB_FORCEINLINE void _upb_Message_GetNonExtensionField( |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2654 | const upb_Message* msg, const upb_MiniTableField* field, |
| 2655 | const void* default_val, void* val) { |
| 2656 | UPB_ASSUME(!upb_MiniTableField_IsExtension(field)); |
| 2657 | if ((_upb_MiniTableField_InOneOf(field) || |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 2658 | _upb_MiniTable_ValueIsNonZero(default_val, field)) && |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2659 | !_upb_Message_HasNonExtensionField(msg, field)) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2660 | _upb_MiniTable_CopyFieldData(val, default_val, field); |
| 2661 | return; |
| 2662 | } |
| 2663 | _upb_MiniTable_CopyFieldData(val, _upb_MiniTableField_GetConstPtr(msg, field), |
| 2664 | field); |
| 2665 | } |
| 2666 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2667 | UPB_INLINE void _upb_Message_GetExtensionField( |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2668 | const upb_Message* msg, const upb_MiniTableExtension* mt_ext, |
| 2669 | const void* default_val, void* val) { |
| 2670 | UPB_ASSUME(upb_MiniTableField_IsExtension(&mt_ext->field)); |
| 2671 | const upb_Message_Extension* ext = _upb_Message_Getext(msg, mt_ext); |
| 2672 | if (ext) { |
| 2673 | _upb_MiniTable_CopyFieldData(val, &ext->data, &mt_ext->field); |
| 2674 | } else { |
| 2675 | _upb_MiniTable_CopyFieldData(val, default_val, &mt_ext->field); |
| 2676 | } |
| 2677 | } |
| 2678 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2679 | UPB_INLINE void _upb_Message_GetField(const upb_Message* msg, |
| 2680 | const upb_MiniTableField* field, |
| 2681 | const void* default_val, void* val) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2682 | if (upb_MiniTableField_IsExtension(field)) { |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2683 | _upb_Message_GetExtensionField(msg, (upb_MiniTableExtension*)field, |
| 2684 | default_val, val); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2685 | } else { |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2686 | _upb_Message_GetNonExtensionField(msg, field, default_val, val); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2687 | } |
| 2688 | } |
| 2689 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2690 | UPB_INLINE void _upb_Message_SetNonExtensionField( |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2691 | upb_Message* msg, const upb_MiniTableField* field, const void* val) { |
| 2692 | UPB_ASSUME(!upb_MiniTableField_IsExtension(field)); |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2693 | _upb_Message_SetPresence(msg, field); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2694 | _upb_MiniTable_CopyFieldData(_upb_MiniTableField_GetPtr(msg, field), val, |
| 2695 | field); |
| 2696 | } |
| 2697 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2698 | UPB_INLINE bool _upb_Message_SetExtensionField( |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2699 | upb_Message* msg, const upb_MiniTableExtension* mt_ext, const void* val, |
| 2700 | upb_Arena* a) { |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2701 | UPB_ASSERT(a); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2702 | upb_Message_Extension* ext = |
| 2703 | _upb_Message_GetOrCreateExtension(msg, mt_ext, a); |
| 2704 | if (!ext) return false; |
| 2705 | _upb_MiniTable_CopyFieldData(&ext->data, val, &mt_ext->field); |
| 2706 | return true; |
| 2707 | } |
| 2708 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2709 | UPB_INLINE bool _upb_Message_SetField(upb_Message* msg, |
| 2710 | const upb_MiniTableField* field, |
| 2711 | const void* val, upb_Arena* a) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2712 | if (upb_MiniTableField_IsExtension(field)) { |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2713 | const upb_MiniTableExtension* ext = (const upb_MiniTableExtension*)field; |
| 2714 | return _upb_Message_SetExtensionField(msg, ext, val, a); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2715 | } else { |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2716 | _upb_Message_SetNonExtensionField(msg, field, val); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2717 | return true; |
| 2718 | } |
| 2719 | } |
| 2720 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2721 | UPB_INLINE void _upb_Message_ClearExtensionField( |
| 2722 | upb_Message* msg, const upb_MiniTableExtension* ext_l) { |
| 2723 | upb_Message_Internal* in = upb_Message_Getinternal(msg); |
| 2724 | if (!in->internal) return; |
| 2725 | const upb_Message_Extension* base = |
| 2726 | UPB_PTR_AT(in->internal, in->internal->ext_begin, upb_Message_Extension); |
| 2727 | upb_Message_Extension* ext = |
| 2728 | (upb_Message_Extension*)_upb_Message_Getext(msg, ext_l); |
| 2729 | if (ext) { |
| 2730 | *ext = *base; |
| 2731 | in->internal->ext_begin += sizeof(upb_Message_Extension); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 2732 | } |
| 2733 | } |
| 2734 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2735 | UPB_INLINE void _upb_Message_ClearNonExtensionField( |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 2736 | upb_Message* msg, const upb_MiniTableField* field) { |
| 2737 | if (field->presence > 0) { |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 2738 | _upb_clearhas(msg, _upb_Message_Hasidx(field)); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 2739 | } else if (_upb_MiniTableField_InOneOf(field)) { |
| 2740 | uint32_t* oneof_case = _upb_oneofcase_field(msg, field); |
| 2741 | if (*oneof_case != field->number) return; |
| 2742 | *oneof_case = 0; |
| 2743 | } |
| 2744 | const char zeros[16] = {0}; |
| 2745 | _upb_MiniTable_CopyFieldData(_upb_MiniTableField_GetPtr(msg, field), zeros, |
| 2746 | field); |
| 2747 | } |
| 2748 | |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 2749 | UPB_INLINE void _upb_Message_AssertMapIsUntagged( |
| 2750 | const upb_Message* msg, const upb_MiniTableField* field) { |
Adam Cozzette | 7d5592e | 2023-08-23 12:15:26 -0700 | [diff] [blame] | 2751 | UPB_UNUSED(msg); |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 2752 | _upb_MiniTableField_CheckIsMap(field); |
| 2753 | #ifndef NDEBUG |
| 2754 | upb_TaggedMessagePtr default_val = 0; |
| 2755 | upb_TaggedMessagePtr tagged; |
| 2756 | _upb_Message_GetNonExtensionField(msg, field, &default_val, &tagged); |
| 2757 | UPB_ASSERT(!upb_TaggedMessagePtr_IsEmpty(tagged)); |
| 2758 | #endif |
| 2759 | } |
| 2760 | |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 2761 | UPB_INLINE upb_Map* _upb_Message_GetOrCreateMutableMap( |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 2762 | upb_Message* msg, const upb_MiniTableField* field, size_t key_size, |
| 2763 | size_t val_size, upb_Arena* arena) { |
| 2764 | _upb_MiniTableField_CheckIsMap(field); |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 2765 | _upb_Message_AssertMapIsUntagged(msg, field); |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 2766 | upb_Map* map = NULL; |
| 2767 | upb_Map* default_map_value = NULL; |
| 2768 | _upb_Message_GetNonExtensionField(msg, field, &default_map_value, &map); |
| 2769 | if (!map) { |
| 2770 | map = _upb_Map_New(arena, key_size, val_size); |
| 2771 | // Check again due to: https://godbolt.org/z/7WfaoKG1r |
| 2772 | _upb_MiniTableField_CheckIsMap(field); |
| 2773 | _upb_Message_SetNonExtensionField(msg, field, &map); |
| 2774 | } |
| 2775 | return map; |
| 2776 | } |
| 2777 | |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2778 | #ifdef __cplusplus |
| 2779 | } /* extern "C" */ |
| 2780 | #endif |
| 2781 | |
| 2782 | #if defined(__GNUC__) && !defined(__clang__) |
| 2783 | #pragma GCC diagnostic pop |
| 2784 | #endif |
| 2785 | |
| 2786 | |
Sandy Zhang | e3b0943 | 2023-08-07 09:30:02 -0700 | [diff] [blame] | 2787 | #endif // UPB_MESSAGE_INTERNAL_ACCESSORS_H_ |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2788 | |
| 2789 | // Must be last. |
| 2790 | |
| 2791 | #ifdef __cplusplus |
| 2792 | extern "C" { |
| 2793 | #endif |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2794 | |
| 2795 | UPB_API_INLINE void upb_Message_ClearField(upb_Message* msg, |
| 2796 | const upb_MiniTableField* field) { |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 2797 | if (upb_MiniTableField_IsExtension(field)) { |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2798 | const upb_MiniTableExtension* ext = (const upb_MiniTableExtension*)field; |
| 2799 | _upb_Message_ClearExtensionField(msg, ext); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 2800 | } else { |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2801 | _upb_Message_ClearNonExtensionField(msg, field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 2802 | } |
| 2803 | } |
| 2804 | |
Jie Luo | f36a5c6 | 2023-05-23 17:56:18 -0700 | [diff] [blame] | 2805 | UPB_API_INLINE void upb_Message_Clear(upb_Message* msg, |
| 2806 | const upb_MiniTable* l) { |
| 2807 | // Note: Can't use UPB_PTR_AT() here because we are doing pointer subtraction. |
| 2808 | char* mem = (char*)msg - sizeof(upb_Message_Internal); |
| 2809 | memset(mem, 0, upb_msg_sizeof(l)); |
| 2810 | } |
| 2811 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2812 | UPB_API_INLINE bool upb_Message_HasField(const upb_Message* msg, |
| 2813 | const upb_MiniTableField* field) { |
| 2814 | if (upb_MiniTableField_IsExtension(field)) { |
| 2815 | const upb_MiniTableExtension* ext = (const upb_MiniTableExtension*)field; |
| 2816 | return _upb_Message_HasExtensionField(msg, ext); |
| 2817 | } else { |
| 2818 | return _upb_Message_HasNonExtensionField(msg, field); |
| 2819 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 2820 | } |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2821 | |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 2822 | UPB_API_INLINE uint32_t upb_Message_WhichOneofFieldNumber( |
| 2823 | const upb_Message* message, const upb_MiniTableField* oneof_field) { |
| 2824 | UPB_ASSUME(_upb_MiniTableField_InOneOf(oneof_field)); |
| 2825 | return _upb_getoneofcase_field(message, oneof_field); |
| 2826 | } |
| 2827 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2828 | UPB_API_INLINE bool upb_Message_GetBool(const upb_Message* msg, |
| 2829 | const upb_MiniTableField* field, |
| 2830 | bool default_val) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2831 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Bool); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2832 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_1Byte); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2833 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2834 | bool ret; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2835 | _upb_Message_GetField(msg, field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2836 | return ret; |
| 2837 | } |
| 2838 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2839 | UPB_API_INLINE bool upb_Message_SetBool(upb_Message* msg, |
| 2840 | const upb_MiniTableField* field, |
| 2841 | bool value, upb_Arena* a) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2842 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Bool); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2843 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_1Byte); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2844 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2845 | return _upb_Message_SetField(msg, field, &value, a); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2846 | } |
| 2847 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2848 | UPB_API_INLINE int32_t upb_Message_GetInt32(const upb_Message* msg, |
| 2849 | const upb_MiniTableField* field, |
| 2850 | int32_t default_val) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2851 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Int32 || |
| 2852 | upb_MiniTableField_CType(field) == kUpb_CType_Enum); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2853 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2854 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2855 | int32_t ret; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2856 | _upb_Message_GetField(msg, field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2857 | return ret; |
| 2858 | } |
| 2859 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2860 | UPB_API_INLINE bool upb_Message_SetInt32(upb_Message* msg, |
| 2861 | const upb_MiniTableField* field, |
| 2862 | int32_t value, upb_Arena* a) { |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 2863 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Int32 || |
| 2864 | upb_MiniTableField_CType(field) == kUpb_CType_Enum); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2865 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2866 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2867 | return _upb_Message_SetField(msg, field, &value, a); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2868 | } |
| 2869 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2870 | UPB_API_INLINE uint32_t upb_Message_GetUInt32(const upb_Message* msg, |
| 2871 | const upb_MiniTableField* field, |
| 2872 | uint32_t default_val) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2873 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_UInt32); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2874 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2875 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2876 | uint32_t ret; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2877 | _upb_Message_GetField(msg, field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2878 | return ret; |
| 2879 | } |
| 2880 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2881 | UPB_API_INLINE bool upb_Message_SetUInt32(upb_Message* msg, |
| 2882 | const upb_MiniTableField* field, |
| 2883 | uint32_t value, upb_Arena* a) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2884 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_UInt32); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2885 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2886 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2887 | return _upb_Message_SetField(msg, field, &value, a); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2888 | } |
| 2889 | |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 2890 | UPB_API_INLINE void upb_Message_SetClosedEnum( |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 2891 | upb_Message* msg, const upb_MiniTable* msg_mini_table, |
| 2892 | const upb_MiniTableField* field, int32_t value) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2893 | UPB_ASSERT(upb_MiniTableField_IsClosedEnum(field)); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2894 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2895 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2896 | UPB_ASSERT(upb_MiniTableEnum_CheckValue( |
| 2897 | upb_MiniTable_GetSubEnumTable(msg_mini_table, field), value)); |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2898 | _upb_Message_SetNonExtensionField(msg, field, &value); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2899 | } |
| 2900 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2901 | UPB_API_INLINE int64_t upb_Message_GetInt64(const upb_Message* msg, |
| 2902 | const upb_MiniTableField* field, |
| 2903 | uint64_t default_val) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2904 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Int64); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2905 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_8Byte); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2906 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2907 | int64_t ret; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2908 | _upb_Message_GetField(msg, field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2909 | return ret; |
| 2910 | } |
| 2911 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2912 | UPB_API_INLINE bool upb_Message_SetInt64(upb_Message* msg, |
| 2913 | const upb_MiniTableField* field, |
| 2914 | int64_t value, upb_Arena* a) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2915 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Int64); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2916 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_8Byte); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2917 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2918 | return _upb_Message_SetField(msg, field, &value, a); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2919 | } |
| 2920 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2921 | UPB_API_INLINE uint64_t upb_Message_GetUInt64(const upb_Message* msg, |
| 2922 | const upb_MiniTableField* field, |
| 2923 | uint64_t default_val) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2924 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_UInt64); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2925 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_8Byte); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2926 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2927 | uint64_t ret; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2928 | _upb_Message_GetField(msg, field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2929 | return ret; |
| 2930 | } |
| 2931 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2932 | UPB_API_INLINE bool upb_Message_SetUInt64(upb_Message* msg, |
| 2933 | const upb_MiniTableField* field, |
| 2934 | uint64_t value, upb_Arena* a) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2935 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_UInt64); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2936 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_8Byte); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2937 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2938 | return _upb_Message_SetField(msg, field, &value, a); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2939 | } |
| 2940 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2941 | UPB_API_INLINE float upb_Message_GetFloat(const upb_Message* msg, |
| 2942 | const upb_MiniTableField* field, |
| 2943 | float default_val) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2944 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Float); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2945 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2946 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2947 | float ret; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2948 | _upb_Message_GetField(msg, field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2949 | return ret; |
| 2950 | } |
| 2951 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2952 | UPB_API_INLINE bool upb_Message_SetFloat(upb_Message* msg, |
| 2953 | const upb_MiniTableField* field, |
| 2954 | float value, upb_Arena* a) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2955 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Float); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2956 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2957 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2958 | return _upb_Message_SetField(msg, field, &value, a); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2959 | } |
| 2960 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2961 | UPB_API_INLINE double upb_Message_GetDouble(const upb_Message* msg, |
| 2962 | const upb_MiniTableField* field, |
| 2963 | double default_val) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2964 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Double); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2965 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_8Byte); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2966 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2967 | double ret; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2968 | _upb_Message_GetField(msg, field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2969 | return ret; |
| 2970 | } |
| 2971 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2972 | UPB_API_INLINE bool upb_Message_SetDouble(upb_Message* msg, |
| 2973 | const upb_MiniTableField* field, |
| 2974 | double value, upb_Arena* a) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2975 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Double); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2976 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_8Byte); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2977 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2978 | return _upb_Message_SetField(msg, field, &value, a); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2979 | } |
| 2980 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 2981 | UPB_API_INLINE upb_StringView |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2982 | upb_Message_GetString(const upb_Message* msg, const upb_MiniTableField* field, |
| 2983 | upb_StringView def_val) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2984 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_String || |
| 2985 | upb_MiniTableField_CType(field) == kUpb_CType_Bytes); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2986 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_StringView); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2987 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2988 | upb_StringView ret; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2989 | _upb_Message_GetField(msg, field, &def_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2990 | return ret; |
| 2991 | } |
| 2992 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2993 | UPB_API_INLINE bool upb_Message_SetString(upb_Message* msg, |
| 2994 | const upb_MiniTableField* field, |
| 2995 | upb_StringView value, upb_Arena* a) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2996 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_String || |
| 2997 | upb_MiniTableField_CType(field) == kUpb_CType_Bytes); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2998 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_StringView); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2999 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 3000 | return _upb_Message_SetField(msg, field, &value, a); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 3001 | } |
| 3002 | |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 3003 | UPB_API_INLINE upb_TaggedMessagePtr upb_Message_GetTaggedMessagePtr( |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 3004 | const upb_Message* msg, const upb_MiniTableField* field, |
| 3005 | upb_Message* default_val) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 3006 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Message); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 3007 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == |
| 3008 | UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte)); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 3009 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 3010 | upb_TaggedMessagePtr tagged; |
| 3011 | _upb_Message_GetNonExtensionField(msg, field, &default_val, &tagged); |
| 3012 | return tagged; |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 3013 | } |
| 3014 | |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 3015 | UPB_API_INLINE const upb_Message* upb_Message_GetMessage( |
| 3016 | const upb_Message* msg, const upb_MiniTableField* field, |
| 3017 | upb_Message* default_val) { |
| 3018 | upb_TaggedMessagePtr tagged = |
| 3019 | upb_Message_GetTaggedMessagePtr(msg, field, default_val); |
| 3020 | return upb_TaggedMessagePtr_GetNonEmptyMessage(tagged); |
| 3021 | } |
| 3022 | |
| 3023 | // For internal use only; users cannot set tagged messages because only the |
| 3024 | // parser and the message copier are allowed to directly create an empty |
| 3025 | // message. |
| 3026 | UPB_API_INLINE void _upb_Message_SetTaggedMessagePtr( |
| 3027 | upb_Message* msg, const upb_MiniTable* mini_table, |
| 3028 | const upb_MiniTableField* field, upb_TaggedMessagePtr sub_message) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 3029 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Message); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 3030 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == |
| 3031 | UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte)); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 3032 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 3033 | UPB_ASSERT(mini_table->subs[field->UPB_PRIVATE(submsg_index)].submsg); |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 3034 | _upb_Message_SetNonExtensionField(msg, field, &sub_message); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 3035 | } |
| 3036 | |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 3037 | UPB_API_INLINE void upb_Message_SetMessage(upb_Message* msg, |
| 3038 | const upb_MiniTable* mini_table, |
| 3039 | const upb_MiniTableField* field, |
| 3040 | upb_Message* sub_message) { |
| 3041 | _upb_Message_SetTaggedMessagePtr( |
| 3042 | msg, mini_table, field, _upb_TaggedMessagePtr_Pack(sub_message, false)); |
| 3043 | } |
| 3044 | |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 3045 | UPB_API_INLINE upb_Message* upb_Message_GetOrCreateMutableMessage( |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 3046 | upb_Message* msg, const upb_MiniTable* mini_table, |
| 3047 | const upb_MiniTableField* field, upb_Arena* arena) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 3048 | UPB_ASSERT(arena); |
| 3049 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Message); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 3050 | upb_Message* sub_message = *UPB_PTR_AT(msg, field->offset, upb_Message*); |
| 3051 | if (!sub_message) { |
| 3052 | const upb_MiniTable* sub_mini_table = |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 3053 | mini_table->subs[field->UPB_PRIVATE(submsg_index)].submsg; |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 3054 | UPB_ASSERT(sub_mini_table); |
| 3055 | sub_message = _upb_Message_New(sub_mini_table, arena); |
| 3056 | *UPB_PTR_AT(msg, field->offset, upb_Message*) = sub_message; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 3057 | _upb_Message_SetPresence(msg, field); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 3058 | } |
| 3059 | return sub_message; |
| 3060 | } |
| 3061 | |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 3062 | UPB_API_INLINE const upb_Array* upb_Message_GetArray( |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 3063 | const upb_Message* msg, const upb_MiniTableField* field) { |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 3064 | _upb_MiniTableField_CheckIsArray(field); |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 3065 | upb_Array* ret; |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 3066 | const upb_Array* default_val = NULL; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 3067 | _upb_Message_GetNonExtensionField(msg, field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 3068 | return ret; |
| 3069 | } |
| 3070 | |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 3071 | UPB_API_INLINE upb_Array* upb_Message_GetMutableArray( |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 3072 | upb_Message* msg, const upb_MiniTableField* field) { |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 3073 | _upb_MiniTableField_CheckIsArray(field); |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 3074 | return (upb_Array*)upb_Message_GetArray(msg, field); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 3075 | } |
| 3076 | |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 3077 | UPB_API_INLINE upb_Array* upb_Message_GetOrCreateMutableArray( |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 3078 | upb_Message* msg, const upb_MiniTableField* field, upb_Arena* arena) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 3079 | UPB_ASSERT(arena); |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 3080 | _upb_MiniTableField_CheckIsArray(field); |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 3081 | upb_Array* array = upb_Message_GetMutableArray(msg, field); |
| 3082 | if (!array) { |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 3083 | array = _upb_Array_New(arena, 4, _upb_MiniTable_ElementSizeLg2(field)); |
| 3084 | // Check again due to: https://godbolt.org/z/7WfaoKG1r |
| 3085 | _upb_MiniTableField_CheckIsArray(field); |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 3086 | _upb_Message_SetField(msg, field, &array, arena); |
| 3087 | } |
| 3088 | return array; |
| 3089 | } |
| 3090 | |
Jie Luo | f36a5c6 | 2023-05-23 17:56:18 -0700 | [diff] [blame] | 3091 | UPB_API_INLINE void* upb_Message_ResizeArrayUninitialized( |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 3092 | upb_Message* msg, const upb_MiniTableField* field, size_t size, |
| 3093 | upb_Arena* arena) { |
| 3094 | _upb_MiniTableField_CheckIsArray(field); |
| 3095 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, field, arena); |
| 3096 | if (!arr || !_upb_Array_ResizeUninitialized(arr, size, arena)) return NULL; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 3097 | return _upb_array_ptr(arr); |
| 3098 | } |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 3099 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 3100 | UPB_API_INLINE const upb_Map* upb_Message_GetMap( |
| 3101 | const upb_Message* msg, const upb_MiniTableField* field) { |
| 3102 | _upb_MiniTableField_CheckIsMap(field); |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 3103 | _upb_Message_AssertMapIsUntagged(msg, field); |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 3104 | upb_Map* ret; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 3105 | const upb_Map* default_val = NULL; |
| 3106 | _upb_Message_GetNonExtensionField(msg, field, &default_val, &ret); |
| 3107 | return ret; |
| 3108 | } |
| 3109 | |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 3110 | UPB_API_INLINE upb_Map* upb_Message_GetMutableMap( |
| 3111 | upb_Message* msg, const upb_MiniTableField* field) { |
| 3112 | return (upb_Map*)upb_Message_GetMap(msg, field); |
| 3113 | } |
| 3114 | |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 3115 | UPB_API_INLINE upb_Map* upb_Message_GetOrCreateMutableMap( |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 3116 | upb_Message* msg, const upb_MiniTable* map_entry_mini_table, |
| 3117 | const upb_MiniTableField* field, upb_Arena* arena) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 3118 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Message); |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 3119 | const upb_MiniTableField* map_entry_key_field = |
| 3120 | &map_entry_mini_table->fields[0]; |
| 3121 | const upb_MiniTableField* map_entry_value_field = |
| 3122 | &map_entry_mini_table->fields[1]; |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 3123 | return _upb_Message_GetOrCreateMutableMap( |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 3124 | msg, field, |
| 3125 | _upb_Map_CTypeSize(upb_MiniTableField_CType(map_entry_key_field)), |
| 3126 | _upb_Map_CTypeSize(upb_MiniTableField_CType(map_entry_value_field)), |
| 3127 | arena); |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 3128 | } |
| 3129 | |
| 3130 | // Updates a map entry given an entry message. |
| 3131 | upb_MapInsertStatus upb_Message_InsertMapEntry(upb_Map* map, |
| 3132 | const upb_MiniTable* mini_table, |
| 3133 | const upb_MiniTableField* field, |
| 3134 | upb_Message* map_entry_message, |
| 3135 | upb_Arena* arena); |
| 3136 | |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 3137 | // Compares two messages by serializing them and calling memcmp(). |
| 3138 | bool upb_Message_IsExactlyEqual(const upb_Message* m1, const upb_Message* m2, |
| 3139 | const upb_MiniTable* layout); |
| 3140 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 3141 | #ifdef __cplusplus |
| 3142 | } /* extern "C" */ |
| 3143 | #endif |
| 3144 | |
| 3145 | |
| 3146 | #endif // UPB_MESSAGE_ACCESSORS_H_ |
| 3147 | |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 3148 | #ifndef UPB_MINI_TABLE_DECODE_H_ |
| 3149 | #define UPB_MINI_TABLE_DECODE_H_ |
| 3150 | |
| 3151 | |
| 3152 | #ifndef UPB_MINI_TABLE_SUB_H_ |
| 3153 | #define UPB_MINI_TABLE_SUB_H_ |
| 3154 | |
| 3155 | |
| 3156 | typedef union upb_MiniTableSub upb_MiniTableSub; |
| 3157 | |
| 3158 | #endif /* UPB_MINI_TABLE_INTERNAL_SUB_H_ */ |
| 3159 | |
| 3160 | // Export the newer headers, for legacy users. New users should include the |
| 3161 | // more specific headers directly. |
| 3162 | // IWYU pragma: begin_exports |
| 3163 | |
| 3164 | #ifndef UPB_MINI_DESCRIPTOR_BUILD_ENUM_H_ |
| 3165 | #define UPB_MINI_DESCRIPTOR_BUILD_ENUM_H_ |
| 3166 | |
| 3167 | |
| 3168 | // Must be last. |
| 3169 | |
| 3170 | #ifdef __cplusplus |
| 3171 | extern "C" { |
| 3172 | #endif |
| 3173 | |
| 3174 | // Builds a upb_MiniTableEnum from an enum MiniDescriptor. The MiniDescriptor |
| 3175 | // must be for an enum, not a message. |
| 3176 | UPB_API upb_MiniTableEnum* upb_MiniDescriptor_BuildEnum(const char* data, |
| 3177 | size_t len, |
| 3178 | upb_Arena* arena, |
| 3179 | upb_Status* status); |
| 3180 | |
| 3181 | // TODO(b/289057707): Deprecated name; update callers. |
| 3182 | UPB_API_INLINE upb_MiniTableEnum* upb_MiniTableEnum_Build(const char* data, |
| 3183 | size_t len, |
| 3184 | upb_Arena* arena, |
| 3185 | upb_Status* status) { |
| 3186 | return upb_MiniDescriptor_BuildEnum(data, len, arena, status); |
| 3187 | } |
| 3188 | |
| 3189 | #ifdef __cplusplus |
| 3190 | } /* extern "C" */ |
| 3191 | #endif |
| 3192 | |
| 3193 | |
| 3194 | #endif // UPB_MINI_DESCRIPTOR_BUILD_ENUM_H_ |
| 3195 | |
| 3196 | // Functions for linking MiniTables together once they are built from a |
| 3197 | // MiniDescriptor. |
| 3198 | // |
| 3199 | // These functions have names like upb_MiniTable_Link() because they operate on |
| 3200 | // MiniTables. We put them here, rather than in the mini_table/ directory, |
| 3201 | // because they are only needed when building MiniTables from MiniDescriptors. |
| 3202 | // The interfaces in mini_table/ assume that MiniTables are immutable. |
| 3203 | |
| 3204 | #ifndef UPB_MINI_DESCRIPTOR_LINK_H_ |
| 3205 | #define UPB_MINI_DESCRIPTOR_LINK_H_ |
| 3206 | |
| 3207 | |
| 3208 | // Must be last. |
| 3209 | |
| 3210 | #ifdef __cplusplus |
| 3211 | extern "C" { |
| 3212 | #endif |
| 3213 | |
| 3214 | // Links a sub-message field to a MiniTable for that sub-message. If a |
| 3215 | // sub-message field is not linked, it will be treated as an unknown field |
| 3216 | // during parsing, and setting the field will not be allowed. It is possible |
| 3217 | // to link the message field later, at which point it will no longer be treated |
| 3218 | // as unknown. However there is no synchronization for this operation, which |
| 3219 | // means parallel mutation requires external synchronization. |
| 3220 | // Returns success/failure. |
| 3221 | UPB_API bool upb_MiniTable_SetSubMessage(upb_MiniTable* table, |
| 3222 | upb_MiniTableField* field, |
| 3223 | const upb_MiniTable* sub); |
| 3224 | |
| 3225 | // Links an enum field to a MiniTable for that enum. |
| 3226 | // All enum fields must be linked prior to parsing. |
| 3227 | // Returns success/failure. |
| 3228 | UPB_API bool upb_MiniTable_SetSubEnum(upb_MiniTable* table, |
| 3229 | upb_MiniTableField* field, |
| 3230 | const upb_MiniTableEnum* sub); |
| 3231 | |
| 3232 | // Returns a list of fields that require linking at runtime, to connect the |
| 3233 | // MiniTable to its sub-messages and sub-enums. The list of fields will be |
| 3234 | // written to the `subs` array, which must have been allocated by the caller |
| 3235 | // and must be large enough to hold a list of all fields in the message. |
| 3236 | // |
| 3237 | // The order of the fields returned by this function is significant: it matches |
| 3238 | // the order expected by upb_MiniTable_Link() below. |
| 3239 | // |
| 3240 | // The return value packs the sub-message count and sub-enum count into a single |
| 3241 | // integer like so: |
| 3242 | // return (msg_count << 16) | enum_count; |
| 3243 | UPB_API uint32_t upb_MiniTable_GetSubList(const upb_MiniTable* mt, |
| 3244 | const upb_MiniTableField** subs); |
| 3245 | |
| 3246 | // Links a message to its sub-messages and sub-enums. The caller must pass |
| 3247 | // arrays of sub-tables and sub-enums, in the same length and order as is |
| 3248 | // returned by upb_MiniTable_GetSubList() above. However, individual elements |
| 3249 | // of the sub_tables may be NULL if those sub-messages were tree shaken. |
| 3250 | // |
| 3251 | // Returns false if either array is too short, or if any of the tables fails |
| 3252 | // to link. |
| 3253 | UPB_API bool upb_MiniTable_Link(upb_MiniTable* mt, |
| 3254 | const upb_MiniTable** sub_tables, |
| 3255 | size_t sub_table_count, |
| 3256 | const upb_MiniTableEnum** sub_enums, |
| 3257 | size_t sub_enum_count); |
| 3258 | |
| 3259 | #ifdef __cplusplus |
| 3260 | } /* extern "C" */ |
| 3261 | #endif |
| 3262 | |
| 3263 | |
| 3264 | #endif // UPB_MINI_DESCRIPTOR_LINK_H_ |
| 3265 | // IWYU pragma: end_exports |
| 3266 | |
| 3267 | // Must be last. |
| 3268 | |
| 3269 | typedef enum { |
| 3270 | kUpb_MiniTablePlatform_32Bit, |
| 3271 | kUpb_MiniTablePlatform_64Bit, |
| 3272 | kUpb_MiniTablePlatform_Native = |
| 3273 | UPB_SIZE(kUpb_MiniTablePlatform_32Bit, kUpb_MiniTablePlatform_64Bit), |
| 3274 | } upb_MiniTablePlatform; |
| 3275 | |
| 3276 | #ifdef __cplusplus |
| 3277 | extern "C" { |
| 3278 | #endif |
| 3279 | |
| 3280 | // Builds a mini table from the data encoded in the buffer [data, len]. If any |
| 3281 | // errors occur, returns NULL and sets a status message. In the success case, |
| 3282 | // the caller must call upb_MiniTable_SetSub*() for all message or proto2 enum |
| 3283 | // fields to link the table to the appropriate sub-tables. |
| 3284 | upb_MiniTable* _upb_MiniTable_Build(const char* data, size_t len, |
| 3285 | upb_MiniTablePlatform platform, |
| 3286 | upb_Arena* arena, upb_Status* status); |
| 3287 | |
| 3288 | UPB_API_INLINE upb_MiniTable* upb_MiniTable_Build(const char* data, size_t len, |
| 3289 | upb_Arena* arena, |
| 3290 | upb_Status* status) { |
| 3291 | return _upb_MiniTable_Build(data, len, kUpb_MiniTablePlatform_Native, arena, |
| 3292 | status); |
| 3293 | } |
| 3294 | |
| 3295 | // Initializes a MiniTableExtension buffer that has already been allocated. |
| 3296 | // This is needed by upb_FileDef and upb_MessageDef, which allocate all of the |
| 3297 | // extensions together in a single contiguous array. |
| 3298 | const char* _upb_MiniTableExtension_Init(const char* data, size_t len, |
| 3299 | upb_MiniTableExtension* ext, |
| 3300 | const upb_MiniTable* extendee, |
| 3301 | upb_MiniTableSub sub, |
| 3302 | upb_MiniTablePlatform platform, |
| 3303 | upb_Status* status); |
| 3304 | |
| 3305 | UPB_API_INLINE const char* upb_MiniTableExtension_Init( |
| 3306 | const char* data, size_t len, upb_MiniTableExtension* ext, |
| 3307 | const upb_MiniTable* extendee, upb_MiniTableSub sub, upb_Status* status) { |
| 3308 | return _upb_MiniTableExtension_Init(data, len, ext, extendee, sub, |
| 3309 | kUpb_MiniTablePlatform_Native, status); |
| 3310 | } |
| 3311 | |
| 3312 | UPB_API upb_MiniTableExtension* _upb_MiniTableExtension_Build( |
| 3313 | const char* data, size_t len, const upb_MiniTable* extendee, |
| 3314 | upb_MiniTableSub sub, upb_MiniTablePlatform platform, upb_Arena* arena, |
| 3315 | upb_Status* status); |
| 3316 | |
| 3317 | UPB_API_INLINE upb_MiniTableExtension* upb_MiniTableExtension_Build( |
| 3318 | const char* data, size_t len, const upb_MiniTable* extendee, |
| 3319 | upb_Arena* arena, upb_Status* status) { |
| 3320 | upb_MiniTableSub sub; |
| 3321 | sub.submsg = NULL; |
| 3322 | return _upb_MiniTableExtension_Build( |
| 3323 | data, len, extendee, sub, kUpb_MiniTablePlatform_Native, arena, status); |
| 3324 | } |
| 3325 | |
| 3326 | UPB_API_INLINE upb_MiniTableExtension* upb_MiniTableExtension_BuildMessage( |
| 3327 | const char* data, size_t len, const upb_MiniTable* extendee, |
| 3328 | upb_MiniTable* submsg, upb_Arena* arena, upb_Status* status) { |
| 3329 | upb_MiniTableSub sub; |
| 3330 | sub.submsg = submsg; |
| 3331 | return _upb_MiniTableExtension_Build( |
| 3332 | data, len, extendee, sub, kUpb_MiniTablePlatform_Native, arena, status); |
| 3333 | } |
| 3334 | |
| 3335 | UPB_API_INLINE upb_MiniTableExtension* upb_MiniTableExtension_BuildEnum( |
| 3336 | const char* data, size_t len, const upb_MiniTable* extendee, |
| 3337 | upb_MiniTableEnum* subenum, upb_Arena* arena, upb_Status* status) { |
| 3338 | upb_MiniTableSub sub; |
| 3339 | sub.subenum = subenum; |
| 3340 | return _upb_MiniTableExtension_Build( |
| 3341 | data, len, extendee, sub, kUpb_MiniTablePlatform_Native, arena, status); |
| 3342 | } |
| 3343 | |
| 3344 | // Like upb_MiniTable_Build(), but the user provides a buffer of layout data so |
| 3345 | // it can be reused from call to call, avoiding repeated realloc()/free(). |
| 3346 | // |
| 3347 | // The caller owns `*buf` both before and after the call, and must free() it |
| 3348 | // when it is no longer in use. The function will realloc() `*buf` as |
| 3349 | // necessary, updating `*size` accordingly. |
| 3350 | upb_MiniTable* upb_MiniTable_BuildWithBuf(const char* data, size_t len, |
| 3351 | upb_MiniTablePlatform platform, |
| 3352 | upb_Arena* arena, void** buf, |
| 3353 | size_t* buf_size, upb_Status* status); |
| 3354 | |
| 3355 | #ifdef __cplusplus |
| 3356 | } /* extern "C" */ |
| 3357 | #endif |
| 3358 | |
| 3359 | |
| 3360 | #endif /* UPB_MINI_TABLE_DECODE_H_ */ |
| 3361 | |
| 3362 | #ifndef UPB_MINI_TABLE_FILE_H_ |
| 3363 | #define UPB_MINI_TABLE_FILE_H_ |
| 3364 | |
| 3365 | |
| 3366 | #ifndef UPB_MINI_TABLE_INTERNAL_FILE_H_ |
| 3367 | #define UPB_MINI_TABLE_INTERNAL_FILE_H_ |
| 3368 | |
| 3369 | |
| 3370 | // Must be last. |
| 3371 | |
| 3372 | struct upb_MiniTableFile { |
Sandy Zhang | e3b0943 | 2023-08-07 09:30:02 -0700 | [diff] [blame] | 3373 | const struct upb_MiniTable** msgs; |
| 3374 | const struct upb_MiniTableEnum** enums; |
| 3375 | const struct upb_MiniTableExtension** exts; |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 3376 | int msg_count; |
| 3377 | int enum_count; |
| 3378 | int ext_count; |
| 3379 | }; |
| 3380 | |
| 3381 | |
| 3382 | #endif /* UPB_MINI_TABLE_INTERNAL_FILE_H_ */ |
| 3383 | |
| 3384 | typedef struct upb_MiniTableFile upb_MiniTableFile; |
| 3385 | |
| 3386 | #endif /* UPB_MINI_TABLE_FILE_H_ */ |
| 3387 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 3388 | // upb_decode: parsing into a upb_Message using a upb_MiniTable. |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3389 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 3390 | #ifndef UPB_WIRE_DECODE_H_ |
| 3391 | #define UPB_WIRE_DECODE_H_ |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3392 | |
| 3393 | |
Adam Cozzette | 7d5592e | 2023-08-23 12:15:26 -0700 | [diff] [blame] | 3394 | #ifndef UPB_WIRE_TYPES_H_ |
| 3395 | #define UPB_WIRE_TYPES_H_ |
| 3396 | |
| 3397 | #define kUpb_WireFormat_DefaultDepthLimit 100 |
| 3398 | |
| 3399 | // A list of types as they are encoded on the wire. |
| 3400 | typedef enum { |
| 3401 | kUpb_WireType_Varint = 0, |
| 3402 | kUpb_WireType_64Bit = 1, |
| 3403 | kUpb_WireType_Delimited = 2, |
| 3404 | kUpb_WireType_StartGroup = 3, |
| 3405 | kUpb_WireType_EndGroup = 4, |
| 3406 | kUpb_WireType_32Bit = 5 |
| 3407 | } upb_WireType; |
| 3408 | |
| 3409 | #endif /* UPB_WIRE_TYPES_H_ */ |
| 3410 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3411 | // Must be last. |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3412 | |
| 3413 | #ifdef __cplusplus |
| 3414 | extern "C" { |
| 3415 | #endif |
| 3416 | |
| 3417 | enum { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3418 | /* If set, strings will alias the input buffer instead of copying into the |
| 3419 | * arena. */ |
| 3420 | kUpb_DecodeOption_AliasString = 1, |
| 3421 | |
| 3422 | /* If set, the parse will return failure if any message is missing any |
| 3423 | * required fields when the message data ends. The parse will still continue, |
| 3424 | * and the failure will only be reported at the end. |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3425 | * |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3426 | * IMPORTANT CAVEATS: |
| 3427 | * |
| 3428 | * 1. This can throw a false positive failure if an incomplete message is seen |
| 3429 | * on the wire but is later completed when the sub-message occurs again. |
| 3430 | * For this reason, a second pass is required to verify a failure, to be |
| 3431 | * truly robust. |
| 3432 | * |
| 3433 | * 2. This can return a false success if you are decoding into a message that |
| 3434 | * already has some sub-message fields present. If the sub-message does |
| 3435 | * not occur in the binary payload, we will never visit it and discover the |
| 3436 | * incomplete sub-message. For this reason, this check is only useful for |
| 3437 | * implemting ParseFromString() semantics. For MergeFromString(), a |
| 3438 | * post-parse validation step will always be necessary. */ |
| 3439 | kUpb_DecodeOption_CheckRequired = 2, |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 3440 | |
| 3441 | /* EXPERIMENTAL: |
| 3442 | * |
| 3443 | * If set, the parser will allow parsing of sub-message fields that were not |
| 3444 | * previously linked using upb_MiniTable_SetSubMessage(). The data will be |
| 3445 | * parsed into an internal "empty" message type that cannot be accessed |
| 3446 | * directly, but can be later promoted into the true message type if the |
| 3447 | * sub-message fields are linked at a later time. |
| 3448 | * |
| 3449 | * Users should set this option if they intend to perform dynamic tree shaking |
| 3450 | * and promoting using the interfaces in message/promote.h. If this option is |
| 3451 | * enabled, it is important that the resulting messages are only accessed by |
| 3452 | * code that is aware of promotion rules: |
| 3453 | * |
| 3454 | * 1. Message pointers in upb_Message, upb_Array, and upb_Map are represented |
| 3455 | * by a tagged pointer upb_TaggedMessagePointer. The tag indicates whether |
| 3456 | * the message uses the internal "empty" type. |
| 3457 | * |
| 3458 | * 2. Any code *reading* these message pointers must test whether the "empty" |
| 3459 | * tag bit is set, using the interfaces in mini_table/types.h. However |
| 3460 | * writing of message pointers should always use plain upb_Message*, since |
| 3461 | * users are not allowed to create "empty" messages. |
| 3462 | * |
| 3463 | * 3. It is always safe to test whether a field is present or test the array |
| 3464 | * length; these interfaces will reflect that empty messages are present, |
| 3465 | * even though their data cannot be accessed without promoting first. |
| 3466 | * |
| 3467 | * 4. If a message pointer is indeed tagged as empty, the message may not be |
| 3468 | * accessed directly, only promoted through the interfaces in |
| 3469 | * message/promote.h. |
| 3470 | * |
| 3471 | * 5. Tagged/empty messages may never be created by the user. They may only |
| 3472 | * be created by the parser or the message-copying logic in message/copy.h. |
| 3473 | */ |
| 3474 | kUpb_DecodeOption_ExperimentalAllowUnlinked = 4, |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3475 | }; |
| 3476 | |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 3477 | UPB_INLINE uint32_t upb_DecodeOptions_MaxDepth(uint16_t depth) { |
| 3478 | return (uint32_t)depth << 16; |
| 3479 | } |
| 3480 | |
| 3481 | UPB_INLINE uint16_t upb_DecodeOptions_GetMaxDepth(uint32_t options) { |
| 3482 | return options >> 16; |
| 3483 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3484 | |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 3485 | // Enforce an upper bound on recursion depth. |
| 3486 | 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] | 3487 | uint32_t max_depth = upb_DecodeOptions_GetMaxDepth(decode_options); |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 3488 | if (max_depth > limit) max_depth = limit; |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 3489 | return upb_DecodeOptions_MaxDepth(max_depth) | (decode_options & 0xffff); |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 3490 | } |
| 3491 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3492 | typedef enum { |
| 3493 | kUpb_DecodeStatus_Ok = 0, |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 3494 | kUpb_DecodeStatus_Malformed = 1, // Wire format was corrupt |
| 3495 | kUpb_DecodeStatus_OutOfMemory = 2, // Arena alloc failed |
| 3496 | kUpb_DecodeStatus_BadUtf8 = 3, // String field had bad UTF-8 |
| 3497 | kUpb_DecodeStatus_MaxDepthExceeded = |
| 3498 | 4, // Exceeded upb_DecodeOptions_MaxDepth |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3499 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3500 | // kUpb_DecodeOption_CheckRequired failed (see above), but the parse otherwise |
| 3501 | // succeeded. |
| 3502 | kUpb_DecodeStatus_MissingRequired = 5, |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 3503 | |
| 3504 | // Unlinked sub-message field was present, but |
| 3505 | // kUpb_DecodeOptions_ExperimentalAllowUnlinked was not specified in the list |
| 3506 | // of options. |
| 3507 | kUpb_DecodeStatus_UnlinkedSubMessage = 6, |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3508 | } upb_DecodeStatus; |
| 3509 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 3510 | UPB_API upb_DecodeStatus upb_Decode(const char* buf, size_t size, |
| 3511 | upb_Message* msg, const upb_MiniTable* l, |
| 3512 | const upb_ExtensionRegistry* extreg, |
| 3513 | int options, upb_Arena* arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3514 | |
| 3515 | #ifdef __cplusplus |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 3516 | } /* extern "C" */ |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3517 | #endif |
| 3518 | |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 3519 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 3520 | #endif /* UPB_WIRE_DECODE_H_ */ |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3521 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3522 | // These are the specialized field parser functions for the fast parser. |
| 3523 | // Generated tables will refer to these by name. |
| 3524 | // |
| 3525 | // The function names are encoded with names like: |
| 3526 | // |
| 3527 | // // 123 4 |
| 3528 | // upb_pss_1bt(); // Parse singular string, 1 byte tag. |
| 3529 | // |
| 3530 | // In position 1: |
| 3531 | // - 'p' for parse, most function use this |
| 3532 | // - 'c' for copy, for when we are copying strings instead of aliasing |
| 3533 | // |
| 3534 | // In position 2 (cardinality): |
| 3535 | // - 's' for singular, with or without hasbit |
| 3536 | // - 'o' for oneof |
| 3537 | // - 'r' for non-packed repeated |
| 3538 | // - 'p' for packed repeated |
| 3539 | // |
| 3540 | // In position 3 (type): |
| 3541 | // - 'b1' for bool |
| 3542 | // - 'v4' for 4-byte varint |
| 3543 | // - 'v8' for 8-byte varint |
| 3544 | // - 'z4' for zig-zag-encoded 4-byte varint |
| 3545 | // - 'z8' for zig-zag-encoded 8-byte varint |
| 3546 | // - 'f4' for 4-byte fixed |
| 3547 | // - 'f8' for 8-byte fixed |
| 3548 | // - 'm' for sub-message |
| 3549 | // - 's' for string (validate UTF-8) |
| 3550 | // - 'b' for bytes |
| 3551 | // |
| 3552 | // In position 4 (tag length): |
| 3553 | // - '1' for one-byte tags (field numbers 1-15) |
| 3554 | // - '2' for two-byte tags (field numbers 16-2048) |
| 3555 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 3556 | #ifndef UPB_WIRE_DECODE_FAST_H_ |
| 3557 | #define UPB_WIRE_DECODE_FAST_H_ |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3558 | |
| 3559 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3560 | // Must be last. |
| 3561 | |
| 3562 | #ifdef __cplusplus |
| 3563 | extern "C" { |
| 3564 | #endif |
| 3565 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 3566 | struct upb_Decoder; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3567 | |
| 3568 | // The fallback, generic parsing function that can handle any field type. |
| 3569 | // 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] | 3570 | const char* _upb_FastDecoder_DecodeGeneric(struct upb_Decoder* d, |
| 3571 | const char* ptr, upb_Message* msg, |
| 3572 | intptr_t table, uint64_t hasbits, |
| 3573 | uint64_t data); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3574 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 3575 | #define UPB_PARSE_PARAMS \ |
| 3576 | 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] | 3577 | uint64_t hasbits, uint64_t data |
| 3578 | |
| 3579 | /* primitive fields ***********************************************************/ |
| 3580 | |
| 3581 | #define F(card, type, valbytes, tagbytes) \ |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 3582 | const char* upb_p##card##type##valbytes##_##tagbytes##bt(UPB_PARSE_PARAMS); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3583 | |
| 3584 | #define TYPES(card, tagbytes) \ |
| 3585 | F(card, b, 1, tagbytes) \ |
| 3586 | F(card, v, 4, tagbytes) \ |
| 3587 | F(card, v, 8, tagbytes) \ |
| 3588 | F(card, z, 4, tagbytes) \ |
| 3589 | F(card, z, 8, tagbytes) \ |
| 3590 | F(card, f, 4, tagbytes) \ |
| 3591 | F(card, f, 8, tagbytes) |
| 3592 | |
| 3593 | #define TAGBYTES(card) \ |
| 3594 | TYPES(card, 1) \ |
| 3595 | TYPES(card, 2) |
| 3596 | |
| 3597 | TAGBYTES(s) |
| 3598 | TAGBYTES(o) |
| 3599 | TAGBYTES(r) |
| 3600 | TAGBYTES(p) |
| 3601 | |
| 3602 | #undef F |
| 3603 | #undef TYPES |
| 3604 | #undef TAGBYTES |
| 3605 | |
| 3606 | /* string fields **************************************************************/ |
| 3607 | |
| 3608 | #define F(card, tagbytes, type) \ |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 3609 | const char* upb_p##card##type##_##tagbytes##bt(UPB_PARSE_PARAMS); \ |
| 3610 | const char* upb_c##card##type##_##tagbytes##bt(UPB_PARSE_PARAMS); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3611 | |
| 3612 | #define UTF8(card, tagbytes) \ |
| 3613 | F(card, tagbytes, s) \ |
| 3614 | F(card, tagbytes, b) |
| 3615 | |
| 3616 | #define TAGBYTES(card) \ |
| 3617 | UTF8(card, 1) \ |
| 3618 | UTF8(card, 2) |
| 3619 | |
| 3620 | TAGBYTES(s) |
| 3621 | TAGBYTES(o) |
| 3622 | TAGBYTES(r) |
| 3623 | |
| 3624 | #undef F |
| 3625 | #undef TAGBYTES |
| 3626 | |
| 3627 | /* sub-message fields *********************************************************/ |
| 3628 | |
| 3629 | #define F(card, tagbytes, size_ceil, ceil_arg) \ |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 3630 | 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] | 3631 | |
| 3632 | #define SIZES(card, tagbytes) \ |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 3633 | F(card, tagbytes, 64, 64) \ |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3634 | F(card, tagbytes, 128, 128) \ |
| 3635 | F(card, tagbytes, 192, 192) \ |
| 3636 | F(card, tagbytes, 256, 256) \ |
| 3637 | F(card, tagbytes, max, -1) |
| 3638 | |
| 3639 | #define TAGBYTES(card) \ |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 3640 | SIZES(card, 1) \ |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3641 | SIZES(card, 2) |
| 3642 | |
| 3643 | TAGBYTES(s) |
| 3644 | TAGBYTES(o) |
| 3645 | TAGBYTES(r) |
| 3646 | |
| 3647 | #undef TAGBYTES |
| 3648 | #undef SIZES |
| 3649 | #undef F |
| 3650 | |
| 3651 | #undef UPB_PARSE_PARAMS |
| 3652 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3653 | #ifdef __cplusplus |
| 3654 | } /* extern "C" */ |
| 3655 | #endif |
| 3656 | |
| 3657 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 3658 | #endif /* UPB_WIRE_DECODE_FAST_H_ */ |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 3659 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 3660 | // upb_Encode: parsing from a upb_Message using a upb_MiniTable. |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3661 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 3662 | #ifndef UPB_WIRE_ENCODE_H_ |
| 3663 | #define UPB_WIRE_ENCODE_H_ |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3664 | |
| 3665 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3666 | // Must be last. |
| 3667 | |
| 3668 | #ifdef __cplusplus |
| 3669 | extern "C" { |
| 3670 | #endif |
| 3671 | |
| 3672 | enum { |
| 3673 | /* If set, the results of serializing will be deterministic across all |
| 3674 | * instances of this binary. There are no guarantees across different |
| 3675 | * binary builds. |
| 3676 | * |
| 3677 | * If your proto contains maps, the encoder will need to malloc()/free() |
| 3678 | * memory during encode. */ |
| 3679 | kUpb_EncodeOption_Deterministic = 1, |
| 3680 | |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 3681 | // When set, unknown fields are not printed. |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3682 | kUpb_EncodeOption_SkipUnknown = 2, |
| 3683 | |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 3684 | // When set, the encode will fail if any required fields are missing. |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3685 | kUpb_EncodeOption_CheckRequired = 4, |
| 3686 | }; |
| 3687 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3688 | typedef enum { |
| 3689 | kUpb_EncodeStatus_Ok = 0, |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 3690 | kUpb_EncodeStatus_OutOfMemory = 1, // Arena alloc failed |
| 3691 | kUpb_EncodeStatus_MaxDepthExceeded = 2, |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3692 | |
| 3693 | // kUpb_EncodeOption_CheckRequired failed but the parse otherwise succeeded. |
| 3694 | kUpb_EncodeStatus_MissingRequired = 3, |
| 3695 | } upb_EncodeStatus; |
| 3696 | |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 3697 | UPB_INLINE uint32_t upb_EncodeOptions_MaxDepth(uint16_t depth) { |
| 3698 | return (uint32_t)depth << 16; |
| 3699 | } |
| 3700 | |
| 3701 | UPB_INLINE uint16_t upb_EncodeOptions_GetMaxDepth(uint32_t options) { |
| 3702 | return options >> 16; |
| 3703 | } |
| 3704 | |
| 3705 | // Enforce an upper bound on recursion depth. |
| 3706 | UPB_INLINE int upb_Encode_LimitDepth(uint32_t encode_options, uint32_t limit) { |
| 3707 | uint32_t max_depth = upb_EncodeOptions_GetMaxDepth(encode_options); |
| 3708 | if (max_depth > limit) max_depth = limit; |
| 3709 | return upb_EncodeOptions_MaxDepth(max_depth) | (encode_options & 0xffff); |
| 3710 | } |
| 3711 | |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 3712 | UPB_API upb_EncodeStatus upb_Encode(const void* msg, const upb_MiniTable* l, |
| 3713 | int options, upb_Arena* arena, char** buf, |
| 3714 | size_t* size); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3715 | |
| 3716 | #ifdef __cplusplus |
| 3717 | } /* extern "C" */ |
| 3718 | #endif |
| 3719 | |
| 3720 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 3721 | #endif /* UPB_WIRE_ENCODE_H_ */ |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 3722 | // IWYU pragma: end_exports |
| 3723 | |
| 3724 | #endif // UPB_GENERATED_CODE_SUPPORT_H_ |
| 3725 | /* This file was generated by upbc (the upb compiler) from the input |
| 3726 | * file: |
| 3727 | * |
| 3728 | * google/protobuf/descriptor.proto |
| 3729 | * |
| 3730 | * Do not edit -- your changes will be discarded when the file is |
| 3731 | * regenerated. */ |
| 3732 | |
| 3733 | #ifndef GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_H_ |
| 3734 | #define GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_H_ |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3735 | |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 3736 | // Must be last. |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3737 | |
| 3738 | #ifdef __cplusplus |
| 3739 | extern "C" { |
| 3740 | #endif |
| 3741 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3742 | typedef struct google_protobuf_FileDescriptorSet google_protobuf_FileDescriptorSet; |
| 3743 | typedef struct google_protobuf_FileDescriptorProto google_protobuf_FileDescriptorProto; |
| 3744 | typedef struct google_protobuf_DescriptorProto google_protobuf_DescriptorProto; |
| 3745 | typedef struct google_protobuf_DescriptorProto_ExtensionRange google_protobuf_DescriptorProto_ExtensionRange; |
| 3746 | typedef struct google_protobuf_DescriptorProto_ReservedRange google_protobuf_DescriptorProto_ReservedRange; |
| 3747 | typedef struct google_protobuf_ExtensionRangeOptions google_protobuf_ExtensionRangeOptions; |
Mike Kruskal | 145900f | 2023-03-27 09:55:52 -0700 | [diff] [blame] | 3748 | typedef struct google_protobuf_ExtensionRangeOptions_Declaration google_protobuf_ExtensionRangeOptions_Declaration; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3749 | typedef struct google_protobuf_FieldDescriptorProto google_protobuf_FieldDescriptorProto; |
| 3750 | typedef struct google_protobuf_OneofDescriptorProto google_protobuf_OneofDescriptorProto; |
| 3751 | typedef struct google_protobuf_EnumDescriptorProto google_protobuf_EnumDescriptorProto; |
| 3752 | typedef struct google_protobuf_EnumDescriptorProto_EnumReservedRange google_protobuf_EnumDescriptorProto_EnumReservedRange; |
| 3753 | typedef struct google_protobuf_EnumValueDescriptorProto google_protobuf_EnumValueDescriptorProto; |
| 3754 | typedef struct google_protobuf_ServiceDescriptorProto google_protobuf_ServiceDescriptorProto; |
| 3755 | typedef struct google_protobuf_MethodDescriptorProto google_protobuf_MethodDescriptorProto; |
| 3756 | typedef struct google_protobuf_FileOptions google_protobuf_FileOptions; |
| 3757 | typedef struct google_protobuf_MessageOptions google_protobuf_MessageOptions; |
| 3758 | typedef struct google_protobuf_FieldOptions google_protobuf_FieldOptions; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 3759 | typedef struct google_protobuf_FieldOptions_EditionDefault google_protobuf_FieldOptions_EditionDefault; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3760 | typedef struct google_protobuf_OneofOptions google_protobuf_OneofOptions; |
| 3761 | typedef struct google_protobuf_EnumOptions google_protobuf_EnumOptions; |
| 3762 | typedef struct google_protobuf_EnumValueOptions google_protobuf_EnumValueOptions; |
| 3763 | typedef struct google_protobuf_ServiceOptions google_protobuf_ServiceOptions; |
| 3764 | typedef struct google_protobuf_MethodOptions google_protobuf_MethodOptions; |
| 3765 | typedef struct google_protobuf_UninterpretedOption google_protobuf_UninterpretedOption; |
| 3766 | typedef struct google_protobuf_UninterpretedOption_NamePart google_protobuf_UninterpretedOption_NamePart; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 3767 | typedef struct google_protobuf_FeatureSet google_protobuf_FeatureSet; |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 3768 | typedef struct google_protobuf_FeatureSetDefaults google_protobuf_FeatureSetDefaults; |
| 3769 | typedef struct google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3770 | typedef struct google_protobuf_SourceCodeInfo google_protobuf_SourceCodeInfo; |
| 3771 | typedef struct google_protobuf_SourceCodeInfo_Location google_protobuf_SourceCodeInfo_Location; |
| 3772 | typedef struct google_protobuf_GeneratedCodeInfo google_protobuf_GeneratedCodeInfo; |
| 3773 | typedef struct google_protobuf_GeneratedCodeInfo_Annotation google_protobuf_GeneratedCodeInfo_Annotation; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3774 | extern const upb_MiniTable google_protobuf_FileDescriptorSet_msg_init; |
| 3775 | extern const upb_MiniTable google_protobuf_FileDescriptorProto_msg_init; |
| 3776 | extern const upb_MiniTable google_protobuf_DescriptorProto_msg_init; |
| 3777 | extern const upb_MiniTable google_protobuf_DescriptorProto_ExtensionRange_msg_init; |
| 3778 | extern const upb_MiniTable google_protobuf_DescriptorProto_ReservedRange_msg_init; |
| 3779 | extern const upb_MiniTable google_protobuf_ExtensionRangeOptions_msg_init; |
Mike Kruskal | 145900f | 2023-03-27 09:55:52 -0700 | [diff] [blame] | 3780 | extern const upb_MiniTable google_protobuf_ExtensionRangeOptions_Declaration_msg_init; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3781 | extern const upb_MiniTable google_protobuf_FieldDescriptorProto_msg_init; |
| 3782 | extern const upb_MiniTable google_protobuf_OneofDescriptorProto_msg_init; |
| 3783 | extern const upb_MiniTable google_protobuf_EnumDescriptorProto_msg_init; |
| 3784 | extern const upb_MiniTable google_protobuf_EnumDescriptorProto_EnumReservedRange_msg_init; |
| 3785 | extern const upb_MiniTable google_protobuf_EnumValueDescriptorProto_msg_init; |
| 3786 | extern const upb_MiniTable google_protobuf_ServiceDescriptorProto_msg_init; |
| 3787 | extern const upb_MiniTable google_protobuf_MethodDescriptorProto_msg_init; |
| 3788 | extern const upb_MiniTable google_protobuf_FileOptions_msg_init; |
| 3789 | extern const upb_MiniTable google_protobuf_MessageOptions_msg_init; |
| 3790 | extern const upb_MiniTable google_protobuf_FieldOptions_msg_init; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 3791 | extern const upb_MiniTable google_protobuf_FieldOptions_EditionDefault_msg_init; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3792 | extern const upb_MiniTable google_protobuf_OneofOptions_msg_init; |
| 3793 | extern const upb_MiniTable google_protobuf_EnumOptions_msg_init; |
| 3794 | extern const upb_MiniTable google_protobuf_EnumValueOptions_msg_init; |
| 3795 | extern const upb_MiniTable google_protobuf_ServiceOptions_msg_init; |
| 3796 | extern const upb_MiniTable google_protobuf_MethodOptions_msg_init; |
| 3797 | extern const upb_MiniTable google_protobuf_UninterpretedOption_msg_init; |
| 3798 | extern const upb_MiniTable google_protobuf_UninterpretedOption_NamePart_msg_init; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 3799 | extern const upb_MiniTable google_protobuf_FeatureSet_msg_init; |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 3800 | extern const upb_MiniTable google_protobuf_FeatureSetDefaults_msg_init; |
| 3801 | extern const upb_MiniTable google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_msg_init; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3802 | extern const upb_MiniTable google_protobuf_SourceCodeInfo_msg_init; |
| 3803 | extern const upb_MiniTable google_protobuf_SourceCodeInfo_Location_msg_init; |
| 3804 | extern const upb_MiniTable google_protobuf_GeneratedCodeInfo_msg_init; |
| 3805 | extern const upb_MiniTable google_protobuf_GeneratedCodeInfo_Annotation_msg_init; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3806 | |
| 3807 | typedef enum { |
Protobuf Team Bot | fa98bb3 | 2023-09-01 18:11:09 +0000 | [diff] [blame] | 3808 | google_protobuf_EDITION_UNKNOWN = 0, |
| 3809 | google_protobuf_EDITION_1_TEST_ONLY = 1, |
| 3810 | google_protobuf_EDITION_2_TEST_ONLY = 2, |
| 3811 | google_protobuf_EDITION_2023 = 1000, |
| 3812 | google_protobuf_EDITION_99997_TEST_ONLY = 99997, |
| 3813 | google_protobuf_EDITION_99998_TEST_ONLY = 99998, |
| 3814 | google_protobuf_EDITION_99999_TEST_ONLY = 99999 |
| 3815 | } google_protobuf_Edition; |
| 3816 | |
| 3817 | typedef enum { |
Protobuf Team Bot | 469f027 | 2023-04-21 18:12:45 -0700 | [diff] [blame] | 3818 | google_protobuf_ExtensionRangeOptions_DECLARATION = 0, |
| 3819 | google_protobuf_ExtensionRangeOptions_UNVERIFIED = 1 |
| 3820 | } google_protobuf_ExtensionRangeOptions_VerificationState; |
| 3821 | |
| 3822 | typedef enum { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 3823 | google_protobuf_FeatureSet_ENUM_TYPE_UNKNOWN = 0, |
| 3824 | google_protobuf_FeatureSet_OPEN = 1, |
| 3825 | google_protobuf_FeatureSet_CLOSED = 2 |
| 3826 | } google_protobuf_FeatureSet_EnumType; |
| 3827 | |
| 3828 | typedef enum { |
| 3829 | google_protobuf_FeatureSet_FIELD_PRESENCE_UNKNOWN = 0, |
| 3830 | google_protobuf_FeatureSet_EXPLICIT = 1, |
| 3831 | google_protobuf_FeatureSet_IMPLICIT = 2, |
| 3832 | google_protobuf_FeatureSet_LEGACY_REQUIRED = 3 |
| 3833 | } google_protobuf_FeatureSet_FieldPresence; |
| 3834 | |
| 3835 | typedef enum { |
| 3836 | google_protobuf_FeatureSet_JSON_FORMAT_UNKNOWN = 0, |
| 3837 | google_protobuf_FeatureSet_ALLOW = 1, |
| 3838 | google_protobuf_FeatureSet_LEGACY_BEST_EFFORT = 2 |
| 3839 | } google_protobuf_FeatureSet_JsonFormat; |
| 3840 | |
| 3841 | typedef enum { |
| 3842 | google_protobuf_FeatureSet_MESSAGE_ENCODING_UNKNOWN = 0, |
| 3843 | google_protobuf_FeatureSet_LENGTH_PREFIXED = 1, |
| 3844 | google_protobuf_FeatureSet_DELIMITED = 2 |
| 3845 | } google_protobuf_FeatureSet_MessageEncoding; |
| 3846 | |
| 3847 | typedef enum { |
| 3848 | google_protobuf_FeatureSet_REPEATED_FIELD_ENCODING_UNKNOWN = 0, |
| 3849 | google_protobuf_FeatureSet_PACKED = 1, |
| 3850 | google_protobuf_FeatureSet_EXPANDED = 2 |
| 3851 | } google_protobuf_FeatureSet_RepeatedFieldEncoding; |
| 3852 | |
| 3853 | typedef enum { |
Mike Kruskal | ccbdaa7 | 2023-02-02 20:42:14 -0800 | [diff] [blame] | 3854 | google_protobuf_FieldDescriptorProto_LABEL_OPTIONAL = 1, |
| 3855 | google_protobuf_FieldDescriptorProto_LABEL_REQUIRED = 2, |
| 3856 | google_protobuf_FieldDescriptorProto_LABEL_REPEATED = 3 |
| 3857 | } google_protobuf_FieldDescriptorProto_Label; |
| 3858 | |
| 3859 | typedef enum { |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3860 | google_protobuf_FieldDescriptorProto_TYPE_DOUBLE = 1, |
| 3861 | google_protobuf_FieldDescriptorProto_TYPE_FLOAT = 2, |
| 3862 | google_protobuf_FieldDescriptorProto_TYPE_INT64 = 3, |
| 3863 | google_protobuf_FieldDescriptorProto_TYPE_UINT64 = 4, |
| 3864 | google_protobuf_FieldDescriptorProto_TYPE_INT32 = 5, |
| 3865 | google_protobuf_FieldDescriptorProto_TYPE_FIXED64 = 6, |
| 3866 | google_protobuf_FieldDescriptorProto_TYPE_FIXED32 = 7, |
| 3867 | google_protobuf_FieldDescriptorProto_TYPE_BOOL = 8, |
| 3868 | google_protobuf_FieldDescriptorProto_TYPE_STRING = 9, |
| 3869 | google_protobuf_FieldDescriptorProto_TYPE_GROUP = 10, |
| 3870 | google_protobuf_FieldDescriptorProto_TYPE_MESSAGE = 11, |
| 3871 | google_protobuf_FieldDescriptorProto_TYPE_BYTES = 12, |
| 3872 | google_protobuf_FieldDescriptorProto_TYPE_UINT32 = 13, |
| 3873 | google_protobuf_FieldDescriptorProto_TYPE_ENUM = 14, |
| 3874 | google_protobuf_FieldDescriptorProto_TYPE_SFIXED32 = 15, |
| 3875 | google_protobuf_FieldDescriptorProto_TYPE_SFIXED64 = 16, |
| 3876 | google_protobuf_FieldDescriptorProto_TYPE_SINT32 = 17, |
| 3877 | google_protobuf_FieldDescriptorProto_TYPE_SINT64 = 18 |
| 3878 | } google_protobuf_FieldDescriptorProto_Type; |
| 3879 | |
| 3880 | typedef enum { |
| 3881 | google_protobuf_FieldOptions_STRING = 0, |
| 3882 | google_protobuf_FieldOptions_CORD = 1, |
| 3883 | google_protobuf_FieldOptions_STRING_PIECE = 2 |
| 3884 | } google_protobuf_FieldOptions_CType; |
| 3885 | |
| 3886 | typedef enum { |
| 3887 | google_protobuf_FieldOptions_JS_NORMAL = 0, |
| 3888 | google_protobuf_FieldOptions_JS_STRING = 1, |
| 3889 | google_protobuf_FieldOptions_JS_NUMBER = 2 |
| 3890 | } google_protobuf_FieldOptions_JSType; |
| 3891 | |
| 3892 | typedef enum { |
Adam Cozzette | 90ff32c | 2023-01-21 15:04:56 -0800 | [diff] [blame] | 3893 | google_protobuf_FieldOptions_RETENTION_UNKNOWN = 0, |
| 3894 | google_protobuf_FieldOptions_RETENTION_RUNTIME = 1, |
| 3895 | google_protobuf_FieldOptions_RETENTION_SOURCE = 2 |
| 3896 | } google_protobuf_FieldOptions_OptionRetention; |
| 3897 | |
| 3898 | typedef enum { |
| 3899 | google_protobuf_FieldOptions_TARGET_TYPE_UNKNOWN = 0, |
| 3900 | google_protobuf_FieldOptions_TARGET_TYPE_FILE = 1, |
| 3901 | google_protobuf_FieldOptions_TARGET_TYPE_EXTENSION_RANGE = 2, |
| 3902 | google_protobuf_FieldOptions_TARGET_TYPE_MESSAGE = 3, |
| 3903 | google_protobuf_FieldOptions_TARGET_TYPE_FIELD = 4, |
| 3904 | google_protobuf_FieldOptions_TARGET_TYPE_ONEOF = 5, |
| 3905 | google_protobuf_FieldOptions_TARGET_TYPE_ENUM = 6, |
| 3906 | google_protobuf_FieldOptions_TARGET_TYPE_ENUM_ENTRY = 7, |
| 3907 | google_protobuf_FieldOptions_TARGET_TYPE_SERVICE = 8, |
| 3908 | google_protobuf_FieldOptions_TARGET_TYPE_METHOD = 9 |
| 3909 | } google_protobuf_FieldOptions_OptionTargetType; |
| 3910 | |
| 3911 | typedef enum { |
Mike Kruskal | ccbdaa7 | 2023-02-02 20:42:14 -0800 | [diff] [blame] | 3912 | google_protobuf_FileOptions_SPEED = 1, |
| 3913 | google_protobuf_FileOptions_CODE_SIZE = 2, |
| 3914 | google_protobuf_FileOptions_LITE_RUNTIME = 3 |
| 3915 | } google_protobuf_FileOptions_OptimizeMode; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3916 | |
| 3917 | typedef enum { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3918 | google_protobuf_GeneratedCodeInfo_Annotation_NONE = 0, |
| 3919 | google_protobuf_GeneratedCodeInfo_Annotation_SET = 1, |
| 3920 | google_protobuf_GeneratedCodeInfo_Annotation_ALIAS = 2 |
| 3921 | } google_protobuf_GeneratedCodeInfo_Annotation_Semantic; |
| 3922 | |
Mike Kruskal | ccbdaa7 | 2023-02-02 20:42:14 -0800 | [diff] [blame] | 3923 | typedef enum { |
| 3924 | google_protobuf_MethodOptions_IDEMPOTENCY_UNKNOWN = 0, |
| 3925 | google_protobuf_MethodOptions_NO_SIDE_EFFECTS = 1, |
| 3926 | google_protobuf_MethodOptions_IDEMPOTENT = 2 |
| 3927 | } google_protobuf_MethodOptions_IdempotencyLevel; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3928 | |
Mike Kruskal | ccbdaa7 | 2023-02-02 20:42:14 -0800 | [diff] [blame] | 3929 | |
Protobuf Team Bot | fa98bb3 | 2023-09-01 18:11:09 +0000 | [diff] [blame] | 3930 | extern const upb_MiniTableEnum google_protobuf_Edition_enum_init; |
Protobuf Team Bot | 469f027 | 2023-04-21 18:12:45 -0700 | [diff] [blame] | 3931 | extern const upb_MiniTableEnum google_protobuf_ExtensionRangeOptions_VerificationState_enum_init; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 3932 | extern const upb_MiniTableEnum google_protobuf_FeatureSet_EnumType_enum_init; |
| 3933 | extern const upb_MiniTableEnum google_protobuf_FeatureSet_FieldPresence_enum_init; |
| 3934 | extern const upb_MiniTableEnum google_protobuf_FeatureSet_JsonFormat_enum_init; |
| 3935 | extern const upb_MiniTableEnum google_protobuf_FeatureSet_MessageEncoding_enum_init; |
| 3936 | extern const upb_MiniTableEnum google_protobuf_FeatureSet_RepeatedFieldEncoding_enum_init; |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 3937 | extern const upb_MiniTableEnum google_protobuf_FieldDescriptorProto_Label_enum_init; |
Mike Kruskal | ccbdaa7 | 2023-02-02 20:42:14 -0800 | [diff] [blame] | 3938 | extern const upb_MiniTableEnum google_protobuf_FieldDescriptorProto_Type_enum_init; |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 3939 | extern const upb_MiniTableEnum google_protobuf_FieldOptions_CType_enum_init; |
| 3940 | extern const upb_MiniTableEnum google_protobuf_FieldOptions_JSType_enum_init; |
Adam Cozzette | 90ff32c | 2023-01-21 15:04:56 -0800 | [diff] [blame] | 3941 | extern const upb_MiniTableEnum google_protobuf_FieldOptions_OptionRetention_enum_init; |
| 3942 | extern const upb_MiniTableEnum google_protobuf_FieldOptions_OptionTargetType_enum_init; |
Mike Kruskal | ccbdaa7 | 2023-02-02 20:42:14 -0800 | [diff] [blame] | 3943 | extern const upb_MiniTableEnum google_protobuf_FileOptions_OptimizeMode_enum_init; |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 3944 | extern const upb_MiniTableEnum google_protobuf_GeneratedCodeInfo_Annotation_Semantic_enum_init; |
Mike Kruskal | ccbdaa7 | 2023-02-02 20:42:14 -0800 | [diff] [blame] | 3945 | extern const upb_MiniTableEnum google_protobuf_MethodOptions_IdempotencyLevel_enum_init; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 3946 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3947 | /* google.protobuf.FileDescriptorSet */ |
| 3948 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 3949 | UPB_INLINE google_protobuf_FileDescriptorSet* google_protobuf_FileDescriptorSet_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3950 | 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] | 3951 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 3952 | UPB_INLINE google_protobuf_FileDescriptorSet* google_protobuf_FileDescriptorSet_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 3953 | google_protobuf_FileDescriptorSet* ret = google_protobuf_FileDescriptorSet_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 3954 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3955 | 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] | 3956 | return NULL; |
| 3957 | } |
| 3958 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3959 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 3960 | UPB_INLINE google_protobuf_FileDescriptorSet* google_protobuf_FileDescriptorSet_parse_ex(const char* buf, size_t size, |
| 3961 | const upb_ExtensionRegistry* extreg, |
| 3962 | int options, upb_Arena* arena) { |
| 3963 | google_protobuf_FileDescriptorSet* ret = google_protobuf_FileDescriptorSet_new(arena); |
| 3964 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3965 | 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] | 3966 | kUpb_DecodeStatus_Ok) { |
| 3967 | return NULL; |
| 3968 | } |
| 3969 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3970 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 3971 | 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] | 3972 | char* ptr; |
| 3973 | (void)upb_Encode(msg, &google_protobuf_FileDescriptorSet_msg_init, 0, arena, &ptr, len); |
| 3974 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 3975 | } |
| 3976 | UPB_INLINE char* google_protobuf_FileDescriptorSet_serialize_ex(const google_protobuf_FileDescriptorSet* msg, int options, |
| 3977 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3978 | char* ptr; |
| 3979 | (void)upb_Encode(msg, &google_protobuf_FileDescriptorSet_msg_init, options, arena, &ptr, len); |
| 3980 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 3981 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 3982 | UPB_INLINE void google_protobuf_FileDescriptorSet_clear_file(google_protobuf_FileDescriptorSet* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 3983 | 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] | 3984 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3985 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 3986 | 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] | 3987 | 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] | 3988 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 3989 | if (arr) { |
| 3990 | if (size) *size = arr->size; |
| 3991 | return (const google_protobuf_FileDescriptorProto* const*)_upb_array_constptr(arr); |
| 3992 | } else { |
| 3993 | if (size) *size = 0; |
| 3994 | return NULL; |
| 3995 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 3996 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 3997 | 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] | 3998 | 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] | 3999 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4000 | if (size) { |
| 4001 | *size = arr ? arr->size : 0; |
| 4002 | } |
| 4003 | return arr; |
| 4004 | } |
| 4005 | 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] | 4006 | 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] | 4007 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 4008 | (upb_Message*)msg, &field, arena); |
| 4009 | if (size) { |
| 4010 | *size = arr ? arr->size : 0; |
| 4011 | } |
| 4012 | return arr; |
| 4013 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4014 | UPB_INLINE bool google_protobuf_FileDescriptorSet_has_file(const google_protobuf_FileDescriptorSet* msg) { |
| 4015 | size_t size; |
| 4016 | google_protobuf_FileDescriptorSet_file(msg, &size); |
| 4017 | return size != 0; |
| 4018 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4019 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4020 | 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] | 4021 | 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] | 4022 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 4023 | if (arr) { |
| 4024 | if (size) *size = arr->size; |
| 4025 | return (google_protobuf_FileDescriptorProto**)_upb_array_ptr(arr); |
| 4026 | } else { |
| 4027 | if (size) *size = 0; |
| 4028 | return NULL; |
| 4029 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4030 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4031 | 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] | 4032 | 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] | 4033 | return (google_protobuf_FileDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4034 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4035 | 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] | 4036 | 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] | 4037 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 4038 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 4039 | return NULL; |
| 4040 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4041 | 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] | 4042 | if (!arr || !sub) return NULL; |
| 4043 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4044 | return sub; |
| 4045 | } |
| 4046 | |
| 4047 | /* google.protobuf.FileDescriptorProto */ |
| 4048 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4049 | UPB_INLINE google_protobuf_FileDescriptorProto* google_protobuf_FileDescriptorProto_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4050 | 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] | 4051 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4052 | UPB_INLINE google_protobuf_FileDescriptorProto* google_protobuf_FileDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 4053 | google_protobuf_FileDescriptorProto* ret = google_protobuf_FileDescriptorProto_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 4054 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4055 | 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] | 4056 | return NULL; |
| 4057 | } |
| 4058 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4059 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4060 | UPB_INLINE google_protobuf_FileDescriptorProto* google_protobuf_FileDescriptorProto_parse_ex(const char* buf, size_t size, |
| 4061 | const upb_ExtensionRegistry* extreg, |
| 4062 | int options, upb_Arena* arena) { |
| 4063 | google_protobuf_FileDescriptorProto* ret = google_protobuf_FileDescriptorProto_new(arena); |
| 4064 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4065 | 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] | 4066 | kUpb_DecodeStatus_Ok) { |
| 4067 | return NULL; |
| 4068 | } |
| 4069 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4070 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4071 | 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] | 4072 | char* ptr; |
| 4073 | (void)upb_Encode(msg, &google_protobuf_FileDescriptorProto_msg_init, 0, arena, &ptr, len); |
| 4074 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4075 | } |
| 4076 | UPB_INLINE char* google_protobuf_FileDescriptorProto_serialize_ex(const google_protobuf_FileDescriptorProto* msg, int options, |
| 4077 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4078 | char* ptr; |
| 4079 | (void)upb_Encode(msg, &google_protobuf_FileDescriptorProto_msg_init, options, arena, &ptr, len); |
| 4080 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4081 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4082 | 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] | 4083 | 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] | 4084 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4085 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4086 | 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] | 4087 | upb_StringView default_val = upb_StringView_FromString(""); |
| 4088 | upb_StringView ret; |
Protobuf Team Bot | 0e484c7 | 2023-09-06 19:28:27 +0000 | [diff] [blame] | 4089 | 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] | 4090 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 4091 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4092 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4093 | 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] | 4094 | 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] | 4095 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4096 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4097 | 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] | 4098 | 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] | 4099 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4100 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4101 | 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] | 4102 | upb_StringView default_val = upb_StringView_FromString(""); |
| 4103 | upb_StringView ret; |
Protobuf Team Bot | 0e484c7 | 2023-09-06 19:28:27 +0000 | [diff] [blame] | 4104 | 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] | 4105 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 4106 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4107 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4108 | 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] | 4109 | 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] | 4110 | return _upb_Message_HasNonExtensionField(msg, &field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4111 | } |
| 4112 | UPB_INLINE void google_protobuf_FileDescriptorProto_clear_dependency(google_protobuf_FileDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4113 | 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] | 4114 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4115 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4116 | 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] | 4117 | 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] | 4118 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4119 | if (arr) { |
| 4120 | if (size) *size = arr->size; |
| 4121 | return (upb_StringView const*)_upb_array_constptr(arr); |
| 4122 | } else { |
| 4123 | if (size) *size = 0; |
| 4124 | return NULL; |
| 4125 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4126 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 4127 | 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] | 4128 | 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] | 4129 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4130 | if (size) { |
| 4131 | *size = arr ? arr->size : 0; |
| 4132 | } |
| 4133 | return arr; |
| 4134 | } |
| 4135 | 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] | 4136 | 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] | 4137 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 4138 | (upb_Message*)msg, &field, arena); |
| 4139 | if (size) { |
| 4140 | *size = arr ? arr->size : 0; |
| 4141 | } |
| 4142 | return arr; |
| 4143 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4144 | UPB_INLINE bool google_protobuf_FileDescriptorProto_has_dependency(const google_protobuf_FileDescriptorProto* msg) { |
| 4145 | size_t size; |
| 4146 | google_protobuf_FileDescriptorProto_dependency(msg, &size); |
| 4147 | return size != 0; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4148 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4149 | 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] | 4150 | 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] | 4151 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4152 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4153 | 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] | 4154 | 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] | 4155 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4156 | if (arr) { |
| 4157 | if (size) *size = arr->size; |
| 4158 | return (const google_protobuf_DescriptorProto* const*)_upb_array_constptr(arr); |
| 4159 | } else { |
| 4160 | if (size) *size = 0; |
| 4161 | return NULL; |
| 4162 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4163 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 4164 | 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] | 4165 | 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] | 4166 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4167 | if (size) { |
| 4168 | *size = arr ? arr->size : 0; |
| 4169 | } |
| 4170 | return arr; |
| 4171 | } |
| 4172 | 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] | 4173 | 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] | 4174 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 4175 | (upb_Message*)msg, &field, arena); |
| 4176 | if (size) { |
| 4177 | *size = arr ? arr->size : 0; |
| 4178 | } |
| 4179 | return arr; |
| 4180 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4181 | UPB_INLINE bool google_protobuf_FileDescriptorProto_has_message_type(const google_protobuf_FileDescriptorProto* msg) { |
| 4182 | size_t size; |
| 4183 | google_protobuf_FileDescriptorProto_message_type(msg, &size); |
| 4184 | return size != 0; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4185 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4186 | 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] | 4187 | 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] | 4188 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4189 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4190 | 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] | 4191 | 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] | 4192 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4193 | if (arr) { |
| 4194 | if (size) *size = arr->size; |
| 4195 | return (const google_protobuf_EnumDescriptorProto* const*)_upb_array_constptr(arr); |
| 4196 | } else { |
| 4197 | if (size) *size = 0; |
| 4198 | return NULL; |
| 4199 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4200 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 4201 | 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] | 4202 | 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] | 4203 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4204 | if (size) { |
| 4205 | *size = arr ? arr->size : 0; |
| 4206 | } |
| 4207 | return arr; |
| 4208 | } |
| 4209 | 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] | 4210 | 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] | 4211 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 4212 | (upb_Message*)msg, &field, arena); |
| 4213 | if (size) { |
| 4214 | *size = arr ? arr->size : 0; |
| 4215 | } |
| 4216 | return arr; |
| 4217 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4218 | UPB_INLINE bool google_protobuf_FileDescriptorProto_has_enum_type(const google_protobuf_FileDescriptorProto* msg) { |
| 4219 | size_t size; |
| 4220 | google_protobuf_FileDescriptorProto_enum_type(msg, &size); |
| 4221 | return size != 0; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4222 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4223 | UPB_INLINE void google_protobuf_FileDescriptorProto_clear_service(google_protobuf_FileDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4224 | 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] | 4225 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4226 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4227 | 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] | 4228 | 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] | 4229 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4230 | if (arr) { |
| 4231 | if (size) *size = arr->size; |
| 4232 | return (const google_protobuf_ServiceDescriptorProto* const*)_upb_array_constptr(arr); |
| 4233 | } else { |
| 4234 | if (size) *size = 0; |
| 4235 | return NULL; |
| 4236 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4237 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 4238 | 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] | 4239 | 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] | 4240 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4241 | if (size) { |
| 4242 | *size = arr ? arr->size : 0; |
| 4243 | } |
| 4244 | return arr; |
| 4245 | } |
| 4246 | 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] | 4247 | 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] | 4248 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 4249 | (upb_Message*)msg, &field, arena); |
| 4250 | if (size) { |
| 4251 | *size = arr ? arr->size : 0; |
| 4252 | } |
| 4253 | return arr; |
| 4254 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4255 | UPB_INLINE bool google_protobuf_FileDescriptorProto_has_service(const google_protobuf_FileDescriptorProto* msg) { |
| 4256 | size_t size; |
| 4257 | google_protobuf_FileDescriptorProto_service(msg, &size); |
| 4258 | return size != 0; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4259 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4260 | UPB_INLINE void google_protobuf_FileDescriptorProto_clear_extension(google_protobuf_FileDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4261 | 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] | 4262 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4263 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4264 | 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] | 4265 | 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] | 4266 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4267 | if (arr) { |
| 4268 | if (size) *size = arr->size; |
| 4269 | return (const google_protobuf_FieldDescriptorProto* const*)_upb_array_constptr(arr); |
| 4270 | } else { |
| 4271 | if (size) *size = 0; |
| 4272 | return NULL; |
| 4273 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4274 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 4275 | 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] | 4276 | 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] | 4277 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4278 | if (size) { |
| 4279 | *size = arr ? arr->size : 0; |
| 4280 | } |
| 4281 | return arr; |
| 4282 | } |
| 4283 | 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] | 4284 | 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] | 4285 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 4286 | (upb_Message*)msg, &field, arena); |
| 4287 | if (size) { |
| 4288 | *size = arr ? arr->size : 0; |
| 4289 | } |
| 4290 | return arr; |
| 4291 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4292 | UPB_INLINE bool google_protobuf_FileDescriptorProto_has_extension(const google_protobuf_FileDescriptorProto* msg) { |
| 4293 | size_t size; |
| 4294 | google_protobuf_FileDescriptorProto_extension(msg, &size); |
| 4295 | return size != 0; |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4296 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4297 | UPB_INLINE void google_protobuf_FileDescriptorProto_clear_options(google_protobuf_FileDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4298 | 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] | 4299 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4300 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4301 | 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] | 4302 | const google_protobuf_FileOptions* default_val = NULL; |
| 4303 | const google_protobuf_FileOptions* ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4304 | 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] | 4305 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 4306 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4307 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4308 | 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] | 4309 | 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] | 4310 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4311 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4312 | 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] | 4313 | 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] | 4314 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4315 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4316 | 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] | 4317 | const google_protobuf_SourceCodeInfo* default_val = NULL; |
| 4318 | const google_protobuf_SourceCodeInfo* ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4319 | 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] | 4320 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 4321 | return ret; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4322 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4323 | 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] | 4324 | 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] | 4325 | return _upb_Message_HasNonExtensionField(msg, &field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4326 | } |
| 4327 | 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] | 4328 | 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] | 4329 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4330 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4331 | 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] | 4332 | 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] | 4333 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4334 | if (arr) { |
| 4335 | if (size) *size = arr->size; |
| 4336 | return (int32_t const*)_upb_array_constptr(arr); |
| 4337 | } else { |
| 4338 | if (size) *size = 0; |
| 4339 | return NULL; |
| 4340 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4341 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 4342 | 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] | 4343 | 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] | 4344 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4345 | if (size) { |
| 4346 | *size = arr ? arr->size : 0; |
| 4347 | } |
| 4348 | return arr; |
| 4349 | } |
| 4350 | 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] | 4351 | 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] | 4352 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 4353 | (upb_Message*)msg, &field, arena); |
| 4354 | if (size) { |
| 4355 | *size = arr ? arr->size : 0; |
| 4356 | } |
| 4357 | return arr; |
| 4358 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4359 | UPB_INLINE bool google_protobuf_FileDescriptorProto_has_public_dependency(const google_protobuf_FileDescriptorProto* msg) { |
| 4360 | size_t size; |
| 4361 | google_protobuf_FileDescriptorProto_public_dependency(msg, &size); |
| 4362 | return size != 0; |
| 4363 | } |
| 4364 | 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] | 4365 | 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] | 4366 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4367 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4368 | 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] | 4369 | 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] | 4370 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4371 | if (arr) { |
| 4372 | if (size) *size = arr->size; |
| 4373 | return (int32_t const*)_upb_array_constptr(arr); |
| 4374 | } else { |
| 4375 | if (size) *size = 0; |
| 4376 | return NULL; |
| 4377 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4378 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 4379 | 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] | 4380 | 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] | 4381 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4382 | if (size) { |
| 4383 | *size = arr ? arr->size : 0; |
| 4384 | } |
| 4385 | return arr; |
| 4386 | } |
| 4387 | 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] | 4388 | 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] | 4389 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 4390 | (upb_Message*)msg, &field, arena); |
| 4391 | if (size) { |
| 4392 | *size = arr ? arr->size : 0; |
| 4393 | } |
| 4394 | return arr; |
| 4395 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4396 | UPB_INLINE bool google_protobuf_FileDescriptorProto_has_weak_dependency(const google_protobuf_FileDescriptorProto* msg) { |
| 4397 | size_t size; |
| 4398 | google_protobuf_FileDescriptorProto_weak_dependency(msg, &size); |
| 4399 | return size != 0; |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4400 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4401 | 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] | 4402 | 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] | 4403 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4404 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4405 | 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] | 4406 | upb_StringView default_val = upb_StringView_FromString(""); |
| 4407 | upb_StringView ret; |
Protobuf Team Bot | 0e484c7 | 2023-09-06 19:28:27 +0000 | [diff] [blame] | 4408 | 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] | 4409 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 4410 | return ret; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4411 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4412 | 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] | 4413 | 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] | 4414 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4415 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4416 | UPB_INLINE void google_protobuf_FileDescriptorProto_clear_edition(google_protobuf_FileDescriptorProto* msg) { |
Protobuf Team Bot | 0e484c7 | 2023-09-06 19:28:27 +0000 | [diff] [blame] | 4417 | const upb_MiniTableField field = {13, UPB_SIZE(68, 128), 6, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 4418 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4419 | } |
| 4420 | UPB_INLINE upb_StringView google_protobuf_FileDescriptorProto_edition(const google_protobuf_FileDescriptorProto* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 4421 | upb_StringView default_val = upb_StringView_FromString(""); |
| 4422 | upb_StringView ret; |
Protobuf Team Bot | 0e484c7 | 2023-09-06 19:28:27 +0000 | [diff] [blame] | 4423 | const upb_MiniTableField field = {13, UPB_SIZE(68, 128), 6, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 4424 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 4425 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4426 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4427 | UPB_INLINE bool google_protobuf_FileDescriptorProto_has_edition(const google_protobuf_FileDescriptorProto* msg) { |
Protobuf Team Bot | 0e484c7 | 2023-09-06 19:28:27 +0000 | [diff] [blame] | 4428 | const upb_MiniTableField field = {13, UPB_SIZE(68, 128), 6, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
| 4429 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 4430 | } |
| 4431 | UPB_INLINE void google_protobuf_FileDescriptorProto_clear_edition_enum(google_protobuf_FileDescriptorProto* msg) { |
| 4432 | const upb_MiniTableField field = {14, UPB_SIZE(40, 4), 7, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
| 4433 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 4434 | } |
| 4435 | UPB_INLINE int32_t google_protobuf_FileDescriptorProto_edition_enum(const google_protobuf_FileDescriptorProto* msg) { |
| 4436 | int32_t default_val = 0; |
| 4437 | int32_t ret; |
| 4438 | const upb_MiniTableField field = {14, UPB_SIZE(40, 4), 7, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
| 4439 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 4440 | return ret; |
| 4441 | } |
| 4442 | UPB_INLINE bool google_protobuf_FileDescriptorProto_has_edition_enum(const google_protobuf_FileDescriptorProto* msg) { |
| 4443 | const upb_MiniTableField field = {14, UPB_SIZE(40, 4), 7, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 4444 | return _upb_Message_HasNonExtensionField(msg, &field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4445 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4446 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4447 | 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] | 4448 | 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] | 4449 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 4450 | } |
| 4451 | 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] | 4452 | 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] | 4453 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 4454 | } |
| 4455 | 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] | 4456 | 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] | 4457 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 4458 | if (arr) { |
| 4459 | if (size) *size = arr->size; |
| 4460 | return (upb_StringView*)_upb_array_ptr(arr); |
| 4461 | } else { |
| 4462 | if (size) *size = 0; |
| 4463 | return NULL; |
| 4464 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4465 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4466 | 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] | 4467 | 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] | 4468 | return (upb_StringView*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4469 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4470 | 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] | 4471 | 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] | 4472 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 4473 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 4474 | return false; |
| 4475 | } |
| 4476 | _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val)); |
| 4477 | return true; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4478 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4479 | 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] | 4480 | 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] | 4481 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 4482 | if (arr) { |
| 4483 | if (size) *size = arr->size; |
| 4484 | return (google_protobuf_DescriptorProto**)_upb_array_ptr(arr); |
| 4485 | } else { |
| 4486 | if (size) *size = 0; |
| 4487 | return NULL; |
| 4488 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4489 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4490 | 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] | 4491 | 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] | 4492 | return (google_protobuf_DescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4493 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4494 | 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] | 4495 | 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] | 4496 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 4497 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 4498 | return NULL; |
| 4499 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4500 | 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] | 4501 | if (!arr || !sub) return NULL; |
| 4502 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4503 | return sub; |
| 4504 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4505 | 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] | 4506 | 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] | 4507 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 4508 | if (arr) { |
| 4509 | if (size) *size = arr->size; |
| 4510 | return (google_protobuf_EnumDescriptorProto**)_upb_array_ptr(arr); |
| 4511 | } else { |
| 4512 | if (size) *size = 0; |
| 4513 | return NULL; |
| 4514 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4515 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4516 | 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] | 4517 | 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] | 4518 | return (google_protobuf_EnumDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4519 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4520 | 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] | 4521 | 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] | 4522 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 4523 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 4524 | return NULL; |
| 4525 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4526 | 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] | 4527 | if (!arr || !sub) return NULL; |
| 4528 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4529 | return sub; |
| 4530 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4531 | 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] | 4532 | 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] | 4533 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 4534 | if (arr) { |
| 4535 | if (size) *size = arr->size; |
| 4536 | return (google_protobuf_ServiceDescriptorProto**)_upb_array_ptr(arr); |
| 4537 | } else { |
| 4538 | if (size) *size = 0; |
| 4539 | return NULL; |
| 4540 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4541 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4542 | 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] | 4543 | 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] | 4544 | return (google_protobuf_ServiceDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4545 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4546 | 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] | 4547 | 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] | 4548 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 4549 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 4550 | return NULL; |
| 4551 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4552 | 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] | 4553 | if (!arr || !sub) return NULL; |
| 4554 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4555 | return sub; |
| 4556 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4557 | 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] | 4558 | 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] | 4559 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 4560 | if (arr) { |
| 4561 | if (size) *size = arr->size; |
| 4562 | return (google_protobuf_FieldDescriptorProto**)_upb_array_ptr(arr); |
| 4563 | } else { |
| 4564 | if (size) *size = 0; |
| 4565 | return NULL; |
| 4566 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4567 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4568 | 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] | 4569 | 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] | 4570 | return (google_protobuf_FieldDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4571 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4572 | 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] | 4573 | 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] | 4574 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 4575 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 4576 | return NULL; |
| 4577 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4578 | 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] | 4579 | if (!arr || !sub) return NULL; |
| 4580 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4581 | return sub; |
| 4582 | } |
| 4583 | 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] | 4584 | 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] | 4585 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 4586 | } |
| 4587 | 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] | 4588 | struct google_protobuf_FileOptions* sub = (struct google_protobuf_FileOptions*)google_protobuf_FileDescriptorProto_options(msg); |
| 4589 | if (sub == NULL) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4590 | 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] | 4591 | if (sub) google_protobuf_FileDescriptorProto_set_options(msg, sub); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4592 | } |
| 4593 | return sub; |
| 4594 | } |
| 4595 | 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] | 4596 | 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] | 4597 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 4598 | } |
| 4599 | 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] | 4600 | struct google_protobuf_SourceCodeInfo* sub = (struct google_protobuf_SourceCodeInfo*)google_protobuf_FileDescriptorProto_source_code_info(msg); |
| 4601 | if (sub == NULL) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4602 | 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] | 4603 | if (sub) google_protobuf_FileDescriptorProto_set_source_code_info(msg, sub); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4604 | } |
| 4605 | return sub; |
| 4606 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4607 | 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] | 4608 | 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] | 4609 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 4610 | if (arr) { |
| 4611 | if (size) *size = arr->size; |
| 4612 | return (int32_t*)_upb_array_ptr(arr); |
| 4613 | } else { |
| 4614 | if (size) *size = 0; |
| 4615 | return NULL; |
| 4616 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4617 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4618 | 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] | 4619 | 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] | 4620 | return (int32_t*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4621 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4622 | 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] | 4623 | 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] | 4624 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 4625 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 4626 | return false; |
| 4627 | } |
| 4628 | _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val)); |
| 4629 | return true; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4630 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4631 | 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] | 4632 | 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] | 4633 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 4634 | if (arr) { |
| 4635 | if (size) *size = arr->size; |
| 4636 | return (int32_t*)_upb_array_ptr(arr); |
| 4637 | } else { |
| 4638 | if (size) *size = 0; |
| 4639 | return NULL; |
| 4640 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4641 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4642 | 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] | 4643 | 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] | 4644 | return (int32_t*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4645 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4646 | 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] | 4647 | 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] | 4648 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 4649 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 4650 | return false; |
| 4651 | } |
| 4652 | _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val)); |
| 4653 | return true; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4654 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4655 | 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] | 4656 | 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] | 4657 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 4658 | } |
| 4659 | UPB_INLINE void google_protobuf_FileDescriptorProto_set_edition(google_protobuf_FileDescriptorProto *msg, upb_StringView value) { |
Protobuf Team Bot | 0e484c7 | 2023-09-06 19:28:27 +0000 | [diff] [blame] | 4660 | const upb_MiniTableField field = {13, UPB_SIZE(68, 128), 6, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
| 4661 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 4662 | } |
| 4663 | UPB_INLINE void google_protobuf_FileDescriptorProto_set_edition_enum(google_protobuf_FileDescriptorProto *msg, int32_t value) { |
| 4664 | const upb_MiniTableField field = {14, UPB_SIZE(40, 4), 7, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 4665 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4666 | } |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 4667 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4668 | /* google.protobuf.DescriptorProto */ |
| 4669 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4670 | UPB_INLINE google_protobuf_DescriptorProto* google_protobuf_DescriptorProto_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4671 | 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] | 4672 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4673 | UPB_INLINE google_protobuf_DescriptorProto* google_protobuf_DescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 4674 | google_protobuf_DescriptorProto* ret = google_protobuf_DescriptorProto_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 4675 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4676 | 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] | 4677 | return NULL; |
| 4678 | } |
| 4679 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4680 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4681 | UPB_INLINE google_protobuf_DescriptorProto* google_protobuf_DescriptorProto_parse_ex(const char* buf, size_t size, |
| 4682 | const upb_ExtensionRegistry* extreg, |
| 4683 | int options, upb_Arena* arena) { |
| 4684 | google_protobuf_DescriptorProto* ret = google_protobuf_DescriptorProto_new(arena); |
| 4685 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4686 | 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] | 4687 | kUpb_DecodeStatus_Ok) { |
| 4688 | return NULL; |
| 4689 | } |
| 4690 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4691 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4692 | 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] | 4693 | char* ptr; |
| 4694 | (void)upb_Encode(msg, &google_protobuf_DescriptorProto_msg_init, 0, arena, &ptr, len); |
| 4695 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4696 | } |
| 4697 | UPB_INLINE char* google_protobuf_DescriptorProto_serialize_ex(const google_protobuf_DescriptorProto* msg, int options, |
| 4698 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4699 | char* ptr; |
| 4700 | (void)upb_Encode(msg, &google_protobuf_DescriptorProto_msg_init, options, arena, &ptr, len); |
| 4701 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4702 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4703 | UPB_INLINE void google_protobuf_DescriptorProto_clear_name(google_protobuf_DescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4704 | 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] | 4705 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4706 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4707 | 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] | 4708 | upb_StringView default_val = upb_StringView_FromString(""); |
| 4709 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4710 | 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] | 4711 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 4712 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4713 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4714 | 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] | 4715 | 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] | 4716 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4717 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4718 | UPB_INLINE void google_protobuf_DescriptorProto_clear_field(google_protobuf_DescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4719 | 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] | 4720 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4721 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4722 | 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] | 4723 | 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] | 4724 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4725 | if (arr) { |
| 4726 | if (size) *size = arr->size; |
| 4727 | return (const google_protobuf_FieldDescriptorProto* const*)_upb_array_constptr(arr); |
| 4728 | } else { |
| 4729 | if (size) *size = 0; |
| 4730 | return NULL; |
| 4731 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4732 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 4733 | 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] | 4734 | 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] | 4735 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4736 | if (size) { |
| 4737 | *size = arr ? arr->size : 0; |
| 4738 | } |
| 4739 | return arr; |
| 4740 | } |
| 4741 | 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] | 4742 | 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] | 4743 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 4744 | (upb_Message*)msg, &field, arena); |
| 4745 | if (size) { |
| 4746 | *size = arr ? arr->size : 0; |
| 4747 | } |
| 4748 | return arr; |
| 4749 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4750 | UPB_INLINE bool google_protobuf_DescriptorProto_has_field(const google_protobuf_DescriptorProto* msg) { |
| 4751 | size_t size; |
| 4752 | google_protobuf_DescriptorProto_field(msg, &size); |
| 4753 | return size != 0; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4754 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4755 | 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] | 4756 | 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] | 4757 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4758 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4759 | 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] | 4760 | 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] | 4761 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4762 | if (arr) { |
| 4763 | if (size) *size = arr->size; |
| 4764 | return (const google_protobuf_DescriptorProto* const*)_upb_array_constptr(arr); |
| 4765 | } else { |
| 4766 | if (size) *size = 0; |
| 4767 | return NULL; |
| 4768 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4769 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 4770 | 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] | 4771 | 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] | 4772 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4773 | if (size) { |
| 4774 | *size = arr ? arr->size : 0; |
| 4775 | } |
| 4776 | return arr; |
| 4777 | } |
| 4778 | 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] | 4779 | 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] | 4780 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 4781 | (upb_Message*)msg, &field, arena); |
| 4782 | if (size) { |
| 4783 | *size = arr ? arr->size : 0; |
| 4784 | } |
| 4785 | return arr; |
| 4786 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4787 | UPB_INLINE bool google_protobuf_DescriptorProto_has_nested_type(const google_protobuf_DescriptorProto* msg) { |
| 4788 | size_t size; |
| 4789 | google_protobuf_DescriptorProto_nested_type(msg, &size); |
| 4790 | return size != 0; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4791 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4792 | 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] | 4793 | 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] | 4794 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4795 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4796 | 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] | 4797 | 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] | 4798 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4799 | if (arr) { |
| 4800 | if (size) *size = arr->size; |
| 4801 | return (const google_protobuf_EnumDescriptorProto* const*)_upb_array_constptr(arr); |
| 4802 | } else { |
| 4803 | if (size) *size = 0; |
| 4804 | return NULL; |
| 4805 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4806 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 4807 | 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] | 4808 | 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] | 4809 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4810 | if (size) { |
| 4811 | *size = arr ? arr->size : 0; |
| 4812 | } |
| 4813 | return arr; |
| 4814 | } |
| 4815 | 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] | 4816 | 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] | 4817 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 4818 | (upb_Message*)msg, &field, arena); |
| 4819 | if (size) { |
| 4820 | *size = arr ? arr->size : 0; |
| 4821 | } |
| 4822 | return arr; |
| 4823 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4824 | UPB_INLINE bool google_protobuf_DescriptorProto_has_enum_type(const google_protobuf_DescriptorProto* msg) { |
| 4825 | size_t size; |
| 4826 | google_protobuf_DescriptorProto_enum_type(msg, &size); |
| 4827 | return size != 0; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4828 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4829 | 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] | 4830 | 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] | 4831 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4832 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4833 | 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] | 4834 | 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] | 4835 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4836 | if (arr) { |
| 4837 | if (size) *size = arr->size; |
| 4838 | return (const google_protobuf_DescriptorProto_ExtensionRange* const*)_upb_array_constptr(arr); |
| 4839 | } else { |
| 4840 | if (size) *size = 0; |
| 4841 | return NULL; |
| 4842 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4843 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 4844 | 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] | 4845 | 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] | 4846 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4847 | if (size) { |
| 4848 | *size = arr ? arr->size : 0; |
| 4849 | } |
| 4850 | return arr; |
| 4851 | } |
| 4852 | 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] | 4853 | 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] | 4854 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 4855 | (upb_Message*)msg, &field, arena); |
| 4856 | if (size) { |
| 4857 | *size = arr ? arr->size : 0; |
| 4858 | } |
| 4859 | return arr; |
| 4860 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4861 | UPB_INLINE bool google_protobuf_DescriptorProto_has_extension_range(const google_protobuf_DescriptorProto* msg) { |
| 4862 | size_t size; |
| 4863 | google_protobuf_DescriptorProto_extension_range(msg, &size); |
| 4864 | return size != 0; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4865 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4866 | UPB_INLINE void google_protobuf_DescriptorProto_clear_extension(google_protobuf_DescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4867 | 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] | 4868 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4869 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4870 | 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] | 4871 | 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] | 4872 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4873 | if (arr) { |
| 4874 | if (size) *size = arr->size; |
| 4875 | return (const google_protobuf_FieldDescriptorProto* const*)_upb_array_constptr(arr); |
| 4876 | } else { |
| 4877 | if (size) *size = 0; |
| 4878 | return NULL; |
| 4879 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4880 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 4881 | 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] | 4882 | 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] | 4883 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4884 | if (size) { |
| 4885 | *size = arr ? arr->size : 0; |
| 4886 | } |
| 4887 | return arr; |
| 4888 | } |
| 4889 | 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] | 4890 | 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] | 4891 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 4892 | (upb_Message*)msg, &field, arena); |
| 4893 | if (size) { |
| 4894 | *size = arr ? arr->size : 0; |
| 4895 | } |
| 4896 | return arr; |
| 4897 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4898 | UPB_INLINE bool google_protobuf_DescriptorProto_has_extension(const google_protobuf_DescriptorProto* msg) { |
| 4899 | size_t size; |
| 4900 | google_protobuf_DescriptorProto_extension(msg, &size); |
| 4901 | return size != 0; |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4902 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4903 | UPB_INLINE void google_protobuf_DescriptorProto_clear_options(google_protobuf_DescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4904 | 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] | 4905 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4906 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4907 | 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] | 4908 | const google_protobuf_MessageOptions* default_val = NULL; |
| 4909 | const google_protobuf_MessageOptions* ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4910 | 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] | 4911 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 4912 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4913 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4914 | 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] | 4915 | 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] | 4916 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4917 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4918 | 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] | 4919 | 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] | 4920 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4921 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4922 | 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] | 4923 | 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] | 4924 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4925 | if (arr) { |
| 4926 | if (size) *size = arr->size; |
| 4927 | return (const google_protobuf_OneofDescriptorProto* const*)_upb_array_constptr(arr); |
| 4928 | } else { |
| 4929 | if (size) *size = 0; |
| 4930 | return NULL; |
| 4931 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4932 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 4933 | 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] | 4934 | 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] | 4935 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4936 | if (size) { |
| 4937 | *size = arr ? arr->size : 0; |
| 4938 | } |
| 4939 | return arr; |
| 4940 | } |
| 4941 | 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] | 4942 | 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] | 4943 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 4944 | (upb_Message*)msg, &field, arena); |
| 4945 | if (size) { |
| 4946 | *size = arr ? arr->size : 0; |
| 4947 | } |
| 4948 | return arr; |
| 4949 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4950 | UPB_INLINE bool google_protobuf_DescriptorProto_has_oneof_decl(const google_protobuf_DescriptorProto* msg) { |
| 4951 | size_t size; |
| 4952 | google_protobuf_DescriptorProto_oneof_decl(msg, &size); |
| 4953 | return size != 0; |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4954 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4955 | 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] | 4956 | 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] | 4957 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4958 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4959 | 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] | 4960 | 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] | 4961 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4962 | if (arr) { |
| 4963 | if (size) *size = arr->size; |
| 4964 | return (const google_protobuf_DescriptorProto_ReservedRange* const*)_upb_array_constptr(arr); |
| 4965 | } else { |
| 4966 | if (size) *size = 0; |
| 4967 | return NULL; |
| 4968 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4969 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 4970 | 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] | 4971 | 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] | 4972 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4973 | if (size) { |
| 4974 | *size = arr ? arr->size : 0; |
| 4975 | } |
| 4976 | return arr; |
| 4977 | } |
| 4978 | 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] | 4979 | 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] | 4980 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 4981 | (upb_Message*)msg, &field, arena); |
| 4982 | if (size) { |
| 4983 | *size = arr ? arr->size : 0; |
| 4984 | } |
| 4985 | return arr; |
| 4986 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4987 | UPB_INLINE bool google_protobuf_DescriptorProto_has_reserved_range(const google_protobuf_DescriptorProto* msg) { |
| 4988 | size_t size; |
| 4989 | google_protobuf_DescriptorProto_reserved_range(msg, &size); |
| 4990 | return size != 0; |
| 4991 | } |
| 4992 | 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] | 4993 | 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] | 4994 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4995 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4996 | 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] | 4997 | 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] | 4998 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4999 | if (arr) { |
| 5000 | if (size) *size = arr->size; |
| 5001 | return (upb_StringView const*)_upb_array_constptr(arr); |
| 5002 | } else { |
| 5003 | if (size) *size = 0; |
| 5004 | return NULL; |
| 5005 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5006 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 5007 | 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] | 5008 | 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] | 5009 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 5010 | if (size) { |
| 5011 | *size = arr ? arr->size : 0; |
| 5012 | } |
| 5013 | return arr; |
| 5014 | } |
| 5015 | 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] | 5016 | 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] | 5017 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 5018 | (upb_Message*)msg, &field, arena); |
| 5019 | if (size) { |
| 5020 | *size = arr ? arr->size : 0; |
| 5021 | } |
| 5022 | return arr; |
| 5023 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5024 | UPB_INLINE bool google_protobuf_DescriptorProto_has_reserved_name(const google_protobuf_DescriptorProto* msg) { |
| 5025 | size_t size; |
| 5026 | google_protobuf_DescriptorProto_reserved_name(msg, &size); |
| 5027 | return size != 0; |
| 5028 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5029 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5030 | 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] | 5031 | 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] | 5032 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 5033 | } |
| 5034 | 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] | 5035 | 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] | 5036 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 5037 | if (arr) { |
| 5038 | if (size) *size = arr->size; |
| 5039 | return (google_protobuf_FieldDescriptorProto**)_upb_array_ptr(arr); |
| 5040 | } else { |
| 5041 | if (size) *size = 0; |
| 5042 | return NULL; |
| 5043 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5044 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5045 | 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] | 5046 | 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] | 5047 | return (google_protobuf_FieldDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5048 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5049 | 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] | 5050 | 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] | 5051 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 5052 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 5053 | return NULL; |
| 5054 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5055 | 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] | 5056 | if (!arr || !sub) return NULL; |
| 5057 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5058 | return sub; |
| 5059 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5060 | 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] | 5061 | 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] | 5062 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 5063 | if (arr) { |
| 5064 | if (size) *size = arr->size; |
| 5065 | return (google_protobuf_DescriptorProto**)_upb_array_ptr(arr); |
| 5066 | } else { |
| 5067 | if (size) *size = 0; |
| 5068 | return NULL; |
| 5069 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5070 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5071 | 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] | 5072 | 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] | 5073 | return (google_protobuf_DescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5074 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5075 | 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] | 5076 | 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] | 5077 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 5078 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 5079 | return NULL; |
| 5080 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5081 | 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] | 5082 | if (!arr || !sub) return NULL; |
| 5083 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5084 | return sub; |
| 5085 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5086 | 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] | 5087 | 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] | 5088 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 5089 | if (arr) { |
| 5090 | if (size) *size = arr->size; |
| 5091 | return (google_protobuf_EnumDescriptorProto**)_upb_array_ptr(arr); |
| 5092 | } else { |
| 5093 | if (size) *size = 0; |
| 5094 | return NULL; |
| 5095 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5096 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5097 | 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] | 5098 | 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] | 5099 | return (google_protobuf_EnumDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5100 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5101 | 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] | 5102 | 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] | 5103 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 5104 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 5105 | return NULL; |
| 5106 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5107 | 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] | 5108 | if (!arr || !sub) return NULL; |
| 5109 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5110 | return sub; |
| 5111 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5112 | 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] | 5113 | 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] | 5114 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 5115 | if (arr) { |
| 5116 | if (size) *size = arr->size; |
| 5117 | return (google_protobuf_DescriptorProto_ExtensionRange**)_upb_array_ptr(arr); |
| 5118 | } else { |
| 5119 | if (size) *size = 0; |
| 5120 | return NULL; |
| 5121 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5122 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5123 | 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] | 5124 | 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] | 5125 | return (google_protobuf_DescriptorProto_ExtensionRange**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5126 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5127 | 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] | 5128 | 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] | 5129 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 5130 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 5131 | return NULL; |
| 5132 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5133 | 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] | 5134 | if (!arr || !sub) return NULL; |
| 5135 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5136 | return sub; |
| 5137 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5138 | 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] | 5139 | 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] | 5140 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 5141 | if (arr) { |
| 5142 | if (size) *size = arr->size; |
| 5143 | return (google_protobuf_FieldDescriptorProto**)_upb_array_ptr(arr); |
| 5144 | } else { |
| 5145 | if (size) *size = 0; |
| 5146 | return NULL; |
| 5147 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5148 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5149 | 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] | 5150 | 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] | 5151 | return (google_protobuf_FieldDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5152 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5153 | 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] | 5154 | 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] | 5155 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 5156 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 5157 | return NULL; |
| 5158 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5159 | 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] | 5160 | if (!arr || !sub) return NULL; |
| 5161 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5162 | return sub; |
| 5163 | } |
| 5164 | 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] | 5165 | 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] | 5166 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 5167 | } |
| 5168 | 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] | 5169 | struct google_protobuf_MessageOptions* sub = (struct google_protobuf_MessageOptions*)google_protobuf_DescriptorProto_options(msg); |
| 5170 | if (sub == NULL) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5171 | 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] | 5172 | if (sub) google_protobuf_DescriptorProto_set_options(msg, sub); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5173 | } |
| 5174 | return sub; |
| 5175 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5176 | 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] | 5177 | 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] | 5178 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 5179 | if (arr) { |
| 5180 | if (size) *size = arr->size; |
| 5181 | return (google_protobuf_OneofDescriptorProto**)_upb_array_ptr(arr); |
| 5182 | } else { |
| 5183 | if (size) *size = 0; |
| 5184 | return NULL; |
| 5185 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5186 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5187 | 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] | 5188 | 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] | 5189 | return (google_protobuf_OneofDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5190 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5191 | 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] | 5192 | 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] | 5193 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 5194 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 5195 | return NULL; |
| 5196 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5197 | 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] | 5198 | if (!arr || !sub) return NULL; |
| 5199 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5200 | return sub; |
| 5201 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5202 | 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] | 5203 | 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] | 5204 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 5205 | if (arr) { |
| 5206 | if (size) *size = arr->size; |
| 5207 | return (google_protobuf_DescriptorProto_ReservedRange**)_upb_array_ptr(arr); |
| 5208 | } else { |
| 5209 | if (size) *size = 0; |
| 5210 | return NULL; |
| 5211 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5212 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5213 | 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] | 5214 | 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] | 5215 | return (google_protobuf_DescriptorProto_ReservedRange**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5216 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5217 | 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] | 5218 | 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] | 5219 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 5220 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 5221 | return NULL; |
| 5222 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5223 | 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] | 5224 | if (!arr || !sub) return NULL; |
| 5225 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5226 | return sub; |
| 5227 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5228 | 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] | 5229 | 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] | 5230 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 5231 | if (arr) { |
| 5232 | if (size) *size = arr->size; |
| 5233 | return (upb_StringView*)_upb_array_ptr(arr); |
| 5234 | } else { |
| 5235 | if (size) *size = 0; |
| 5236 | return NULL; |
| 5237 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5238 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5239 | 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] | 5240 | 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] | 5241 | return (upb_StringView*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5242 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5243 | 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] | 5244 | 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] | 5245 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 5246 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 5247 | return false; |
| 5248 | } |
| 5249 | _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val)); |
| 5250 | return true; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5251 | } |
| 5252 | |
| 5253 | /* google.protobuf.DescriptorProto.ExtensionRange */ |
| 5254 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5255 | UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange* google_protobuf_DescriptorProto_ExtensionRange_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5256 | 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] | 5257 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5258 | UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange* google_protobuf_DescriptorProto_ExtensionRange_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 5259 | google_protobuf_DescriptorProto_ExtensionRange* ret = google_protobuf_DescriptorProto_ExtensionRange_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 5260 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5261 | 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] | 5262 | return NULL; |
| 5263 | } |
| 5264 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5265 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5266 | UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange* google_protobuf_DescriptorProto_ExtensionRange_parse_ex(const char* buf, size_t size, |
| 5267 | const upb_ExtensionRegistry* extreg, |
| 5268 | int options, upb_Arena* arena) { |
| 5269 | google_protobuf_DescriptorProto_ExtensionRange* ret = google_protobuf_DescriptorProto_ExtensionRange_new(arena); |
| 5270 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5271 | 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] | 5272 | kUpb_DecodeStatus_Ok) { |
| 5273 | return NULL; |
| 5274 | } |
| 5275 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5276 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5277 | 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] | 5278 | char* ptr; |
| 5279 | (void)upb_Encode(msg, &google_protobuf_DescriptorProto_ExtensionRange_msg_init, 0, arena, &ptr, len); |
| 5280 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5281 | } |
| 5282 | UPB_INLINE char* google_protobuf_DescriptorProto_ExtensionRange_serialize_ex(const google_protobuf_DescriptorProto_ExtensionRange* msg, int options, |
| 5283 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5284 | char* ptr; |
| 5285 | (void)upb_Encode(msg, &google_protobuf_DescriptorProto_ExtensionRange_msg_init, options, arena, &ptr, len); |
| 5286 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5287 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5288 | 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] | 5289 | 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] | 5290 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5291 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5292 | 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] | 5293 | int32_t default_val = (int32_t)0; |
| 5294 | int32_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5295 | 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] | 5296 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 5297 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5298 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5299 | 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] | 5300 | 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] | 5301 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5302 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5303 | 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] | 5304 | 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] | 5305 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5306 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5307 | 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] | 5308 | int32_t default_val = (int32_t)0; |
| 5309 | int32_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5310 | 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] | 5311 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 5312 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5313 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5314 | 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] | 5315 | 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] | 5316 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5317 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5318 | 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] | 5319 | 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] | 5320 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5321 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5322 | 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] | 5323 | const google_protobuf_ExtensionRangeOptions* default_val = NULL; |
| 5324 | const google_protobuf_ExtensionRangeOptions* ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5325 | 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] | 5326 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 5327 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5328 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5329 | 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] | 5330 | 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] | 5331 | return _upb_Message_HasNonExtensionField(msg, &field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5332 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5333 | |
| 5334 | 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] | 5335 | 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] | 5336 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 5337 | } |
| 5338 | 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] | 5339 | 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] | 5340 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 5341 | } |
| 5342 | 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] | 5343 | 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] | 5344 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 5345 | } |
| 5346 | 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] | 5347 | struct google_protobuf_ExtensionRangeOptions* sub = (struct google_protobuf_ExtensionRangeOptions*)google_protobuf_DescriptorProto_ExtensionRange_options(msg); |
| 5348 | if (sub == NULL) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5349 | 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] | 5350 | if (sub) google_protobuf_DescriptorProto_ExtensionRange_set_options(msg, sub); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5351 | } |
| 5352 | return sub; |
| 5353 | } |
| 5354 | |
| 5355 | /* google.protobuf.DescriptorProto.ReservedRange */ |
| 5356 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5357 | UPB_INLINE google_protobuf_DescriptorProto_ReservedRange* google_protobuf_DescriptorProto_ReservedRange_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5358 | 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] | 5359 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5360 | UPB_INLINE google_protobuf_DescriptorProto_ReservedRange* google_protobuf_DescriptorProto_ReservedRange_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 5361 | google_protobuf_DescriptorProto_ReservedRange* ret = google_protobuf_DescriptorProto_ReservedRange_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 5362 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5363 | 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] | 5364 | return NULL; |
| 5365 | } |
| 5366 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5367 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5368 | UPB_INLINE google_protobuf_DescriptorProto_ReservedRange* google_protobuf_DescriptorProto_ReservedRange_parse_ex(const char* buf, size_t size, |
| 5369 | const upb_ExtensionRegistry* extreg, |
| 5370 | int options, upb_Arena* arena) { |
| 5371 | google_protobuf_DescriptorProto_ReservedRange* ret = google_protobuf_DescriptorProto_ReservedRange_new(arena); |
| 5372 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5373 | 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] | 5374 | kUpb_DecodeStatus_Ok) { |
| 5375 | return NULL; |
| 5376 | } |
| 5377 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5378 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5379 | 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] | 5380 | char* ptr; |
| 5381 | (void)upb_Encode(msg, &google_protobuf_DescriptorProto_ReservedRange_msg_init, 0, arena, &ptr, len); |
| 5382 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5383 | } |
| 5384 | UPB_INLINE char* google_protobuf_DescriptorProto_ReservedRange_serialize_ex(const google_protobuf_DescriptorProto_ReservedRange* msg, int options, |
| 5385 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5386 | char* ptr; |
| 5387 | (void)upb_Encode(msg, &google_protobuf_DescriptorProto_ReservedRange_msg_init, options, arena, &ptr, len); |
| 5388 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5389 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5390 | 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] | 5391 | 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] | 5392 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5393 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5394 | 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] | 5395 | int32_t default_val = (int32_t)0; |
| 5396 | int32_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5397 | 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] | 5398 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 5399 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5400 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5401 | 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] | 5402 | 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] | 5403 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5404 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5405 | 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] | 5406 | 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] | 5407 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5408 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5409 | 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] | 5410 | int32_t default_val = (int32_t)0; |
| 5411 | int32_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5412 | 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] | 5413 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 5414 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5415 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5416 | 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] | 5417 | 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] | 5418 | return _upb_Message_HasNonExtensionField(msg, &field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5419 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5420 | |
| 5421 | 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] | 5422 | 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] | 5423 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 5424 | } |
| 5425 | 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] | 5426 | 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] | 5427 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5428 | } |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 5429 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5430 | /* google.protobuf.ExtensionRangeOptions */ |
| 5431 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5432 | UPB_INLINE google_protobuf_ExtensionRangeOptions* google_protobuf_ExtensionRangeOptions_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5433 | 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] | 5434 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5435 | UPB_INLINE google_protobuf_ExtensionRangeOptions* google_protobuf_ExtensionRangeOptions_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 5436 | google_protobuf_ExtensionRangeOptions* ret = google_protobuf_ExtensionRangeOptions_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 5437 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5438 | 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] | 5439 | return NULL; |
| 5440 | } |
| 5441 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5442 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5443 | UPB_INLINE google_protobuf_ExtensionRangeOptions* google_protobuf_ExtensionRangeOptions_parse_ex(const char* buf, size_t size, |
| 5444 | const upb_ExtensionRegistry* extreg, |
| 5445 | int options, upb_Arena* arena) { |
| 5446 | google_protobuf_ExtensionRangeOptions* ret = google_protobuf_ExtensionRangeOptions_new(arena); |
| 5447 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5448 | 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] | 5449 | kUpb_DecodeStatus_Ok) { |
| 5450 | return NULL; |
| 5451 | } |
| 5452 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5453 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5454 | 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] | 5455 | char* ptr; |
| 5456 | (void)upb_Encode(msg, &google_protobuf_ExtensionRangeOptions_msg_init, 0, arena, &ptr, len); |
| 5457 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5458 | } |
| 5459 | UPB_INLINE char* google_protobuf_ExtensionRangeOptions_serialize_ex(const google_protobuf_ExtensionRangeOptions* msg, int options, |
| 5460 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5461 | char* ptr; |
| 5462 | (void)upb_Encode(msg, &google_protobuf_ExtensionRangeOptions_msg_init, options, arena, &ptr, len); |
| 5463 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5464 | } |
Mike Kruskal | 145900f | 2023-03-27 09:55:52 -0700 | [diff] [blame] | 5465 | UPB_INLINE void google_protobuf_ExtensionRangeOptions_clear_declaration(google_protobuf_ExtensionRangeOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5466 | 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] | 5467 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 5468 | } |
| 5469 | 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] | 5470 | 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] | 5471 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 5472 | if (arr) { |
| 5473 | if (size) *size = arr->size; |
| 5474 | return (const google_protobuf_ExtensionRangeOptions_Declaration* const*)_upb_array_constptr(arr); |
| 5475 | } else { |
| 5476 | if (size) *size = 0; |
| 5477 | return NULL; |
| 5478 | } |
| 5479 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 5480 | 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] | 5481 | 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] | 5482 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 5483 | if (size) { |
| 5484 | *size = arr ? arr->size : 0; |
| 5485 | } |
| 5486 | return arr; |
| 5487 | } |
| 5488 | 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] | 5489 | 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] | 5490 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 5491 | (upb_Message*)msg, &field, arena); |
| 5492 | if (size) { |
| 5493 | *size = arr ? arr->size : 0; |
| 5494 | } |
| 5495 | return arr; |
| 5496 | } |
Mike Kruskal | 145900f | 2023-03-27 09:55:52 -0700 | [diff] [blame] | 5497 | UPB_INLINE bool google_protobuf_ExtensionRangeOptions_has_declaration(const google_protobuf_ExtensionRangeOptions* msg) { |
| 5498 | size_t size; |
| 5499 | google_protobuf_ExtensionRangeOptions_declaration(msg, &size); |
| 5500 | return size != 0; |
| 5501 | } |
Protobuf Team Bot | 469f027 | 2023-04-21 18:12:45 -0700 | [diff] [blame] | 5502 | UPB_INLINE void google_protobuf_ExtensionRangeOptions_clear_verification(google_protobuf_ExtensionRangeOptions* msg) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 5503 | 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] | 5504 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 5505 | } |
| 5506 | UPB_INLINE int32_t google_protobuf_ExtensionRangeOptions_verification(const google_protobuf_ExtensionRangeOptions* msg) { |
| 5507 | int32_t default_val = 1; |
| 5508 | int32_t ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 5509 | 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] | 5510 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 5511 | return ret; |
| 5512 | } |
| 5513 | 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] | 5514 | const upb_MiniTableField field = {3, UPB_SIZE(8, 4), 1, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
| 5515 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 5516 | } |
| 5517 | UPB_INLINE void google_protobuf_ExtensionRangeOptions_clear_features(google_protobuf_ExtensionRangeOptions* msg) { |
| 5518 | 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)}; |
| 5519 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 5520 | } |
| 5521 | UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_ExtensionRangeOptions_features(const google_protobuf_ExtensionRangeOptions* msg) { |
| 5522 | const google_protobuf_FeatureSet* default_val = NULL; |
| 5523 | const google_protobuf_FeatureSet* ret; |
| 5524 | 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)}; |
| 5525 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 5526 | return ret; |
| 5527 | } |
| 5528 | UPB_INLINE bool google_protobuf_ExtensionRangeOptions_has_features(const google_protobuf_ExtensionRangeOptions* msg) { |
| 5529 | 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] | 5530 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 5531 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5532 | 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] | 5533 | 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] | 5534 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5535 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5536 | 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] | 5537 | 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] | 5538 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 5539 | if (arr) { |
| 5540 | if (size) *size = arr->size; |
| 5541 | return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr); |
| 5542 | } else { |
| 5543 | if (size) *size = 0; |
| 5544 | return NULL; |
| 5545 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5546 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 5547 | 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] | 5548 | 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] | 5549 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 5550 | if (size) { |
| 5551 | *size = arr ? arr->size : 0; |
| 5552 | } |
| 5553 | return arr; |
| 5554 | } |
| 5555 | 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] | 5556 | 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] | 5557 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 5558 | (upb_Message*)msg, &field, arena); |
| 5559 | if (size) { |
| 5560 | *size = arr ? arr->size : 0; |
| 5561 | } |
| 5562 | return arr; |
| 5563 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5564 | UPB_INLINE bool google_protobuf_ExtensionRangeOptions_has_uninterpreted_option(const google_protobuf_ExtensionRangeOptions* msg) { |
| 5565 | size_t size; |
| 5566 | google_protobuf_ExtensionRangeOptions_uninterpreted_option(msg, &size); |
| 5567 | return size != 0; |
| 5568 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5569 | |
Mike Kruskal | 145900f | 2023-03-27 09:55:52 -0700 | [diff] [blame] | 5570 | 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] | 5571 | 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] | 5572 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 5573 | if (arr) { |
| 5574 | if (size) *size = arr->size; |
| 5575 | return (google_protobuf_ExtensionRangeOptions_Declaration**)_upb_array_ptr(arr); |
| 5576 | } else { |
| 5577 | if (size) *size = 0; |
| 5578 | return NULL; |
| 5579 | } |
| 5580 | } |
| 5581 | 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] | 5582 | 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] | 5583 | return (google_protobuf_ExtensionRangeOptions_Declaration**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Mike Kruskal | 145900f | 2023-03-27 09:55:52 -0700 | [diff] [blame] | 5584 | } |
| 5585 | 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] | 5586 | 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] | 5587 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 5588 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 5589 | return NULL; |
| 5590 | } |
| 5591 | struct google_protobuf_ExtensionRangeOptions_Declaration* sub = (struct google_protobuf_ExtensionRangeOptions_Declaration*)_upb_Message_New(&google_protobuf_ExtensionRangeOptions_Declaration_msg_init, arena); |
| 5592 | if (!arr || !sub) return NULL; |
| 5593 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
| 5594 | return sub; |
| 5595 | } |
Protobuf Team Bot | 469f027 | 2023-04-21 18:12:45 -0700 | [diff] [blame] | 5596 | 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] | 5597 | 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] | 5598 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 5599 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 5600 | UPB_INLINE void google_protobuf_ExtensionRangeOptions_set_features(google_protobuf_ExtensionRangeOptions *msg, google_protobuf_FeatureSet* value) { |
| 5601 | 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)}; |
| 5602 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 5603 | } |
| 5604 | UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_ExtensionRangeOptions_mutable_features(google_protobuf_ExtensionRangeOptions* msg, upb_Arena* arena) { |
| 5605 | struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_ExtensionRangeOptions_features(msg); |
| 5606 | if (sub == NULL) { |
| 5607 | sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google_protobuf_FeatureSet_msg_init, arena); |
| 5608 | if (sub) google_protobuf_ExtensionRangeOptions_set_features(msg, sub); |
| 5609 | } |
| 5610 | return sub; |
| 5611 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5612 | 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] | 5613 | 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] | 5614 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 5615 | if (arr) { |
| 5616 | if (size) *size = arr->size; |
| 5617 | return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr); |
| 5618 | } else { |
| 5619 | if (size) *size = 0; |
| 5620 | return NULL; |
| 5621 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5622 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5623 | 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] | 5624 | 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] | 5625 | return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5626 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5627 | 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] | 5628 | 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] | 5629 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 5630 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 5631 | return NULL; |
| 5632 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5633 | 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] | 5634 | if (!arr || !sub) return NULL; |
| 5635 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5636 | return sub; |
| 5637 | } |
| 5638 | |
Mike Kruskal | 145900f | 2023-03-27 09:55:52 -0700 | [diff] [blame] | 5639 | /* google.protobuf.ExtensionRangeOptions.Declaration */ |
| 5640 | |
| 5641 | UPB_INLINE google_protobuf_ExtensionRangeOptions_Declaration* google_protobuf_ExtensionRangeOptions_Declaration_new(upb_Arena* arena) { |
| 5642 | return (google_protobuf_ExtensionRangeOptions_Declaration*)_upb_Message_New(&google_protobuf_ExtensionRangeOptions_Declaration_msg_init, arena); |
| 5643 | } |
| 5644 | UPB_INLINE google_protobuf_ExtensionRangeOptions_Declaration* google_protobuf_ExtensionRangeOptions_Declaration_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 5645 | google_protobuf_ExtensionRangeOptions_Declaration* ret = google_protobuf_ExtensionRangeOptions_Declaration_new(arena); |
| 5646 | if (!ret) return NULL; |
| 5647 | if (upb_Decode(buf, size, ret, &google_protobuf_ExtensionRangeOptions_Declaration_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { |
| 5648 | return NULL; |
| 5649 | } |
| 5650 | return ret; |
| 5651 | } |
| 5652 | UPB_INLINE google_protobuf_ExtensionRangeOptions_Declaration* google_protobuf_ExtensionRangeOptions_Declaration_parse_ex(const char* buf, size_t size, |
| 5653 | const upb_ExtensionRegistry* extreg, |
| 5654 | int options, upb_Arena* arena) { |
| 5655 | google_protobuf_ExtensionRangeOptions_Declaration* ret = google_protobuf_ExtensionRangeOptions_Declaration_new(arena); |
| 5656 | if (!ret) return NULL; |
| 5657 | if (upb_Decode(buf, size, ret, &google_protobuf_ExtensionRangeOptions_Declaration_msg_init, extreg, options, arena) != |
| 5658 | kUpb_DecodeStatus_Ok) { |
| 5659 | return NULL; |
| 5660 | } |
| 5661 | return ret; |
| 5662 | } |
| 5663 | UPB_INLINE char* google_protobuf_ExtensionRangeOptions_Declaration_serialize(const google_protobuf_ExtensionRangeOptions_Declaration* msg, upb_Arena* arena, size_t* len) { |
| 5664 | char* ptr; |
| 5665 | (void)upb_Encode(msg, &google_protobuf_ExtensionRangeOptions_Declaration_msg_init, 0, arena, &ptr, len); |
| 5666 | return ptr; |
| 5667 | } |
| 5668 | UPB_INLINE char* google_protobuf_ExtensionRangeOptions_Declaration_serialize_ex(const google_protobuf_ExtensionRangeOptions_Declaration* msg, int options, |
| 5669 | upb_Arena* arena, size_t* len) { |
| 5670 | char* ptr; |
| 5671 | (void)upb_Encode(msg, &google_protobuf_ExtensionRangeOptions_Declaration_msg_init, options, arena, &ptr, len); |
| 5672 | return ptr; |
| 5673 | } |
| 5674 | 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] | 5675 | 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] | 5676 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 5677 | } |
| 5678 | UPB_INLINE int32_t google_protobuf_ExtensionRangeOptions_Declaration_number(const google_protobuf_ExtensionRangeOptions_Declaration* msg) { |
| 5679 | int32_t default_val = (int32_t)0; |
| 5680 | int32_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5681 | 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] | 5682 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 5683 | return ret; |
| 5684 | } |
| 5685 | 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] | 5686 | 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] | 5687 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 5688 | } |
| 5689 | 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] | 5690 | 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] | 5691 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 5692 | } |
| 5693 | UPB_INLINE upb_StringView google_protobuf_ExtensionRangeOptions_Declaration_full_name(const google_protobuf_ExtensionRangeOptions_Declaration* msg) { |
| 5694 | upb_StringView default_val = upb_StringView_FromString(""); |
| 5695 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5696 | 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] | 5697 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 5698 | return ret; |
| 5699 | } |
| 5700 | 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] | 5701 | 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] | 5702 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 5703 | } |
| 5704 | 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] | 5705 | 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] | 5706 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 5707 | } |
| 5708 | UPB_INLINE upb_StringView google_protobuf_ExtensionRangeOptions_Declaration_type(const google_protobuf_ExtensionRangeOptions_Declaration* msg) { |
| 5709 | upb_StringView default_val = upb_StringView_FromString(""); |
| 5710 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5711 | 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] | 5712 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 5713 | return ret; |
| 5714 | } |
| 5715 | 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] | 5716 | 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] | 5717 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 5718 | } |
Protobuf Team Bot | 41287bd | 2023-04-10 18:57:14 -0700 | [diff] [blame] | 5719 | 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] | 5720 | 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] | 5721 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 5722 | } |
| 5723 | UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_reserved(const google_protobuf_ExtensionRangeOptions_Declaration* msg) { |
| 5724 | bool default_val = false; |
| 5725 | bool ret; |
Sandy Zhang | 96c601d | 2023-07-05 12:39:20 -0700 | [diff] [blame] | 5726 | 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] | 5727 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 5728 | return ret; |
| 5729 | } |
| 5730 | 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] | 5731 | 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] | 5732 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 5733 | } |
Protobuf Team Bot | 469f027 | 2023-04-21 18:12:45 -0700 | [diff] [blame] | 5734 | 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] | 5735 | 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] | 5736 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 5737 | } |
| 5738 | UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_repeated(const google_protobuf_ExtensionRangeOptions_Declaration* msg) { |
| 5739 | bool default_val = false; |
| 5740 | bool ret; |
Sandy Zhang | 96c601d | 2023-07-05 12:39:20 -0700 | [diff] [blame] | 5741 | 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] | 5742 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 5743 | return ret; |
| 5744 | } |
| 5745 | 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] | 5746 | 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] | 5747 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 5748 | } |
Mike Kruskal | 145900f | 2023-03-27 09:55:52 -0700 | [diff] [blame] | 5749 | |
| 5750 | 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] | 5751 | 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] | 5752 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 5753 | } |
| 5754 | 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] | 5755 | 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] | 5756 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 5757 | } |
| 5758 | 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] | 5759 | 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] | 5760 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 5761 | } |
Protobuf Team Bot | 41287bd | 2023-04-10 18:57:14 -0700 | [diff] [blame] | 5762 | 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] | 5763 | 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] | 5764 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 5765 | } |
Protobuf Team Bot | 469f027 | 2023-04-21 18:12:45 -0700 | [diff] [blame] | 5766 | 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] | 5767 | 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] | 5768 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 5769 | } |
Mike Kruskal | 145900f | 2023-03-27 09:55:52 -0700 | [diff] [blame] | 5770 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5771 | /* google.protobuf.FieldDescriptorProto */ |
| 5772 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5773 | UPB_INLINE google_protobuf_FieldDescriptorProto* google_protobuf_FieldDescriptorProto_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5774 | 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] | 5775 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5776 | UPB_INLINE google_protobuf_FieldDescriptorProto* google_protobuf_FieldDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 5777 | google_protobuf_FieldDescriptorProto* ret = google_protobuf_FieldDescriptorProto_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 5778 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5779 | 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] | 5780 | return NULL; |
| 5781 | } |
| 5782 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5783 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5784 | UPB_INLINE google_protobuf_FieldDescriptorProto* google_protobuf_FieldDescriptorProto_parse_ex(const char* buf, size_t size, |
| 5785 | const upb_ExtensionRegistry* extreg, |
| 5786 | int options, upb_Arena* arena) { |
| 5787 | google_protobuf_FieldDescriptorProto* ret = google_protobuf_FieldDescriptorProto_new(arena); |
| 5788 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5789 | 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] | 5790 | kUpb_DecodeStatus_Ok) { |
| 5791 | return NULL; |
| 5792 | } |
| 5793 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5794 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5795 | 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] | 5796 | char* ptr; |
| 5797 | (void)upb_Encode(msg, &google_protobuf_FieldDescriptorProto_msg_init, 0, arena, &ptr, len); |
| 5798 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5799 | } |
| 5800 | UPB_INLINE char* google_protobuf_FieldDescriptorProto_serialize_ex(const google_protobuf_FieldDescriptorProto* msg, int options, |
| 5801 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5802 | char* ptr; |
| 5803 | (void)upb_Encode(msg, &google_protobuf_FieldDescriptorProto_msg_init, options, arena, &ptr, len); |
| 5804 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5805 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5806 | UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_name(google_protobuf_FieldDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5807 | 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] | 5808 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5809 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5810 | 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] | 5811 | upb_StringView default_val = upb_StringView_FromString(""); |
| 5812 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5813 | 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] | 5814 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 5815 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5816 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5817 | 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] | 5818 | 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] | 5819 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5820 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5821 | UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_extendee(google_protobuf_FieldDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5822 | 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] | 5823 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5824 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5825 | 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] | 5826 | upb_StringView default_val = upb_StringView_FromString(""); |
| 5827 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5828 | 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] | 5829 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 5830 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5831 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5832 | 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] | 5833 | 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] | 5834 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5835 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5836 | UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_number(google_protobuf_FieldDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5837 | 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] | 5838 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5839 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5840 | 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] | 5841 | int32_t default_val = (int32_t)0; |
| 5842 | int32_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5843 | 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] | 5844 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 5845 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5846 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5847 | 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] | 5848 | 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] | 5849 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5850 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5851 | UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_label(google_protobuf_FieldDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5852 | 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] | 5853 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5854 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5855 | 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] | 5856 | int32_t default_val = 1; |
| 5857 | int32_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5858 | 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] | 5859 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 5860 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5861 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5862 | 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] | 5863 | 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] | 5864 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5865 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5866 | UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_type(google_protobuf_FieldDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5867 | 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] | 5868 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5869 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5870 | 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] | 5871 | int32_t default_val = 1; |
| 5872 | int32_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5873 | 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] | 5874 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 5875 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5876 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5877 | 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] | 5878 | 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] | 5879 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5880 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5881 | 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] | 5882 | 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] | 5883 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5884 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5885 | 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] | 5886 | upb_StringView default_val = upb_StringView_FromString(""); |
| 5887 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5888 | 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] | 5889 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 5890 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5891 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5892 | 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] | 5893 | 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] | 5894 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5895 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5896 | 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] | 5897 | 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] | 5898 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5899 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5900 | 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] | 5901 | upb_StringView default_val = upb_StringView_FromString(""); |
| 5902 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5903 | 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] | 5904 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 5905 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5906 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5907 | 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] | 5908 | 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] | 5909 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5910 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5911 | UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_options(google_protobuf_FieldDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5912 | 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] | 5913 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5914 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5915 | 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] | 5916 | const google_protobuf_FieldOptions* default_val = NULL; |
| 5917 | const google_protobuf_FieldOptions* ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5918 | 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] | 5919 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 5920 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5921 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5922 | 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] | 5923 | 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] | 5924 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5925 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5926 | 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] | 5927 | 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] | 5928 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5929 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5930 | 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] | 5931 | int32_t default_val = (int32_t)0; |
| 5932 | int32_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5933 | 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] | 5934 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 5935 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5936 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5937 | 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] | 5938 | 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] | 5939 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5940 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5941 | 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] | 5942 | 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] | 5943 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5944 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5945 | 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] | 5946 | upb_StringView default_val = upb_StringView_FromString(""); |
| 5947 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5948 | 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] | 5949 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 5950 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5951 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5952 | 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] | 5953 | 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] | 5954 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5955 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5956 | 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] | 5957 | 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] | 5958 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5959 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5960 | 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] | 5961 | bool default_val = false; |
| 5962 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5963 | 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] | 5964 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 5965 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5966 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5967 | 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] | 5968 | 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] | 5969 | return _upb_Message_HasNonExtensionField(msg, &field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5970 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5971 | |
| 5972 | 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] | 5973 | 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] | 5974 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 5975 | } |
| 5976 | 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] | 5977 | 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] | 5978 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 5979 | } |
| 5980 | 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] | 5981 | 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] | 5982 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 5983 | } |
| 5984 | 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] | 5985 | 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] | 5986 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 5987 | } |
| 5988 | 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] | 5989 | 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] | 5990 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 5991 | } |
| 5992 | 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] | 5993 | 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] | 5994 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 5995 | } |
| 5996 | 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] | 5997 | 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] | 5998 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 5999 | } |
| 6000 | 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] | 6001 | 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] | 6002 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6003 | } |
| 6004 | 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] | 6005 | struct google_protobuf_FieldOptions* sub = (struct google_protobuf_FieldOptions*)google_protobuf_FieldDescriptorProto_options(msg); |
| 6006 | if (sub == NULL) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6007 | 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] | 6008 | if (sub) google_protobuf_FieldDescriptorProto_set_options(msg, sub); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6009 | } |
| 6010 | return sub; |
| 6011 | } |
| 6012 | 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] | 6013 | 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] | 6014 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6015 | } |
| 6016 | 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] | 6017 | 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] | 6018 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6019 | } |
| 6020 | 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] | 6021 | 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] | 6022 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6023 | } |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6024 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6025 | /* google.protobuf.OneofDescriptorProto */ |
| 6026 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6027 | UPB_INLINE google_protobuf_OneofDescriptorProto* google_protobuf_OneofDescriptorProto_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6028 | 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] | 6029 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6030 | UPB_INLINE google_protobuf_OneofDescriptorProto* google_protobuf_OneofDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 6031 | google_protobuf_OneofDescriptorProto* ret = google_protobuf_OneofDescriptorProto_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 6032 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6033 | 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] | 6034 | return NULL; |
| 6035 | } |
| 6036 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6037 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6038 | UPB_INLINE google_protobuf_OneofDescriptorProto* google_protobuf_OneofDescriptorProto_parse_ex(const char* buf, size_t size, |
| 6039 | const upb_ExtensionRegistry* extreg, |
| 6040 | int options, upb_Arena* arena) { |
| 6041 | google_protobuf_OneofDescriptorProto* ret = google_protobuf_OneofDescriptorProto_new(arena); |
| 6042 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6043 | 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] | 6044 | kUpb_DecodeStatus_Ok) { |
| 6045 | return NULL; |
| 6046 | } |
| 6047 | return ret; |
| 6048 | } |
| 6049 | 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] | 6050 | char* ptr; |
| 6051 | (void)upb_Encode(msg, &google_protobuf_OneofDescriptorProto_msg_init, 0, arena, &ptr, len); |
| 6052 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6053 | } |
| 6054 | UPB_INLINE char* google_protobuf_OneofDescriptorProto_serialize_ex(const google_protobuf_OneofDescriptorProto* msg, int options, |
| 6055 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6056 | char* ptr; |
| 6057 | (void)upb_Encode(msg, &google_protobuf_OneofDescriptorProto_msg_init, options, arena, &ptr, len); |
| 6058 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6059 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6060 | UPB_INLINE void google_protobuf_OneofDescriptorProto_clear_name(google_protobuf_OneofDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6061 | 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] | 6062 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6063 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6064 | 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] | 6065 | upb_StringView default_val = upb_StringView_FromString(""); |
| 6066 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6067 | 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] | 6068 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6069 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6070 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6071 | 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] | 6072 | 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] | 6073 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6074 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6075 | UPB_INLINE void google_protobuf_OneofDescriptorProto_clear_options(google_protobuf_OneofDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6076 | 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] | 6077 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6078 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6079 | 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] | 6080 | const google_protobuf_OneofOptions* default_val = NULL; |
| 6081 | const google_protobuf_OneofOptions* ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6082 | 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] | 6083 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6084 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6085 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6086 | 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] | 6087 | 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] | 6088 | return _upb_Message_HasNonExtensionField(msg, &field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6089 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6090 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6091 | 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] | 6092 | 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] | 6093 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6094 | } |
| 6095 | 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] | 6096 | 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] | 6097 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6098 | } |
| 6099 | 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] | 6100 | struct google_protobuf_OneofOptions* sub = (struct google_protobuf_OneofOptions*)google_protobuf_OneofDescriptorProto_options(msg); |
| 6101 | if (sub == NULL) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6102 | 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] | 6103 | if (sub) google_protobuf_OneofDescriptorProto_set_options(msg, sub); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6104 | } |
| 6105 | return sub; |
| 6106 | } |
| 6107 | |
| 6108 | /* google.protobuf.EnumDescriptorProto */ |
| 6109 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6110 | UPB_INLINE google_protobuf_EnumDescriptorProto* google_protobuf_EnumDescriptorProto_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6111 | 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] | 6112 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6113 | UPB_INLINE google_protobuf_EnumDescriptorProto* google_protobuf_EnumDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 6114 | google_protobuf_EnumDescriptorProto* ret = google_protobuf_EnumDescriptorProto_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 6115 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6116 | 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] | 6117 | return NULL; |
| 6118 | } |
| 6119 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6120 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6121 | UPB_INLINE google_protobuf_EnumDescriptorProto* google_protobuf_EnumDescriptorProto_parse_ex(const char* buf, size_t size, |
| 6122 | const upb_ExtensionRegistry* extreg, |
| 6123 | int options, upb_Arena* arena) { |
| 6124 | google_protobuf_EnumDescriptorProto* ret = google_protobuf_EnumDescriptorProto_new(arena); |
| 6125 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6126 | 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] | 6127 | kUpb_DecodeStatus_Ok) { |
| 6128 | return NULL; |
| 6129 | } |
| 6130 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6131 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6132 | 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] | 6133 | char* ptr; |
| 6134 | (void)upb_Encode(msg, &google_protobuf_EnumDescriptorProto_msg_init, 0, arena, &ptr, len); |
| 6135 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6136 | } |
| 6137 | UPB_INLINE char* google_protobuf_EnumDescriptorProto_serialize_ex(const google_protobuf_EnumDescriptorProto* msg, int options, |
| 6138 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6139 | char* ptr; |
| 6140 | (void)upb_Encode(msg, &google_protobuf_EnumDescriptorProto_msg_init, options, arena, &ptr, len); |
| 6141 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6142 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6143 | UPB_INLINE void google_protobuf_EnumDescriptorProto_clear_name(google_protobuf_EnumDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6144 | 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] | 6145 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6146 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6147 | 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] | 6148 | upb_StringView default_val = upb_StringView_FromString(""); |
| 6149 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6150 | 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] | 6151 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6152 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6153 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6154 | 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] | 6155 | 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] | 6156 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6157 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6158 | UPB_INLINE void google_protobuf_EnumDescriptorProto_clear_value(google_protobuf_EnumDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6159 | 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] | 6160 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6161 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 6162 | 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] | 6163 | 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] | 6164 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 6165 | if (arr) { |
| 6166 | if (size) *size = arr->size; |
| 6167 | return (const google_protobuf_EnumValueDescriptorProto* const*)_upb_array_constptr(arr); |
| 6168 | } else { |
| 6169 | if (size) *size = 0; |
| 6170 | return NULL; |
| 6171 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6172 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 6173 | 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] | 6174 | 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] | 6175 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 6176 | if (size) { |
| 6177 | *size = arr ? arr->size : 0; |
| 6178 | } |
| 6179 | return arr; |
| 6180 | } |
| 6181 | 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] | 6182 | 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] | 6183 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 6184 | (upb_Message*)msg, &field, arena); |
| 6185 | if (size) { |
| 6186 | *size = arr ? arr->size : 0; |
| 6187 | } |
| 6188 | return arr; |
| 6189 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6190 | UPB_INLINE bool google_protobuf_EnumDescriptorProto_has_value(const google_protobuf_EnumDescriptorProto* msg) { |
| 6191 | size_t size; |
| 6192 | google_protobuf_EnumDescriptorProto_value(msg, &size); |
| 6193 | return size != 0; |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6194 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6195 | UPB_INLINE void google_protobuf_EnumDescriptorProto_clear_options(google_protobuf_EnumDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6196 | 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] | 6197 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6198 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6199 | 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] | 6200 | const google_protobuf_EnumOptions* default_val = NULL; |
| 6201 | const google_protobuf_EnumOptions* ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6202 | 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] | 6203 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6204 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6205 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6206 | 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] | 6207 | 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] | 6208 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6209 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6210 | 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] | 6211 | 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] | 6212 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6213 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 6214 | 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] | 6215 | 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] | 6216 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 6217 | if (arr) { |
| 6218 | if (size) *size = arr->size; |
| 6219 | return (const google_protobuf_EnumDescriptorProto_EnumReservedRange* const*)_upb_array_constptr(arr); |
| 6220 | } else { |
| 6221 | if (size) *size = 0; |
| 6222 | return NULL; |
| 6223 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6224 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 6225 | 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] | 6226 | 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] | 6227 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 6228 | if (size) { |
| 6229 | *size = arr ? arr->size : 0; |
| 6230 | } |
| 6231 | return arr; |
| 6232 | } |
| 6233 | 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] | 6234 | 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] | 6235 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 6236 | (upb_Message*)msg, &field, arena); |
| 6237 | if (size) { |
| 6238 | *size = arr ? arr->size : 0; |
| 6239 | } |
| 6240 | return arr; |
| 6241 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6242 | UPB_INLINE bool google_protobuf_EnumDescriptorProto_has_reserved_range(const google_protobuf_EnumDescriptorProto* msg) { |
| 6243 | size_t size; |
| 6244 | google_protobuf_EnumDescriptorProto_reserved_range(msg, &size); |
| 6245 | return size != 0; |
| 6246 | } |
| 6247 | 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] | 6248 | 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] | 6249 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6250 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 6251 | 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] | 6252 | 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] | 6253 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 6254 | if (arr) { |
| 6255 | if (size) *size = arr->size; |
| 6256 | return (upb_StringView const*)_upb_array_constptr(arr); |
| 6257 | } else { |
| 6258 | if (size) *size = 0; |
| 6259 | return NULL; |
| 6260 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6261 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 6262 | 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] | 6263 | 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] | 6264 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 6265 | if (size) { |
| 6266 | *size = arr ? arr->size : 0; |
| 6267 | } |
| 6268 | return arr; |
| 6269 | } |
| 6270 | 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] | 6271 | 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] | 6272 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 6273 | (upb_Message*)msg, &field, arena); |
| 6274 | if (size) { |
| 6275 | *size = arr ? arr->size : 0; |
| 6276 | } |
| 6277 | return arr; |
| 6278 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6279 | UPB_INLINE bool google_protobuf_EnumDescriptorProto_has_reserved_name(const google_protobuf_EnumDescriptorProto* msg) { |
| 6280 | size_t size; |
| 6281 | google_protobuf_EnumDescriptorProto_reserved_name(msg, &size); |
| 6282 | return size != 0; |
| 6283 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6284 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6285 | 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] | 6286 | 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] | 6287 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6288 | } |
| 6289 | 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] | 6290 | 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] | 6291 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 6292 | if (arr) { |
| 6293 | if (size) *size = arr->size; |
| 6294 | return (google_protobuf_EnumValueDescriptorProto**)_upb_array_ptr(arr); |
| 6295 | } else { |
| 6296 | if (size) *size = 0; |
| 6297 | return NULL; |
| 6298 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6299 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 6300 | 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] | 6301 | 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] | 6302 | return (google_protobuf_EnumValueDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6303 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6304 | 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] | 6305 | 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] | 6306 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 6307 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 6308 | return NULL; |
| 6309 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6310 | 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] | 6311 | if (!arr || !sub) return NULL; |
| 6312 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6313 | return sub; |
| 6314 | } |
| 6315 | 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] | 6316 | 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] | 6317 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6318 | } |
| 6319 | 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] | 6320 | struct google_protobuf_EnumOptions* sub = (struct google_protobuf_EnumOptions*)google_protobuf_EnumDescriptorProto_options(msg); |
| 6321 | if (sub == NULL) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6322 | 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] | 6323 | if (sub) google_protobuf_EnumDescriptorProto_set_options(msg, sub); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6324 | } |
| 6325 | return sub; |
| 6326 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 6327 | 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] | 6328 | 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] | 6329 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 6330 | if (arr) { |
| 6331 | if (size) *size = arr->size; |
| 6332 | return (google_protobuf_EnumDescriptorProto_EnumReservedRange**)_upb_array_ptr(arr); |
| 6333 | } else { |
| 6334 | if (size) *size = 0; |
| 6335 | return NULL; |
| 6336 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6337 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 6338 | 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] | 6339 | 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] | 6340 | return (google_protobuf_EnumDescriptorProto_EnumReservedRange**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6341 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6342 | 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] | 6343 | 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] | 6344 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 6345 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 6346 | return NULL; |
| 6347 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6348 | 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] | 6349 | if (!arr || !sub) return NULL; |
| 6350 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6351 | return sub; |
| 6352 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 6353 | 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] | 6354 | 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] | 6355 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 6356 | if (arr) { |
| 6357 | if (size) *size = arr->size; |
| 6358 | return (upb_StringView*)_upb_array_ptr(arr); |
| 6359 | } else { |
| 6360 | if (size) *size = 0; |
| 6361 | return NULL; |
| 6362 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6363 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 6364 | 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] | 6365 | 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] | 6366 | return (upb_StringView*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6367 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6368 | 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] | 6369 | 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] | 6370 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 6371 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 6372 | return false; |
| 6373 | } |
| 6374 | _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val)); |
| 6375 | return true; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6376 | } |
| 6377 | |
| 6378 | /* google.protobuf.EnumDescriptorProto.EnumReservedRange */ |
| 6379 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6380 | UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange* google_protobuf_EnumDescriptorProto_EnumReservedRange_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6381 | 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] | 6382 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6383 | UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange* google_protobuf_EnumDescriptorProto_EnumReservedRange_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 6384 | google_protobuf_EnumDescriptorProto_EnumReservedRange* ret = google_protobuf_EnumDescriptorProto_EnumReservedRange_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 6385 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6386 | 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] | 6387 | return NULL; |
| 6388 | } |
| 6389 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6390 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6391 | UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange* google_protobuf_EnumDescriptorProto_EnumReservedRange_parse_ex(const char* buf, size_t size, |
| 6392 | const upb_ExtensionRegistry* extreg, |
| 6393 | int options, upb_Arena* arena) { |
| 6394 | google_protobuf_EnumDescriptorProto_EnumReservedRange* ret = google_protobuf_EnumDescriptorProto_EnumReservedRange_new(arena); |
| 6395 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6396 | 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] | 6397 | kUpb_DecodeStatus_Ok) { |
| 6398 | return NULL; |
| 6399 | } |
| 6400 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6401 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6402 | 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] | 6403 | char* ptr; |
| 6404 | (void)upb_Encode(msg, &google_protobuf_EnumDescriptorProto_EnumReservedRange_msg_init, 0, arena, &ptr, len); |
| 6405 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6406 | } |
| 6407 | UPB_INLINE char* google_protobuf_EnumDescriptorProto_EnumReservedRange_serialize_ex(const google_protobuf_EnumDescriptorProto_EnumReservedRange* msg, int options, |
| 6408 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6409 | char* ptr; |
| 6410 | (void)upb_Encode(msg, &google_protobuf_EnumDescriptorProto_EnumReservedRange_msg_init, options, arena, &ptr, len); |
| 6411 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6412 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6413 | 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] | 6414 | 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] | 6415 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6416 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6417 | 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] | 6418 | int32_t default_val = (int32_t)0; |
| 6419 | int32_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6420 | 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] | 6421 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6422 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6423 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6424 | 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] | 6425 | 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] | 6426 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6427 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6428 | 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] | 6429 | 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] | 6430 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6431 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6432 | 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] | 6433 | int32_t default_val = (int32_t)0; |
| 6434 | int32_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6435 | 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] | 6436 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6437 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6438 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6439 | 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] | 6440 | 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] | 6441 | return _upb_Message_HasNonExtensionField(msg, &field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6442 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6443 | |
| 6444 | 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] | 6445 | 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] | 6446 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6447 | } |
| 6448 | 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] | 6449 | 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] | 6450 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6451 | } |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6452 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6453 | /* google.protobuf.EnumValueDescriptorProto */ |
| 6454 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6455 | UPB_INLINE google_protobuf_EnumValueDescriptorProto* google_protobuf_EnumValueDescriptorProto_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6456 | 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] | 6457 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6458 | UPB_INLINE google_protobuf_EnumValueDescriptorProto* google_protobuf_EnumValueDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 6459 | google_protobuf_EnumValueDescriptorProto* ret = google_protobuf_EnumValueDescriptorProto_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 6460 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6461 | 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] | 6462 | return NULL; |
| 6463 | } |
| 6464 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6465 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6466 | UPB_INLINE google_protobuf_EnumValueDescriptorProto* google_protobuf_EnumValueDescriptorProto_parse_ex(const char* buf, size_t size, |
| 6467 | const upb_ExtensionRegistry* extreg, |
| 6468 | int options, upb_Arena* arena) { |
| 6469 | google_protobuf_EnumValueDescriptorProto* ret = google_protobuf_EnumValueDescriptorProto_new(arena); |
| 6470 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6471 | 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] | 6472 | kUpb_DecodeStatus_Ok) { |
| 6473 | return NULL; |
| 6474 | } |
| 6475 | return ret; |
| 6476 | } |
| 6477 | 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] | 6478 | char* ptr; |
| 6479 | (void)upb_Encode(msg, &google_protobuf_EnumValueDescriptorProto_msg_init, 0, arena, &ptr, len); |
| 6480 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6481 | } |
| 6482 | UPB_INLINE char* google_protobuf_EnumValueDescriptorProto_serialize_ex(const google_protobuf_EnumValueDescriptorProto* msg, int options, |
| 6483 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6484 | char* ptr; |
| 6485 | (void)upb_Encode(msg, &google_protobuf_EnumValueDescriptorProto_msg_init, options, arena, &ptr, len); |
| 6486 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6487 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6488 | UPB_INLINE void google_protobuf_EnumValueDescriptorProto_clear_name(google_protobuf_EnumValueDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6489 | 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] | 6490 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6491 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6492 | 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] | 6493 | upb_StringView default_val = upb_StringView_FromString(""); |
| 6494 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6495 | 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] | 6496 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6497 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6498 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6499 | 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] | 6500 | 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] | 6501 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6502 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6503 | UPB_INLINE void google_protobuf_EnumValueDescriptorProto_clear_number(google_protobuf_EnumValueDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6504 | 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] | 6505 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6506 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6507 | 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] | 6508 | int32_t default_val = (int32_t)0; |
| 6509 | int32_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6510 | 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] | 6511 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6512 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6513 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6514 | 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] | 6515 | 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] | 6516 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6517 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6518 | UPB_INLINE void google_protobuf_EnumValueDescriptorProto_clear_options(google_protobuf_EnumValueDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6519 | 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] | 6520 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6521 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6522 | 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] | 6523 | const google_protobuf_EnumValueOptions* default_val = NULL; |
| 6524 | const google_protobuf_EnumValueOptions* ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6525 | 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] | 6526 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6527 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6528 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6529 | 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] | 6530 | 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] | 6531 | return _upb_Message_HasNonExtensionField(msg, &field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6532 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6533 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6534 | 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] | 6535 | 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] | 6536 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6537 | } |
| 6538 | 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] | 6539 | 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] | 6540 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6541 | } |
| 6542 | 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] | 6543 | 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] | 6544 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6545 | } |
| 6546 | 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] | 6547 | struct google_protobuf_EnumValueOptions* sub = (struct google_protobuf_EnumValueOptions*)google_protobuf_EnumValueDescriptorProto_options(msg); |
| 6548 | if (sub == NULL) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6549 | 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] | 6550 | if (sub) google_protobuf_EnumValueDescriptorProto_set_options(msg, sub); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6551 | } |
| 6552 | return sub; |
| 6553 | } |
| 6554 | |
| 6555 | /* google.protobuf.ServiceDescriptorProto */ |
| 6556 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6557 | UPB_INLINE google_protobuf_ServiceDescriptorProto* google_protobuf_ServiceDescriptorProto_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6558 | 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] | 6559 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6560 | UPB_INLINE google_protobuf_ServiceDescriptorProto* google_protobuf_ServiceDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 6561 | google_protobuf_ServiceDescriptorProto* ret = google_protobuf_ServiceDescriptorProto_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 6562 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6563 | 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] | 6564 | return NULL; |
| 6565 | } |
| 6566 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6567 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6568 | UPB_INLINE google_protobuf_ServiceDescriptorProto* google_protobuf_ServiceDescriptorProto_parse_ex(const char* buf, size_t size, |
| 6569 | const upb_ExtensionRegistry* extreg, |
| 6570 | int options, upb_Arena* arena) { |
| 6571 | google_protobuf_ServiceDescriptorProto* ret = google_protobuf_ServiceDescriptorProto_new(arena); |
| 6572 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6573 | 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] | 6574 | kUpb_DecodeStatus_Ok) { |
| 6575 | return NULL; |
| 6576 | } |
| 6577 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6578 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6579 | 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] | 6580 | char* ptr; |
| 6581 | (void)upb_Encode(msg, &google_protobuf_ServiceDescriptorProto_msg_init, 0, arena, &ptr, len); |
| 6582 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6583 | } |
| 6584 | UPB_INLINE char* google_protobuf_ServiceDescriptorProto_serialize_ex(const google_protobuf_ServiceDescriptorProto* msg, int options, |
| 6585 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6586 | char* ptr; |
| 6587 | (void)upb_Encode(msg, &google_protobuf_ServiceDescriptorProto_msg_init, options, arena, &ptr, len); |
| 6588 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6589 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6590 | UPB_INLINE void google_protobuf_ServiceDescriptorProto_clear_name(google_protobuf_ServiceDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6591 | 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] | 6592 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6593 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6594 | 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] | 6595 | upb_StringView default_val = upb_StringView_FromString(""); |
| 6596 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6597 | 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] | 6598 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6599 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6600 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6601 | 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] | 6602 | 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] | 6603 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6604 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6605 | UPB_INLINE void google_protobuf_ServiceDescriptorProto_clear_method(google_protobuf_ServiceDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6606 | 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] | 6607 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6608 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 6609 | 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] | 6610 | 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] | 6611 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 6612 | if (arr) { |
| 6613 | if (size) *size = arr->size; |
| 6614 | return (const google_protobuf_MethodDescriptorProto* const*)_upb_array_constptr(arr); |
| 6615 | } else { |
| 6616 | if (size) *size = 0; |
| 6617 | return NULL; |
| 6618 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6619 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 6620 | 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] | 6621 | 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] | 6622 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 6623 | if (size) { |
| 6624 | *size = arr ? arr->size : 0; |
| 6625 | } |
| 6626 | return arr; |
| 6627 | } |
| 6628 | 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] | 6629 | 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] | 6630 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 6631 | (upb_Message*)msg, &field, arena); |
| 6632 | if (size) { |
| 6633 | *size = arr ? arr->size : 0; |
| 6634 | } |
| 6635 | return arr; |
| 6636 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6637 | UPB_INLINE bool google_protobuf_ServiceDescriptorProto_has_method(const google_protobuf_ServiceDescriptorProto* msg) { |
| 6638 | size_t size; |
| 6639 | google_protobuf_ServiceDescriptorProto_method(msg, &size); |
| 6640 | return size != 0; |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6641 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6642 | UPB_INLINE void google_protobuf_ServiceDescriptorProto_clear_options(google_protobuf_ServiceDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6643 | 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] | 6644 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6645 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6646 | 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] | 6647 | const google_protobuf_ServiceOptions* default_val = NULL; |
| 6648 | const google_protobuf_ServiceOptions* ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6649 | 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] | 6650 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6651 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6652 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6653 | 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] | 6654 | 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] | 6655 | return _upb_Message_HasNonExtensionField(msg, &field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6656 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6657 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6658 | 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] | 6659 | 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] | 6660 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6661 | } |
| 6662 | 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] | 6663 | 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] | 6664 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 6665 | if (arr) { |
| 6666 | if (size) *size = arr->size; |
| 6667 | return (google_protobuf_MethodDescriptorProto**)_upb_array_ptr(arr); |
| 6668 | } else { |
| 6669 | if (size) *size = 0; |
| 6670 | return NULL; |
| 6671 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6672 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 6673 | 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] | 6674 | 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] | 6675 | return (google_protobuf_MethodDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6676 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6677 | 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] | 6678 | 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] | 6679 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 6680 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 6681 | return NULL; |
| 6682 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6683 | 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] | 6684 | if (!arr || !sub) return NULL; |
| 6685 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6686 | return sub; |
| 6687 | } |
| 6688 | 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] | 6689 | 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] | 6690 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6691 | } |
| 6692 | 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] | 6693 | struct google_protobuf_ServiceOptions* sub = (struct google_protobuf_ServiceOptions*)google_protobuf_ServiceDescriptorProto_options(msg); |
| 6694 | if (sub == NULL) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6695 | 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] | 6696 | if (sub) google_protobuf_ServiceDescriptorProto_set_options(msg, sub); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6697 | } |
| 6698 | return sub; |
| 6699 | } |
| 6700 | |
| 6701 | /* google.protobuf.MethodDescriptorProto */ |
| 6702 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6703 | UPB_INLINE google_protobuf_MethodDescriptorProto* google_protobuf_MethodDescriptorProto_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6704 | 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] | 6705 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6706 | UPB_INLINE google_protobuf_MethodDescriptorProto* google_protobuf_MethodDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 6707 | google_protobuf_MethodDescriptorProto* ret = google_protobuf_MethodDescriptorProto_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 6708 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6709 | 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] | 6710 | return NULL; |
| 6711 | } |
| 6712 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6713 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6714 | UPB_INLINE google_protobuf_MethodDescriptorProto* google_protobuf_MethodDescriptorProto_parse_ex(const char* buf, size_t size, |
| 6715 | const upb_ExtensionRegistry* extreg, |
| 6716 | int options, upb_Arena* arena) { |
| 6717 | google_protobuf_MethodDescriptorProto* ret = google_protobuf_MethodDescriptorProto_new(arena); |
| 6718 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6719 | 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] | 6720 | kUpb_DecodeStatus_Ok) { |
| 6721 | return NULL; |
| 6722 | } |
| 6723 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6724 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6725 | 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] | 6726 | char* ptr; |
| 6727 | (void)upb_Encode(msg, &google_protobuf_MethodDescriptorProto_msg_init, 0, arena, &ptr, len); |
| 6728 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6729 | } |
| 6730 | UPB_INLINE char* google_protobuf_MethodDescriptorProto_serialize_ex(const google_protobuf_MethodDescriptorProto* msg, int options, |
| 6731 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6732 | char* ptr; |
| 6733 | (void)upb_Encode(msg, &google_protobuf_MethodDescriptorProto_msg_init, options, arena, &ptr, len); |
| 6734 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6735 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6736 | UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_name(google_protobuf_MethodDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6737 | 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] | 6738 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6739 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6740 | 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] | 6741 | upb_StringView default_val = upb_StringView_FromString(""); |
| 6742 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6743 | 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] | 6744 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6745 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6746 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6747 | 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] | 6748 | 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] | 6749 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6750 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6751 | 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] | 6752 | 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] | 6753 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6754 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6755 | 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] | 6756 | upb_StringView default_val = upb_StringView_FromString(""); |
| 6757 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6758 | 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] | 6759 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6760 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6761 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6762 | 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] | 6763 | 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] | 6764 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6765 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6766 | 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] | 6767 | 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] | 6768 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6769 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6770 | 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] | 6771 | upb_StringView default_val = upb_StringView_FromString(""); |
| 6772 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6773 | 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] | 6774 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6775 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6776 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6777 | 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] | 6778 | 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] | 6779 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6780 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6781 | UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_options(google_protobuf_MethodDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6782 | 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] | 6783 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6784 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6785 | 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] | 6786 | const google_protobuf_MethodOptions* default_val = NULL; |
| 6787 | const google_protobuf_MethodOptions* ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6788 | 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] | 6789 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6790 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6791 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6792 | 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] | 6793 | 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] | 6794 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6795 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6796 | 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] | 6797 | 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] | 6798 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6799 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6800 | 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] | 6801 | bool default_val = false; |
| 6802 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6803 | 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] | 6804 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6805 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6806 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6807 | 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] | 6808 | 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] | 6809 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6810 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6811 | 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] | 6812 | 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] | 6813 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6814 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6815 | 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] | 6816 | bool default_val = false; |
| 6817 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6818 | 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] | 6819 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6820 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6821 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6822 | 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] | 6823 | 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] | 6824 | return _upb_Message_HasNonExtensionField(msg, &field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6825 | } |
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 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] | 6828 | 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] | 6829 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6830 | } |
| 6831 | 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] | 6832 | 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] | 6833 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6834 | } |
| 6835 | 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] | 6836 | 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] | 6837 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6838 | } |
| 6839 | 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] | 6840 | 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] | 6841 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6842 | } |
| 6843 | 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] | 6844 | struct google_protobuf_MethodOptions* sub = (struct google_protobuf_MethodOptions*)google_protobuf_MethodDescriptorProto_options(msg); |
| 6845 | if (sub == NULL) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6846 | 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] | 6847 | if (sub) google_protobuf_MethodDescriptorProto_set_options(msg, sub); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6848 | } |
| 6849 | return sub; |
| 6850 | } |
| 6851 | 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] | 6852 | 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] | 6853 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6854 | } |
| 6855 | 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] | 6856 | 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] | 6857 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6858 | } |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6859 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6860 | /* google.protobuf.FileOptions */ |
| 6861 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6862 | UPB_INLINE google_protobuf_FileOptions* google_protobuf_FileOptions_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6863 | 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] | 6864 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6865 | UPB_INLINE google_protobuf_FileOptions* google_protobuf_FileOptions_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 6866 | google_protobuf_FileOptions* ret = google_protobuf_FileOptions_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 6867 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6868 | 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] | 6869 | return NULL; |
| 6870 | } |
| 6871 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6872 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6873 | UPB_INLINE google_protobuf_FileOptions* google_protobuf_FileOptions_parse_ex(const char* buf, size_t size, |
| 6874 | const upb_ExtensionRegistry* extreg, |
| 6875 | int options, upb_Arena* arena) { |
| 6876 | google_protobuf_FileOptions* ret = google_protobuf_FileOptions_new(arena); |
| 6877 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6878 | 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] | 6879 | kUpb_DecodeStatus_Ok) { |
| 6880 | return NULL; |
| 6881 | } |
| 6882 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6883 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6884 | 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] | 6885 | char* ptr; |
| 6886 | (void)upb_Encode(msg, &google_protobuf_FileOptions_msg_init, 0, arena, &ptr, len); |
| 6887 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6888 | } |
| 6889 | UPB_INLINE char* google_protobuf_FileOptions_serialize_ex(const google_protobuf_FileOptions* msg, int options, |
| 6890 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6891 | char* ptr; |
| 6892 | (void)upb_Encode(msg, &google_protobuf_FileOptions_msg_init, options, arena, &ptr, len); |
| 6893 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6894 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6895 | 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] | 6896 | 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] | 6897 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6898 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6899 | 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] | 6900 | upb_StringView default_val = upb_StringView_FromString(""); |
| 6901 | upb_StringView ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 6902 | 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] | 6903 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6904 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6905 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6906 | 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] | 6907 | 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] | 6908 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6909 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6910 | 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] | 6911 | 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] | 6912 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6913 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6914 | 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] | 6915 | upb_StringView default_val = upb_StringView_FromString(""); |
| 6916 | upb_StringView ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 6917 | 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] | 6918 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6919 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6920 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6921 | 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] | 6922 | 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] | 6923 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6924 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6925 | 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] | 6926 | 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] | 6927 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6928 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6929 | 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] | 6930 | int32_t default_val = 1; |
| 6931 | int32_t ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 6932 | 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] | 6933 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6934 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6935 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6936 | 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] | 6937 | 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] | 6938 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6939 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6940 | 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] | 6941 | 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] | 6942 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6943 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6944 | 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] | 6945 | bool default_val = false; |
| 6946 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6947 | 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] | 6948 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6949 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6950 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6951 | 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] | 6952 | 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] | 6953 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6954 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6955 | 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] | 6956 | 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] | 6957 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6958 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6959 | 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] | 6960 | upb_StringView default_val = upb_StringView_FromString(""); |
| 6961 | upb_StringView ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 6962 | 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] | 6963 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6964 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6965 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6966 | 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] | 6967 | 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] | 6968 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6969 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6970 | 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] | 6971 | 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] | 6972 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6973 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6974 | 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] | 6975 | bool default_val = false; |
| 6976 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6977 | 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] | 6978 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6979 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6980 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6981 | 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] | 6982 | 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] | 6983 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6984 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6985 | 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] | 6986 | 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] | 6987 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6988 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6989 | 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] | 6990 | bool default_val = false; |
| 6991 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6992 | 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] | 6993 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6994 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6995 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6996 | 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] | 6997 | 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] | 6998 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6999 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7000 | 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] | 7001 | 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] | 7002 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7003 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7004 | 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] | 7005 | bool default_val = false; |
| 7006 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7007 | 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] | 7008 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7009 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7010 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7011 | 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] | 7012 | 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] | 7013 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7014 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7015 | 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] | 7016 | 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] | 7017 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7018 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7019 | 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] | 7020 | bool default_val = false; |
| 7021 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7022 | 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] | 7023 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7024 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7025 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7026 | 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] | 7027 | 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] | 7028 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7029 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7030 | UPB_INLINE void google_protobuf_FileOptions_clear_deprecated(google_protobuf_FileOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7031 | 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] | 7032 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7033 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7034 | UPB_INLINE bool google_protobuf_FileOptions_deprecated(const google_protobuf_FileOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7035 | bool default_val = false; |
| 7036 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7037 | 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] | 7038 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7039 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7040 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7041 | 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] | 7042 | 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] | 7043 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7044 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7045 | 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] | 7046 | 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] | 7047 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7048 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7049 | 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] | 7050 | bool default_val = false; |
| 7051 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7052 | 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] | 7053 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7054 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7055 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7056 | 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] | 7057 | 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] | 7058 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7059 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7060 | 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] | 7061 | 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] | 7062 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7063 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7064 | 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] | 7065 | bool default_val = true; |
| 7066 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7067 | 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] | 7068 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7069 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7070 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7071 | 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] | 7072 | 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] | 7073 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7074 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7075 | 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] | 7076 | 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] | 7077 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7078 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7079 | 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] | 7080 | upb_StringView default_val = upb_StringView_FromString(""); |
| 7081 | upb_StringView ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7082 | 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] | 7083 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7084 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7085 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7086 | 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] | 7087 | 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] | 7088 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7089 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7090 | 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] | 7091 | 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] | 7092 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7093 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7094 | 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] | 7095 | upb_StringView default_val = upb_StringView_FromString(""); |
| 7096 | upb_StringView ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7097 | 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] | 7098 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7099 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7100 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7101 | 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] | 7102 | 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] | 7103 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7104 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7105 | 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] | 7106 | 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] | 7107 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7108 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7109 | 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] | 7110 | upb_StringView default_val = upb_StringView_FromString(""); |
| 7111 | upb_StringView ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7112 | 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] | 7113 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7114 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7115 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7116 | 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] | 7117 | 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] | 7118 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7119 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7120 | 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] | 7121 | 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] | 7122 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7123 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7124 | 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] | 7125 | upb_StringView default_val = upb_StringView_FromString(""); |
| 7126 | upb_StringView ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7127 | 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] | 7128 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7129 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7130 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7131 | 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] | 7132 | 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] | 7133 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7134 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7135 | 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] | 7136 | 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] | 7137 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7138 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7139 | 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] | 7140 | upb_StringView default_val = upb_StringView_FromString(""); |
| 7141 | upb_StringView ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7142 | 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] | 7143 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7144 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7145 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7146 | 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] | 7147 | 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] | 7148 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7149 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7150 | 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] | 7151 | 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] | 7152 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7153 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7154 | 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] | 7155 | bool default_val = false; |
| 7156 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7157 | 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] | 7158 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7159 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7160 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7161 | 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] | 7162 | 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] | 7163 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7164 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7165 | 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] | 7166 | 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] | 7167 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7168 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7169 | 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] | 7170 | upb_StringView default_val = upb_StringView_FromString(""); |
| 7171 | upb_StringView ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7172 | 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] | 7173 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7174 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7175 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7176 | 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] | 7177 | 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] | 7178 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7179 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7180 | 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] | 7181 | 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] | 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_FileOptions_ruby_package(const google_protobuf_FileOptions* 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; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7187 | 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] | 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_FileOptions_has_ruby_package(const google_protobuf_FileOptions* msg) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7192 | 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)}; |
| 7193 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 7194 | } |
| 7195 | UPB_INLINE void google_protobuf_FileOptions_clear_features(google_protobuf_FileOptions* msg) { |
| 7196 | 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)}; |
| 7197 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 7198 | } |
| 7199 | UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_FileOptions_features(const google_protobuf_FileOptions* msg) { |
| 7200 | const google_protobuf_FeatureSet* default_val = NULL; |
| 7201 | const google_protobuf_FeatureSet* ret; |
| 7202 | 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)}; |
| 7203 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 7204 | return ret; |
| 7205 | } |
| 7206 | UPB_INLINE bool google_protobuf_FileOptions_has_features(const google_protobuf_FileOptions* msg) { |
| 7207 | 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] | 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_FileOptions_clear_uninterpreted_option(google_protobuf_FileOptions* msg) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7211 | 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] | 7212 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7213 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 7214 | 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] | 7215 | 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] | 7216 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 7217 | if (arr) { |
| 7218 | if (size) *size = arr->size; |
| 7219 | return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr); |
| 7220 | } else { |
| 7221 | if (size) *size = 0; |
| 7222 | return NULL; |
| 7223 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7224 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 7225 | 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] | 7226 | 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] | 7227 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 7228 | if (size) { |
| 7229 | *size = arr ? arr->size : 0; |
| 7230 | } |
| 7231 | return arr; |
| 7232 | } |
| 7233 | 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] | 7234 | 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] | 7235 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 7236 | (upb_Message*)msg, &field, arena); |
| 7237 | if (size) { |
| 7238 | *size = arr ? arr->size : 0; |
| 7239 | } |
| 7240 | return arr; |
| 7241 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7242 | UPB_INLINE bool google_protobuf_FileOptions_has_uninterpreted_option(const google_protobuf_FileOptions* msg) { |
| 7243 | size_t size; |
| 7244 | google_protobuf_FileOptions_uninterpreted_option(msg, &size); |
| 7245 | return size != 0; |
| 7246 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7247 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7248 | 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] | 7249 | 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] | 7250 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7251 | } |
| 7252 | 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] | 7253 | 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] | 7254 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7255 | } |
| 7256 | 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] | 7257 | 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] | 7258 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7259 | } |
| 7260 | 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] | 7261 | 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] | 7262 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7263 | } |
| 7264 | 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] | 7265 | 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] | 7266 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7267 | } |
| 7268 | 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] | 7269 | 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] | 7270 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7271 | } |
| 7272 | 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] | 7273 | 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] | 7274 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7275 | } |
| 7276 | 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] | 7277 | 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] | 7278 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7279 | } |
| 7280 | 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] | 7281 | 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] | 7282 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7283 | } |
| 7284 | 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] | 7285 | 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] | 7286 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7287 | } |
| 7288 | 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] | 7289 | 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] | 7290 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7291 | } |
| 7292 | 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] | 7293 | 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] | 7294 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7295 | } |
| 7296 | 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] | 7297 | 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] | 7298 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7299 | } |
| 7300 | 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] | 7301 | 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] | 7302 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7303 | } |
| 7304 | 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] | 7305 | 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] | 7306 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7307 | } |
| 7308 | 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] | 7309 | 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] | 7310 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7311 | } |
| 7312 | 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] | 7313 | 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] | 7314 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7315 | } |
| 7316 | 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] | 7317 | 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] | 7318 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7319 | } |
| 7320 | 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] | 7321 | 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] | 7322 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7323 | } |
| 7324 | 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] | 7325 | 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] | 7326 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7327 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7328 | UPB_INLINE void google_protobuf_FileOptions_set_features(google_protobuf_FileOptions *msg, google_protobuf_FeatureSet* value) { |
| 7329 | 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)}; |
| 7330 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 7331 | } |
| 7332 | UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_FileOptions_mutable_features(google_protobuf_FileOptions* msg, upb_Arena* arena) { |
| 7333 | struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_FileOptions_features(msg); |
| 7334 | if (sub == NULL) { |
| 7335 | sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google_protobuf_FeatureSet_msg_init, arena); |
| 7336 | if (sub) google_protobuf_FileOptions_set_features(msg, sub); |
| 7337 | } |
| 7338 | return sub; |
| 7339 | } |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7340 | 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] | 7341 | 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] | 7342 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 7343 | if (arr) { |
| 7344 | if (size) *size = arr->size; |
| 7345 | return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr); |
| 7346 | } else { |
| 7347 | if (size) *size = 0; |
| 7348 | return NULL; |
| 7349 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7350 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 7351 | 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] | 7352 | 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] | 7353 | return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7354 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7355 | 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] | 7356 | 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] | 7357 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 7358 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 7359 | return NULL; |
| 7360 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7361 | 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] | 7362 | if (!arr || !sub) return NULL; |
| 7363 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7364 | return sub; |
| 7365 | } |
| 7366 | |
| 7367 | /* google.protobuf.MessageOptions */ |
| 7368 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7369 | UPB_INLINE google_protobuf_MessageOptions* google_protobuf_MessageOptions_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7370 | 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] | 7371 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7372 | UPB_INLINE google_protobuf_MessageOptions* google_protobuf_MessageOptions_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 7373 | google_protobuf_MessageOptions* ret = google_protobuf_MessageOptions_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 7374 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7375 | 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] | 7376 | return NULL; |
| 7377 | } |
| 7378 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7379 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7380 | UPB_INLINE google_protobuf_MessageOptions* google_protobuf_MessageOptions_parse_ex(const char* buf, size_t size, |
| 7381 | const upb_ExtensionRegistry* extreg, |
| 7382 | int options, upb_Arena* arena) { |
| 7383 | google_protobuf_MessageOptions* ret = google_protobuf_MessageOptions_new(arena); |
| 7384 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7385 | 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] | 7386 | kUpb_DecodeStatus_Ok) { |
| 7387 | return NULL; |
| 7388 | } |
| 7389 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7390 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7391 | 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] | 7392 | char* ptr; |
| 7393 | (void)upb_Encode(msg, &google_protobuf_MessageOptions_msg_init, 0, arena, &ptr, len); |
| 7394 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7395 | } |
| 7396 | UPB_INLINE char* google_protobuf_MessageOptions_serialize_ex(const google_protobuf_MessageOptions* msg, int options, |
| 7397 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7398 | char* ptr; |
| 7399 | (void)upb_Encode(msg, &google_protobuf_MessageOptions_msg_init, options, arena, &ptr, len); |
| 7400 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7401 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7402 | 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] | 7403 | 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] | 7404 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7405 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7406 | 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] | 7407 | bool default_val = false; |
| 7408 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7409 | 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] | 7410 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7411 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7412 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7413 | 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] | 7414 | 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] | 7415 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7416 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7417 | 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] | 7418 | 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] | 7419 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7420 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7421 | 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] | 7422 | bool default_val = false; |
| 7423 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7424 | 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] | 7425 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7426 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7427 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7428 | 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] | 7429 | 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] | 7430 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7431 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7432 | UPB_INLINE void google_protobuf_MessageOptions_clear_deprecated(google_protobuf_MessageOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7433 | 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] | 7434 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7435 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7436 | UPB_INLINE bool google_protobuf_MessageOptions_deprecated(const google_protobuf_MessageOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7437 | bool default_val = false; |
| 7438 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7439 | 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] | 7440 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7441 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7442 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7443 | 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] | 7444 | 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] | 7445 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7446 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7447 | 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] | 7448 | 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] | 7449 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7450 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7451 | 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] | 7452 | bool default_val = false; |
| 7453 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7454 | 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] | 7455 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7456 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7457 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7458 | 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] | 7459 | 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] | 7460 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7461 | } |
Mike Kruskal | 6b87d6f | 2022-12-14 10:36:53 -0800 | [diff] [blame] | 7462 | 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] | 7463 | 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] | 7464 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 7465 | } |
| 7466 | UPB_INLINE bool google_protobuf_MessageOptions_deprecated_legacy_json_field_conflicts(const google_protobuf_MessageOptions* msg) { |
| 7467 | bool default_val = false; |
| 7468 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7469 | 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] | 7470 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 7471 | return ret; |
| 7472 | } |
| 7473 | 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] | 7474 | 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] | 7475 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 7476 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7477 | UPB_INLINE void google_protobuf_MessageOptions_clear_features(google_protobuf_MessageOptions* msg) { |
| 7478 | 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)}; |
| 7479 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 7480 | } |
| 7481 | UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_MessageOptions_features(const google_protobuf_MessageOptions* msg) { |
| 7482 | const google_protobuf_FeatureSet* default_val = NULL; |
| 7483 | const google_protobuf_FeatureSet* ret; |
| 7484 | 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)}; |
| 7485 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 7486 | return ret; |
| 7487 | } |
| 7488 | UPB_INLINE bool google_protobuf_MessageOptions_has_features(const google_protobuf_MessageOptions* msg) { |
| 7489 | 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)}; |
| 7490 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 7491 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7492 | 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] | 7493 | 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] | 7494 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7495 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 7496 | 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] | 7497 | 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] | 7498 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 7499 | if (arr) { |
| 7500 | if (size) *size = arr->size; |
| 7501 | return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr); |
| 7502 | } else { |
| 7503 | if (size) *size = 0; |
| 7504 | return NULL; |
| 7505 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7506 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 7507 | 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] | 7508 | 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] | 7509 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 7510 | if (size) { |
| 7511 | *size = arr ? arr->size : 0; |
| 7512 | } |
| 7513 | return arr; |
| 7514 | } |
| 7515 | 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] | 7516 | 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] | 7517 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 7518 | (upb_Message*)msg, &field, arena); |
| 7519 | if (size) { |
| 7520 | *size = arr ? arr->size : 0; |
| 7521 | } |
| 7522 | return arr; |
| 7523 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7524 | UPB_INLINE bool google_protobuf_MessageOptions_has_uninterpreted_option(const google_protobuf_MessageOptions* msg) { |
| 7525 | size_t size; |
| 7526 | google_protobuf_MessageOptions_uninterpreted_option(msg, &size); |
| 7527 | return size != 0; |
| 7528 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7529 | |
| 7530 | 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] | 7531 | 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] | 7532 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7533 | } |
| 7534 | 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] | 7535 | 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] | 7536 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7537 | } |
| 7538 | 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] | 7539 | 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] | 7540 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7541 | } |
| 7542 | 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] | 7543 | 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] | 7544 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7545 | } |
| 7546 | 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] | 7547 | 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] | 7548 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7549 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7550 | UPB_INLINE void google_protobuf_MessageOptions_set_features(google_protobuf_MessageOptions *msg, google_protobuf_FeatureSet* value) { |
| 7551 | 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)}; |
| 7552 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 7553 | } |
| 7554 | UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_MessageOptions_mutable_features(google_protobuf_MessageOptions* msg, upb_Arena* arena) { |
| 7555 | struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_MessageOptions_features(msg); |
| 7556 | if (sub == NULL) { |
| 7557 | sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google_protobuf_FeatureSet_msg_init, arena); |
| 7558 | if (sub) google_protobuf_MessageOptions_set_features(msg, sub); |
| 7559 | } |
| 7560 | return sub; |
| 7561 | } |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7562 | 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] | 7563 | 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] | 7564 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 7565 | if (arr) { |
| 7566 | if (size) *size = arr->size; |
| 7567 | return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr); |
| 7568 | } else { |
| 7569 | if (size) *size = 0; |
| 7570 | return NULL; |
| 7571 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7572 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 7573 | 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] | 7574 | 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] | 7575 | return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7576 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7577 | 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] | 7578 | 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] | 7579 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 7580 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 7581 | return NULL; |
| 7582 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7583 | 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] | 7584 | if (!arr || !sub) return NULL; |
| 7585 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7586 | return sub; |
| 7587 | } |
| 7588 | |
| 7589 | /* google.protobuf.FieldOptions */ |
| 7590 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7591 | UPB_INLINE google_protobuf_FieldOptions* google_protobuf_FieldOptions_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7592 | 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] | 7593 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7594 | UPB_INLINE google_protobuf_FieldOptions* google_protobuf_FieldOptions_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 7595 | google_protobuf_FieldOptions* ret = google_protobuf_FieldOptions_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 7596 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7597 | 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] | 7598 | return NULL; |
| 7599 | } |
| 7600 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7601 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7602 | UPB_INLINE google_protobuf_FieldOptions* google_protobuf_FieldOptions_parse_ex(const char* buf, size_t size, |
| 7603 | const upb_ExtensionRegistry* extreg, |
| 7604 | int options, upb_Arena* arena) { |
| 7605 | google_protobuf_FieldOptions* ret = google_protobuf_FieldOptions_new(arena); |
| 7606 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7607 | 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] | 7608 | kUpb_DecodeStatus_Ok) { |
| 7609 | return NULL; |
| 7610 | } |
| 7611 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7612 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7613 | 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] | 7614 | char* ptr; |
| 7615 | (void)upb_Encode(msg, &google_protobuf_FieldOptions_msg_init, 0, arena, &ptr, len); |
| 7616 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7617 | } |
| 7618 | UPB_INLINE char* google_protobuf_FieldOptions_serialize_ex(const google_protobuf_FieldOptions* msg, int options, |
| 7619 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7620 | char* ptr; |
| 7621 | (void)upb_Encode(msg, &google_protobuf_FieldOptions_msg_init, options, arena, &ptr, len); |
| 7622 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7623 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7624 | UPB_INLINE void google_protobuf_FieldOptions_clear_ctype(google_protobuf_FieldOptions* msg) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7625 | 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] | 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 int32_t google_protobuf_FieldOptions_ctype(const google_protobuf_FieldOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7629 | int32_t default_val = 0; |
| 7630 | int32_t ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7631 | 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] | 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_FieldOptions_has_ctype(const google_protobuf_FieldOptions* msg) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7636 | 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] | 7637 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7638 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7639 | UPB_INLINE void google_protobuf_FieldOptions_clear_packed(google_protobuf_FieldOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7640 | 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] | 7641 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7642 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7643 | UPB_INLINE bool google_protobuf_FieldOptions_packed(const google_protobuf_FieldOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7644 | bool default_val = false; |
| 7645 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7646 | 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] | 7647 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7648 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7649 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7650 | 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] | 7651 | 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] | 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_FieldOptions_clear_deprecated(google_protobuf_FieldOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7655 | 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] | 7656 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7657 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7658 | UPB_INLINE bool google_protobuf_FieldOptions_deprecated(const google_protobuf_FieldOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7659 | bool default_val = false; |
| 7660 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7661 | 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] | 7662 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7663 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7664 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7665 | 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] | 7666 | 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] | 7667 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7668 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7669 | UPB_INLINE void google_protobuf_FieldOptions_clear_lazy(google_protobuf_FieldOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7670 | 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] | 7671 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7672 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7673 | UPB_INLINE bool google_protobuf_FieldOptions_lazy(const google_protobuf_FieldOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7674 | bool default_val = false; |
| 7675 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7676 | 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] | 7677 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7678 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7679 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7680 | 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] | 7681 | 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] | 7682 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7683 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7684 | UPB_INLINE void google_protobuf_FieldOptions_clear_jstype(google_protobuf_FieldOptions* msg) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7685 | 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] | 7686 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7687 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7688 | 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] | 7689 | int32_t default_val = 0; |
| 7690 | int32_t ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7691 | 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] | 7692 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7693 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7694 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7695 | 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] | 7696 | 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] | 7697 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7698 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7699 | UPB_INLINE void google_protobuf_FieldOptions_clear_weak(google_protobuf_FieldOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7700 | 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] | 7701 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7702 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7703 | UPB_INLINE bool google_protobuf_FieldOptions_weak(const google_protobuf_FieldOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7704 | bool default_val = false; |
| 7705 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7706 | 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] | 7707 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7708 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7709 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7710 | 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] | 7711 | 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] | 7712 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7713 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7714 | 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] | 7715 | 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] | 7716 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7717 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7718 | 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] | 7719 | bool default_val = false; |
| 7720 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7721 | 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] | 7722 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7723 | return ret; |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7724 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7725 | 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] | 7726 | 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] | 7727 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7728 | } |
Protobuf Team Bot | 9238c48 | 2022-12-16 20:01:55 -0800 | [diff] [blame] | 7729 | 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] | 7730 | 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] | 7731 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 7732 | } |
| 7733 | UPB_INLINE bool google_protobuf_FieldOptions_debug_redact(const google_protobuf_FieldOptions* msg) { |
| 7734 | bool default_val = false; |
| 7735 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7736 | 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] | 7737 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 7738 | return ret; |
| 7739 | } |
| 7740 | 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] | 7741 | 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] | 7742 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 7743 | } |
Adam Cozzette | 5a56837 | 2023-01-24 20:35:59 -0800 | [diff] [blame] | 7744 | UPB_INLINE void google_protobuf_FieldOptions_clear_retention(google_protobuf_FieldOptions* msg) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7745 | 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] | 7746 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 7747 | } |
| 7748 | UPB_INLINE int32_t google_protobuf_FieldOptions_retention(const google_protobuf_FieldOptions* msg) { |
| 7749 | int32_t default_val = 0; |
| 7750 | int32_t ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7751 | 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] | 7752 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 7753 | return ret; |
| 7754 | } |
| 7755 | 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] | 7756 | 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] | 7757 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 7758 | } |
Mike Kruskal | 0c12139 | 2023-03-18 00:05:41 -0700 | [diff] [blame] | 7759 | UPB_INLINE void google_protobuf_FieldOptions_clear_targets(google_protobuf_FieldOptions* msg) { |
Sandy Zhang | 96c601d | 2023-07-05 12:39:20 -0700 | [diff] [blame] | 7760 | 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] | 7761 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 7762 | } |
Mike Kruskal | 0c12139 | 2023-03-18 00:05:41 -0700 | [diff] [blame] | 7763 | 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] | 7764 | 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] | 7765 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 7766 | if (arr) { |
| 7767 | if (size) *size = arr->size; |
| 7768 | return (int32_t const*)_upb_array_constptr(arr); |
| 7769 | } else { |
| 7770 | if (size) *size = 0; |
| 7771 | return NULL; |
| 7772 | } |
Adam Cozzette | 5a56837 | 2023-01-24 20:35:59 -0800 | [diff] [blame] | 7773 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 7774 | 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] | 7775 | 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] | 7776 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 7777 | if (size) { |
| 7778 | *size = arr ? arr->size : 0; |
| 7779 | } |
| 7780 | return arr; |
| 7781 | } |
| 7782 | 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] | 7783 | 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] | 7784 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 7785 | (upb_Message*)msg, &field, arena); |
| 7786 | if (size) { |
| 7787 | *size = arr ? arr->size : 0; |
| 7788 | } |
| 7789 | return arr; |
| 7790 | } |
Mike Kruskal | 0c12139 | 2023-03-18 00:05:41 -0700 | [diff] [blame] | 7791 | UPB_INLINE bool google_protobuf_FieldOptions_has_targets(const google_protobuf_FieldOptions* msg) { |
| 7792 | size_t size; |
| 7793 | google_protobuf_FieldOptions_targets(msg, &size); |
| 7794 | return size != 0; |
Adam Cozzette | 5a56837 | 2023-01-24 20:35:59 -0800 | [diff] [blame] | 7795 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7796 | 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] | 7797 | 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] | 7798 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 7799 | } |
| 7800 | 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] | 7801 | 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] | 7802 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 7803 | if (arr) { |
| 7804 | if (size) *size = arr->size; |
| 7805 | return (const google_protobuf_FieldOptions_EditionDefault* const*)_upb_array_constptr(arr); |
| 7806 | } else { |
| 7807 | if (size) *size = 0; |
| 7808 | return NULL; |
| 7809 | } |
| 7810 | } |
| 7811 | 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] | 7812 | 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] | 7813 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 7814 | if (size) { |
| 7815 | *size = arr ? arr->size : 0; |
| 7816 | } |
| 7817 | return arr; |
| 7818 | } |
| 7819 | 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] | 7820 | 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] | 7821 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 7822 | (upb_Message*)msg, &field, arena); |
| 7823 | if (size) { |
| 7824 | *size = arr ? arr->size : 0; |
| 7825 | } |
| 7826 | return arr; |
| 7827 | } |
| 7828 | UPB_INLINE bool google_protobuf_FieldOptions_has_edition_defaults(const google_protobuf_FieldOptions* msg) { |
| 7829 | size_t size; |
| 7830 | google_protobuf_FieldOptions_edition_defaults(msg, &size); |
| 7831 | return size != 0; |
| 7832 | } |
| 7833 | UPB_INLINE void google_protobuf_FieldOptions_clear_features(google_protobuf_FieldOptions* msg) { |
Sandy Zhang | 96c601d | 2023-07-05 12:39:20 -0700 | [diff] [blame] | 7834 | 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] | 7835 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 7836 | } |
| 7837 | UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_FieldOptions_features(const google_protobuf_FieldOptions* msg) { |
| 7838 | const google_protobuf_FeatureSet* default_val = NULL; |
| 7839 | const google_protobuf_FeatureSet* ret; |
Sandy Zhang | 96c601d | 2023-07-05 12:39:20 -0700 | [diff] [blame] | 7840 | 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] | 7841 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 7842 | return ret; |
| 7843 | } |
| 7844 | 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] | 7845 | 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] | 7846 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 7847 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7848 | 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] | 7849 | 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] | 7850 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7851 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 7852 | 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] | 7853 | 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] | 7854 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 7855 | if (arr) { |
| 7856 | if (size) *size = arr->size; |
| 7857 | return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr); |
| 7858 | } else { |
| 7859 | if (size) *size = 0; |
| 7860 | return NULL; |
| 7861 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7862 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 7863 | 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] | 7864 | 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] | 7865 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 7866 | if (size) { |
| 7867 | *size = arr ? arr->size : 0; |
| 7868 | } |
| 7869 | return arr; |
| 7870 | } |
| 7871 | 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] | 7872 | 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] | 7873 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 7874 | (upb_Message*)msg, &field, arena); |
| 7875 | if (size) { |
| 7876 | *size = arr ? arr->size : 0; |
| 7877 | } |
| 7878 | return arr; |
| 7879 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7880 | UPB_INLINE bool google_protobuf_FieldOptions_has_uninterpreted_option(const google_protobuf_FieldOptions* msg) { |
| 7881 | size_t size; |
| 7882 | google_protobuf_FieldOptions_uninterpreted_option(msg, &size); |
| 7883 | return size != 0; |
| 7884 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7885 | |
| 7886 | 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] | 7887 | 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] | 7888 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7889 | } |
| 7890 | 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] | 7891 | 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] | 7892 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7893 | } |
| 7894 | 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] | 7895 | 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] | 7896 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7897 | } |
| 7898 | 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] | 7899 | 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] | 7900 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7901 | } |
| 7902 | 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] | 7903 | 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] | 7904 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7905 | } |
| 7906 | 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] | 7907 | 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] | 7908 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7909 | } |
| 7910 | 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] | 7911 | 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] | 7912 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7913 | } |
| 7914 | 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] | 7915 | 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] | 7916 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7917 | } |
Adam Cozzette | 5a56837 | 2023-01-24 20:35:59 -0800 | [diff] [blame] | 7918 | 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] | 7919 | 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] | 7920 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 7921 | } |
Mike Kruskal | 0c12139 | 2023-03-18 00:05:41 -0700 | [diff] [blame] | 7922 | 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] | 7923 | 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] | 7924 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 7925 | if (arr) { |
| 7926 | if (size) *size = arr->size; |
| 7927 | return (int32_t*)_upb_array_ptr(arr); |
| 7928 | } else { |
| 7929 | if (size) *size = 0; |
| 7930 | return NULL; |
| 7931 | } |
| 7932 | } |
| 7933 | 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] | 7934 | 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] | 7935 | return (int32_t*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Mike Kruskal | 0c12139 | 2023-03-18 00:05:41 -0700 | [diff] [blame] | 7936 | } |
| 7937 | 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] | 7938 | 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] | 7939 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 7940 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 7941 | return false; |
| 7942 | } |
| 7943 | _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val)); |
| 7944 | return true; |
Adam Cozzette | 5a56837 | 2023-01-24 20:35:59 -0800 | [diff] [blame] | 7945 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7946 | 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] | 7947 | 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] | 7948 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 7949 | if (arr) { |
| 7950 | if (size) *size = arr->size; |
| 7951 | return (google_protobuf_FieldOptions_EditionDefault**)_upb_array_ptr(arr); |
| 7952 | } else { |
| 7953 | if (size) *size = 0; |
| 7954 | return NULL; |
| 7955 | } |
| 7956 | } |
| 7957 | 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] | 7958 | 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] | 7959 | return (google_protobuf_FieldOptions_EditionDefault**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
| 7960 | } |
| 7961 | 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] | 7962 | 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] | 7963 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 7964 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 7965 | return NULL; |
| 7966 | } |
| 7967 | struct google_protobuf_FieldOptions_EditionDefault* sub = (struct google_protobuf_FieldOptions_EditionDefault*)_upb_Message_New(&google_protobuf_FieldOptions_EditionDefault_msg_init, arena); |
| 7968 | if (!arr || !sub) return NULL; |
| 7969 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
| 7970 | return sub; |
| 7971 | } |
| 7972 | 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] | 7973 | 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] | 7974 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 7975 | } |
| 7976 | UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_FieldOptions_mutable_features(google_protobuf_FieldOptions* msg, upb_Arena* arena) { |
| 7977 | struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_FieldOptions_features(msg); |
| 7978 | if (sub == NULL) { |
| 7979 | sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google_protobuf_FeatureSet_msg_init, arena); |
| 7980 | if (sub) google_protobuf_FieldOptions_set_features(msg, sub); |
| 7981 | } |
| 7982 | return sub; |
| 7983 | } |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7984 | 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] | 7985 | 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] | 7986 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 7987 | if (arr) { |
| 7988 | if (size) *size = arr->size; |
| 7989 | return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr); |
| 7990 | } else { |
| 7991 | if (size) *size = 0; |
| 7992 | return NULL; |
| 7993 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7994 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 7995 | 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] | 7996 | 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] | 7997 | return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7998 | } |
| 7999 | 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] | 8000 | 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] | 8001 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 8002 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 8003 | return NULL; |
| 8004 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8005 | 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] | 8006 | if (!arr || !sub) return NULL; |
| 8007 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8008 | return sub; |
| 8009 | } |
| 8010 | |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8011 | /* google.protobuf.FieldOptions.EditionDefault */ |
| 8012 | |
| 8013 | UPB_INLINE google_protobuf_FieldOptions_EditionDefault* google_protobuf_FieldOptions_EditionDefault_new(upb_Arena* arena) { |
| 8014 | return (google_protobuf_FieldOptions_EditionDefault*)_upb_Message_New(&google_protobuf_FieldOptions_EditionDefault_msg_init, arena); |
| 8015 | } |
| 8016 | UPB_INLINE google_protobuf_FieldOptions_EditionDefault* google_protobuf_FieldOptions_EditionDefault_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 8017 | google_protobuf_FieldOptions_EditionDefault* ret = google_protobuf_FieldOptions_EditionDefault_new(arena); |
| 8018 | if (!ret) return NULL; |
| 8019 | if (upb_Decode(buf, size, ret, &google_protobuf_FieldOptions_EditionDefault_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { |
| 8020 | return NULL; |
| 8021 | } |
| 8022 | return ret; |
| 8023 | } |
| 8024 | UPB_INLINE google_protobuf_FieldOptions_EditionDefault* google_protobuf_FieldOptions_EditionDefault_parse_ex(const char* buf, size_t size, |
| 8025 | const upb_ExtensionRegistry* extreg, |
| 8026 | int options, upb_Arena* arena) { |
| 8027 | google_protobuf_FieldOptions_EditionDefault* ret = google_protobuf_FieldOptions_EditionDefault_new(arena); |
| 8028 | if (!ret) return NULL; |
| 8029 | if (upb_Decode(buf, size, ret, &google_protobuf_FieldOptions_EditionDefault_msg_init, extreg, options, arena) != |
| 8030 | kUpb_DecodeStatus_Ok) { |
| 8031 | return NULL; |
| 8032 | } |
| 8033 | return ret; |
| 8034 | } |
| 8035 | UPB_INLINE char* google_protobuf_FieldOptions_EditionDefault_serialize(const google_protobuf_FieldOptions_EditionDefault* msg, upb_Arena* arena, size_t* len) { |
| 8036 | char* ptr; |
| 8037 | (void)upb_Encode(msg, &google_protobuf_FieldOptions_EditionDefault_msg_init, 0, arena, &ptr, len); |
| 8038 | return ptr; |
| 8039 | } |
| 8040 | UPB_INLINE char* google_protobuf_FieldOptions_EditionDefault_serialize_ex(const google_protobuf_FieldOptions_EditionDefault* msg, int options, |
| 8041 | upb_Arena* arena, size_t* len) { |
| 8042 | char* ptr; |
| 8043 | (void)upb_Encode(msg, &google_protobuf_FieldOptions_EditionDefault_msg_init, options, arena, &ptr, len); |
| 8044 | return ptr; |
| 8045 | } |
| 8046 | UPB_INLINE void google_protobuf_FieldOptions_EditionDefault_clear_edition(google_protobuf_FieldOptions_EditionDefault* msg) { |
Protobuf Team Bot | fa98bb3 | 2023-09-01 18:11:09 +0000 | [diff] [blame] | 8047 | const upb_MiniTableField field = {1, 8, 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8048 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 8049 | } |
| 8050 | UPB_INLINE upb_StringView google_protobuf_FieldOptions_EditionDefault_edition(const google_protobuf_FieldOptions_EditionDefault* msg) { |
| 8051 | upb_StringView default_val = upb_StringView_FromString(""); |
| 8052 | upb_StringView ret; |
Protobuf Team Bot | fa98bb3 | 2023-09-01 18:11:09 +0000 | [diff] [blame] | 8053 | const upb_MiniTableField field = {1, 8, 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8054 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 8055 | return ret; |
| 8056 | } |
| 8057 | UPB_INLINE bool google_protobuf_FieldOptions_EditionDefault_has_edition(const google_protobuf_FieldOptions_EditionDefault* msg) { |
Protobuf Team Bot | fa98bb3 | 2023-09-01 18:11:09 +0000 | [diff] [blame] | 8058 | const upb_MiniTableField field = {1, 8, 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8059 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 8060 | } |
| 8061 | UPB_INLINE void google_protobuf_FieldOptions_EditionDefault_clear_value(google_protobuf_FieldOptions_EditionDefault* msg) { |
Protobuf Team Bot | fa98bb3 | 2023-09-01 18:11:09 +0000 | [diff] [blame] | 8062 | const upb_MiniTableField field = {2, UPB_SIZE(16, 24), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8063 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 8064 | } |
| 8065 | UPB_INLINE upb_StringView google_protobuf_FieldOptions_EditionDefault_value(const google_protobuf_FieldOptions_EditionDefault* msg) { |
| 8066 | upb_StringView default_val = upb_StringView_FromString(""); |
| 8067 | upb_StringView ret; |
Protobuf Team Bot | fa98bb3 | 2023-09-01 18:11:09 +0000 | [diff] [blame] | 8068 | const upb_MiniTableField field = {2, UPB_SIZE(16, 24), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8069 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 8070 | return ret; |
| 8071 | } |
| 8072 | UPB_INLINE bool google_protobuf_FieldOptions_EditionDefault_has_value(const google_protobuf_FieldOptions_EditionDefault* msg) { |
Protobuf Team Bot | fa98bb3 | 2023-09-01 18:11:09 +0000 | [diff] [blame] | 8073 | const upb_MiniTableField field = {2, UPB_SIZE(16, 24), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
| 8074 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 8075 | } |
| 8076 | UPB_INLINE void google_protobuf_FieldOptions_EditionDefault_clear_edition_enum(google_protobuf_FieldOptions_EditionDefault* msg) { |
| 8077 | const upb_MiniTableField field = {3, 4, 3, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
| 8078 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 8079 | } |
| 8080 | UPB_INLINE int32_t google_protobuf_FieldOptions_EditionDefault_edition_enum(const google_protobuf_FieldOptions_EditionDefault* msg) { |
| 8081 | int32_t default_val = 0; |
| 8082 | int32_t ret; |
| 8083 | const upb_MiniTableField field = {3, 4, 3, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
| 8084 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 8085 | return ret; |
| 8086 | } |
| 8087 | UPB_INLINE bool google_protobuf_FieldOptions_EditionDefault_has_edition_enum(const google_protobuf_FieldOptions_EditionDefault* msg) { |
| 8088 | const upb_MiniTableField field = {3, 4, 3, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8089 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 8090 | } |
| 8091 | |
| 8092 | UPB_INLINE void google_protobuf_FieldOptions_EditionDefault_set_edition(google_protobuf_FieldOptions_EditionDefault *msg, upb_StringView value) { |
Protobuf Team Bot | fa98bb3 | 2023-09-01 18:11:09 +0000 | [diff] [blame] | 8093 | const upb_MiniTableField field = {1, 8, 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8094 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 8095 | } |
| 8096 | UPB_INLINE void google_protobuf_FieldOptions_EditionDefault_set_value(google_protobuf_FieldOptions_EditionDefault *msg, upb_StringView value) { |
Protobuf Team Bot | fa98bb3 | 2023-09-01 18:11:09 +0000 | [diff] [blame] | 8097 | const upb_MiniTableField field = {2, UPB_SIZE(16, 24), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
| 8098 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 8099 | } |
| 8100 | UPB_INLINE void google_protobuf_FieldOptions_EditionDefault_set_edition_enum(google_protobuf_FieldOptions_EditionDefault *msg, int32_t value) { |
| 8101 | const upb_MiniTableField field = {3, 4, 3, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8102 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 8103 | } |
| 8104 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8105 | /* google.protobuf.OneofOptions */ |
| 8106 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8107 | UPB_INLINE google_protobuf_OneofOptions* google_protobuf_OneofOptions_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8108 | 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] | 8109 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8110 | UPB_INLINE google_protobuf_OneofOptions* google_protobuf_OneofOptions_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 8111 | google_protobuf_OneofOptions* ret = google_protobuf_OneofOptions_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 8112 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8113 | if (upb_Decode(buf, size, ret, &google_protobuf_OneofOptions_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 8114 | return NULL; |
| 8115 | } |
| 8116 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8117 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8118 | UPB_INLINE google_protobuf_OneofOptions* google_protobuf_OneofOptions_parse_ex(const char* buf, size_t size, |
| 8119 | const upb_ExtensionRegistry* extreg, |
| 8120 | int options, upb_Arena* arena) { |
| 8121 | google_protobuf_OneofOptions* ret = google_protobuf_OneofOptions_new(arena); |
| 8122 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8123 | if (upb_Decode(buf, size, ret, &google_protobuf_OneofOptions_msg_init, extreg, options, arena) != |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8124 | kUpb_DecodeStatus_Ok) { |
| 8125 | return NULL; |
| 8126 | } |
| 8127 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8128 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8129 | UPB_INLINE char* google_protobuf_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] | 8130 | char* ptr; |
| 8131 | (void)upb_Encode(msg, &google_protobuf_OneofOptions_msg_init, 0, arena, &ptr, len); |
| 8132 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8133 | } |
| 8134 | UPB_INLINE char* google_protobuf_OneofOptions_serialize_ex(const google_protobuf_OneofOptions* msg, int options, |
| 8135 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8136 | char* ptr; |
| 8137 | (void)upb_Encode(msg, &google_protobuf_OneofOptions_msg_init, options, arena, &ptr, len); |
| 8138 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8139 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8140 | UPB_INLINE void google_protobuf_OneofOptions_clear_features(google_protobuf_OneofOptions* msg) { |
| 8141 | 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)}; |
| 8142 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 8143 | } |
| 8144 | UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_OneofOptions_features(const google_protobuf_OneofOptions* msg) { |
| 8145 | const google_protobuf_FeatureSet* default_val = NULL; |
| 8146 | const google_protobuf_FeatureSet* ret; |
| 8147 | 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)}; |
| 8148 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 8149 | return ret; |
| 8150 | } |
| 8151 | UPB_INLINE bool google_protobuf_OneofOptions_has_features(const google_protobuf_OneofOptions* msg) { |
| 8152 | 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)}; |
| 8153 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 8154 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8155 | 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] | 8156 | 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] | 8157 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8158 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 8159 | 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] | 8160 | 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] | 8161 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 8162 | if (arr) { |
| 8163 | if (size) *size = arr->size; |
| 8164 | return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr); |
| 8165 | } else { |
| 8166 | if (size) *size = 0; |
| 8167 | return NULL; |
| 8168 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8169 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 8170 | 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] | 8171 | 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] | 8172 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 8173 | if (size) { |
| 8174 | *size = arr ? arr->size : 0; |
| 8175 | } |
| 8176 | return arr; |
| 8177 | } |
| 8178 | 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] | 8179 | 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] | 8180 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 8181 | (upb_Message*)msg, &field, arena); |
| 8182 | if (size) { |
| 8183 | *size = arr ? arr->size : 0; |
| 8184 | } |
| 8185 | return arr; |
| 8186 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8187 | UPB_INLINE bool google_protobuf_OneofOptions_has_uninterpreted_option(const google_protobuf_OneofOptions* msg) { |
| 8188 | size_t size; |
| 8189 | google_protobuf_OneofOptions_uninterpreted_option(msg, &size); |
| 8190 | return size != 0; |
| 8191 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8192 | |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8193 | UPB_INLINE void google_protobuf_OneofOptions_set_features(google_protobuf_OneofOptions *msg, google_protobuf_FeatureSet* value) { |
| 8194 | 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)}; |
| 8195 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 8196 | } |
| 8197 | UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_OneofOptions_mutable_features(google_protobuf_OneofOptions* msg, upb_Arena* arena) { |
| 8198 | struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_OneofOptions_features(msg); |
| 8199 | if (sub == NULL) { |
| 8200 | sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google_protobuf_FeatureSet_msg_init, arena); |
| 8201 | if (sub) google_protobuf_OneofOptions_set_features(msg, sub); |
| 8202 | } |
| 8203 | return sub; |
| 8204 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 8205 | 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] | 8206 | 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] | 8207 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 8208 | if (arr) { |
| 8209 | if (size) *size = arr->size; |
| 8210 | return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr); |
| 8211 | } else { |
| 8212 | if (size) *size = 0; |
| 8213 | return NULL; |
| 8214 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8215 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 8216 | 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] | 8217 | 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] | 8218 | return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8219 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8220 | 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] | 8221 | 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] | 8222 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 8223 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 8224 | return NULL; |
| 8225 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8226 | 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] | 8227 | if (!arr || !sub) return NULL; |
| 8228 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8229 | return sub; |
| 8230 | } |
| 8231 | |
| 8232 | /* google.protobuf.EnumOptions */ |
| 8233 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8234 | UPB_INLINE google_protobuf_EnumOptions* google_protobuf_EnumOptions_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8235 | 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] | 8236 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8237 | UPB_INLINE google_protobuf_EnumOptions* google_protobuf_EnumOptions_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 8238 | google_protobuf_EnumOptions* ret = google_protobuf_EnumOptions_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 8239 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8240 | 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] | 8241 | return NULL; |
| 8242 | } |
| 8243 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8244 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8245 | UPB_INLINE google_protobuf_EnumOptions* google_protobuf_EnumOptions_parse_ex(const char* buf, size_t size, |
| 8246 | const upb_ExtensionRegistry* extreg, |
| 8247 | int options, upb_Arena* arena) { |
| 8248 | google_protobuf_EnumOptions* ret = google_protobuf_EnumOptions_new(arena); |
| 8249 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8250 | 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] | 8251 | kUpb_DecodeStatus_Ok) { |
| 8252 | return NULL; |
| 8253 | } |
| 8254 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8255 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8256 | 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] | 8257 | char* ptr; |
| 8258 | (void)upb_Encode(msg, &google_protobuf_EnumOptions_msg_init, 0, arena, &ptr, len); |
| 8259 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8260 | } |
| 8261 | UPB_INLINE char* google_protobuf_EnumOptions_serialize_ex(const google_protobuf_EnumOptions* msg, int options, |
| 8262 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8263 | char* ptr; |
| 8264 | (void)upb_Encode(msg, &google_protobuf_EnumOptions_msg_init, options, arena, &ptr, len); |
| 8265 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8266 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8267 | 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] | 8268 | 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] | 8269 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8270 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8271 | 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] | 8272 | bool default_val = false; |
| 8273 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8274 | 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] | 8275 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8276 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8277 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8278 | 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] | 8279 | 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] | 8280 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8281 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8282 | UPB_INLINE void google_protobuf_EnumOptions_clear_deprecated(google_protobuf_EnumOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8283 | 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] | 8284 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8285 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8286 | UPB_INLINE bool google_protobuf_EnumOptions_deprecated(const google_protobuf_EnumOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8287 | bool default_val = false; |
| 8288 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8289 | 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] | 8290 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8291 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8292 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8293 | 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] | 8294 | 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] | 8295 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8296 | } |
Mike Kruskal | 6b87d6f | 2022-12-14 10:36:53 -0800 | [diff] [blame] | 8297 | 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] | 8298 | 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] | 8299 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 8300 | } |
| 8301 | UPB_INLINE bool google_protobuf_EnumOptions_deprecated_legacy_json_field_conflicts(const google_protobuf_EnumOptions* msg) { |
| 8302 | bool default_val = false; |
| 8303 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8304 | 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] | 8305 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 8306 | return ret; |
| 8307 | } |
| 8308 | 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] | 8309 | 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] | 8310 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 8311 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8312 | UPB_INLINE void google_protobuf_EnumOptions_clear_features(google_protobuf_EnumOptions* msg) { |
| 8313 | 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)}; |
| 8314 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 8315 | } |
| 8316 | UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_EnumOptions_features(const google_protobuf_EnumOptions* msg) { |
| 8317 | const google_protobuf_FeatureSet* default_val = NULL; |
| 8318 | const google_protobuf_FeatureSet* ret; |
| 8319 | 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)}; |
| 8320 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 8321 | return ret; |
| 8322 | } |
| 8323 | UPB_INLINE bool google_protobuf_EnumOptions_has_features(const google_protobuf_EnumOptions* msg) { |
| 8324 | 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)}; |
| 8325 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 8326 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8327 | 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] | 8328 | 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] | 8329 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8330 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 8331 | 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] | 8332 | 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] | 8333 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 8334 | if (arr) { |
| 8335 | if (size) *size = arr->size; |
| 8336 | return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr); |
| 8337 | } else { |
| 8338 | if (size) *size = 0; |
| 8339 | return NULL; |
| 8340 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8341 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 8342 | 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] | 8343 | 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] | 8344 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 8345 | if (size) { |
| 8346 | *size = arr ? arr->size : 0; |
| 8347 | } |
| 8348 | return arr; |
| 8349 | } |
| 8350 | 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] | 8351 | 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] | 8352 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 8353 | (upb_Message*)msg, &field, arena); |
| 8354 | if (size) { |
| 8355 | *size = arr ? arr->size : 0; |
| 8356 | } |
| 8357 | return arr; |
| 8358 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8359 | UPB_INLINE bool google_protobuf_EnumOptions_has_uninterpreted_option(const google_protobuf_EnumOptions* msg) { |
| 8360 | size_t size; |
| 8361 | google_protobuf_EnumOptions_uninterpreted_option(msg, &size); |
| 8362 | return size != 0; |
| 8363 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8364 | |
| 8365 | 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] | 8366 | 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] | 8367 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8368 | } |
| 8369 | 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] | 8370 | 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] | 8371 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8372 | } |
| 8373 | 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] | 8374 | 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] | 8375 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8376 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8377 | UPB_INLINE void google_protobuf_EnumOptions_set_features(google_protobuf_EnumOptions *msg, google_protobuf_FeatureSet* value) { |
| 8378 | 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)}; |
| 8379 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 8380 | } |
| 8381 | UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_EnumOptions_mutable_features(google_protobuf_EnumOptions* msg, upb_Arena* arena) { |
| 8382 | struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_EnumOptions_features(msg); |
| 8383 | if (sub == NULL) { |
| 8384 | sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google_protobuf_FeatureSet_msg_init, arena); |
| 8385 | if (sub) google_protobuf_EnumOptions_set_features(msg, sub); |
| 8386 | } |
| 8387 | return sub; |
| 8388 | } |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8389 | 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] | 8390 | 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] | 8391 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 8392 | if (arr) { |
| 8393 | if (size) *size = arr->size; |
| 8394 | return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr); |
| 8395 | } else { |
| 8396 | if (size) *size = 0; |
| 8397 | return NULL; |
| 8398 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8399 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 8400 | 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] | 8401 | 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] | 8402 | return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8403 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8404 | 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] | 8405 | 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] | 8406 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 8407 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 8408 | return NULL; |
| 8409 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8410 | 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] | 8411 | if (!arr || !sub) return NULL; |
| 8412 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8413 | return sub; |
| 8414 | } |
| 8415 | |
| 8416 | /* google.protobuf.EnumValueOptions */ |
| 8417 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8418 | UPB_INLINE google_protobuf_EnumValueOptions* google_protobuf_EnumValueOptions_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8419 | 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] | 8420 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8421 | UPB_INLINE google_protobuf_EnumValueOptions* google_protobuf_EnumValueOptions_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 8422 | google_protobuf_EnumValueOptions* ret = google_protobuf_EnumValueOptions_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 8423 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8424 | 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] | 8425 | return NULL; |
| 8426 | } |
| 8427 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8428 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8429 | UPB_INLINE google_protobuf_EnumValueOptions* google_protobuf_EnumValueOptions_parse_ex(const char* buf, size_t size, |
| 8430 | const upb_ExtensionRegistry* extreg, |
| 8431 | int options, upb_Arena* arena) { |
| 8432 | google_protobuf_EnumValueOptions* ret = google_protobuf_EnumValueOptions_new(arena); |
| 8433 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8434 | 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] | 8435 | kUpb_DecodeStatus_Ok) { |
| 8436 | return NULL; |
| 8437 | } |
| 8438 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8439 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8440 | 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] | 8441 | char* ptr; |
| 8442 | (void)upb_Encode(msg, &google_protobuf_EnumValueOptions_msg_init, 0, arena, &ptr, len); |
| 8443 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8444 | } |
| 8445 | UPB_INLINE char* google_protobuf_EnumValueOptions_serialize_ex(const google_protobuf_EnumValueOptions* msg, int options, |
| 8446 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8447 | char* ptr; |
| 8448 | (void)upb_Encode(msg, &google_protobuf_EnumValueOptions_msg_init, options, arena, &ptr, len); |
| 8449 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8450 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8451 | UPB_INLINE void google_protobuf_EnumValueOptions_clear_deprecated(google_protobuf_EnumValueOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8452 | 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] | 8453 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8454 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8455 | UPB_INLINE bool google_protobuf_EnumValueOptions_deprecated(const google_protobuf_EnumValueOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8456 | bool default_val = false; |
| 8457 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8458 | 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] | 8459 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8460 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8461 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8462 | 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] | 8463 | 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] | 8464 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8465 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8466 | UPB_INLINE void google_protobuf_EnumValueOptions_clear_features(google_protobuf_EnumValueOptions* msg) { |
| 8467 | 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)}; |
| 8468 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 8469 | } |
| 8470 | UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_EnumValueOptions_features(const google_protobuf_EnumValueOptions* msg) { |
| 8471 | const google_protobuf_FeatureSet* default_val = NULL; |
| 8472 | const google_protobuf_FeatureSet* ret; |
| 8473 | 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)}; |
| 8474 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 8475 | return ret; |
| 8476 | } |
| 8477 | UPB_INLINE bool google_protobuf_EnumValueOptions_has_features(const google_protobuf_EnumValueOptions* msg) { |
| 8478 | 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)}; |
| 8479 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 8480 | } |
Mike Kruskal | 12e0f1d | 2023-05-31 15:40:54 -0700 | [diff] [blame] | 8481 | 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] | 8482 | 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] | 8483 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 8484 | } |
| 8485 | UPB_INLINE bool google_protobuf_EnumValueOptions_debug_redact(const google_protobuf_EnumValueOptions* msg) { |
| 8486 | bool default_val = false; |
| 8487 | bool ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8488 | 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] | 8489 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 8490 | return ret; |
| 8491 | } |
| 8492 | 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] | 8493 | 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] | 8494 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 8495 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8496 | 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] | 8497 | 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] | 8498 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8499 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 8500 | 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] | 8501 | 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] | 8502 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 8503 | if (arr) { |
| 8504 | if (size) *size = arr->size; |
| 8505 | return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr); |
| 8506 | } else { |
| 8507 | if (size) *size = 0; |
| 8508 | return NULL; |
| 8509 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8510 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 8511 | 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] | 8512 | 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] | 8513 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 8514 | if (size) { |
| 8515 | *size = arr ? arr->size : 0; |
| 8516 | } |
| 8517 | return arr; |
| 8518 | } |
| 8519 | 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] | 8520 | 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] | 8521 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 8522 | (upb_Message*)msg, &field, arena); |
| 8523 | if (size) { |
| 8524 | *size = arr ? arr->size : 0; |
| 8525 | } |
| 8526 | return arr; |
| 8527 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8528 | UPB_INLINE bool google_protobuf_EnumValueOptions_has_uninterpreted_option(const google_protobuf_EnumValueOptions* msg) { |
| 8529 | size_t size; |
| 8530 | google_protobuf_EnumValueOptions_uninterpreted_option(msg, &size); |
| 8531 | return size != 0; |
| 8532 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8533 | |
| 8534 | 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] | 8535 | 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] | 8536 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8537 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8538 | UPB_INLINE void google_protobuf_EnumValueOptions_set_features(google_protobuf_EnumValueOptions *msg, google_protobuf_FeatureSet* value) { |
| 8539 | 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)}; |
| 8540 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 8541 | } |
| 8542 | UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_EnumValueOptions_mutable_features(google_protobuf_EnumValueOptions* msg, upb_Arena* arena) { |
| 8543 | struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_EnumValueOptions_features(msg); |
| 8544 | if (sub == NULL) { |
| 8545 | sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google_protobuf_FeatureSet_msg_init, arena); |
| 8546 | if (sub) google_protobuf_EnumValueOptions_set_features(msg, sub); |
| 8547 | } |
| 8548 | return sub; |
| 8549 | } |
Mike Kruskal | 12e0f1d | 2023-05-31 15:40:54 -0700 | [diff] [blame] | 8550 | 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] | 8551 | 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] | 8552 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 8553 | } |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8554 | 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] | 8555 | 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] | 8556 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 8557 | if (arr) { |
| 8558 | if (size) *size = arr->size; |
| 8559 | return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr); |
| 8560 | } else { |
| 8561 | if (size) *size = 0; |
| 8562 | return NULL; |
| 8563 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8564 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 8565 | 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] | 8566 | 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] | 8567 | return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8568 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8569 | 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] | 8570 | 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] | 8571 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 8572 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 8573 | return NULL; |
| 8574 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8575 | 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] | 8576 | if (!arr || !sub) return NULL; |
| 8577 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8578 | return sub; |
| 8579 | } |
| 8580 | |
| 8581 | /* google.protobuf.ServiceOptions */ |
| 8582 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8583 | UPB_INLINE google_protobuf_ServiceOptions* google_protobuf_ServiceOptions_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8584 | 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] | 8585 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8586 | UPB_INLINE google_protobuf_ServiceOptions* google_protobuf_ServiceOptions_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 8587 | google_protobuf_ServiceOptions* ret = google_protobuf_ServiceOptions_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 8588 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8589 | 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] | 8590 | return NULL; |
| 8591 | } |
| 8592 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8593 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8594 | UPB_INLINE google_protobuf_ServiceOptions* google_protobuf_ServiceOptions_parse_ex(const char* buf, size_t size, |
| 8595 | const upb_ExtensionRegistry* extreg, |
| 8596 | int options, upb_Arena* arena) { |
| 8597 | google_protobuf_ServiceOptions* ret = google_protobuf_ServiceOptions_new(arena); |
| 8598 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8599 | 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] | 8600 | kUpb_DecodeStatus_Ok) { |
| 8601 | return NULL; |
| 8602 | } |
| 8603 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8604 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8605 | 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] | 8606 | char* ptr; |
| 8607 | (void)upb_Encode(msg, &google_protobuf_ServiceOptions_msg_init, 0, arena, &ptr, len); |
| 8608 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8609 | } |
| 8610 | UPB_INLINE char* google_protobuf_ServiceOptions_serialize_ex(const google_protobuf_ServiceOptions* msg, int options, |
| 8611 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8612 | char* ptr; |
| 8613 | (void)upb_Encode(msg, &google_protobuf_ServiceOptions_msg_init, options, arena, &ptr, len); |
| 8614 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8615 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8616 | UPB_INLINE void google_protobuf_ServiceOptions_clear_deprecated(google_protobuf_ServiceOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8617 | 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] | 8618 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8619 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8620 | UPB_INLINE bool google_protobuf_ServiceOptions_deprecated(const google_protobuf_ServiceOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8621 | bool default_val = false; |
| 8622 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8623 | 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] | 8624 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8625 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8626 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8627 | 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] | 8628 | 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] | 8629 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8630 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8631 | UPB_INLINE void google_protobuf_ServiceOptions_clear_features(google_protobuf_ServiceOptions* msg) { |
| 8632 | 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)}; |
| 8633 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 8634 | } |
| 8635 | UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_ServiceOptions_features(const google_protobuf_ServiceOptions* msg) { |
| 8636 | const google_protobuf_FeatureSet* default_val = NULL; |
| 8637 | const google_protobuf_FeatureSet* ret; |
| 8638 | 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)}; |
| 8639 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 8640 | return ret; |
| 8641 | } |
| 8642 | UPB_INLINE bool google_protobuf_ServiceOptions_has_features(const google_protobuf_ServiceOptions* msg) { |
| 8643 | 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)}; |
| 8644 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 8645 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8646 | 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] | 8647 | 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] | 8648 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8649 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 8650 | 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] | 8651 | 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] | 8652 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 8653 | if (arr) { |
| 8654 | if (size) *size = arr->size; |
| 8655 | return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr); |
| 8656 | } else { |
| 8657 | if (size) *size = 0; |
| 8658 | return NULL; |
| 8659 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8660 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 8661 | 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] | 8662 | 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] | 8663 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 8664 | if (size) { |
| 8665 | *size = arr ? arr->size : 0; |
| 8666 | } |
| 8667 | return arr; |
| 8668 | } |
| 8669 | 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] | 8670 | 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] | 8671 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 8672 | (upb_Message*)msg, &field, arena); |
| 8673 | if (size) { |
| 8674 | *size = arr ? arr->size : 0; |
| 8675 | } |
| 8676 | return arr; |
| 8677 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8678 | UPB_INLINE bool google_protobuf_ServiceOptions_has_uninterpreted_option(const google_protobuf_ServiceOptions* msg) { |
| 8679 | size_t size; |
| 8680 | google_protobuf_ServiceOptions_uninterpreted_option(msg, &size); |
| 8681 | return size != 0; |
| 8682 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8683 | |
| 8684 | 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] | 8685 | 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] | 8686 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8687 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8688 | UPB_INLINE void google_protobuf_ServiceOptions_set_features(google_protobuf_ServiceOptions *msg, google_protobuf_FeatureSet* value) { |
| 8689 | 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)}; |
| 8690 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 8691 | } |
| 8692 | UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_ServiceOptions_mutable_features(google_protobuf_ServiceOptions* msg, upb_Arena* arena) { |
| 8693 | struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_ServiceOptions_features(msg); |
| 8694 | if (sub == NULL) { |
| 8695 | sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google_protobuf_FeatureSet_msg_init, arena); |
| 8696 | if (sub) google_protobuf_ServiceOptions_set_features(msg, sub); |
| 8697 | } |
| 8698 | return sub; |
| 8699 | } |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8700 | 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] | 8701 | 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] | 8702 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 8703 | if (arr) { |
| 8704 | if (size) *size = arr->size; |
| 8705 | return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr); |
| 8706 | } else { |
| 8707 | if (size) *size = 0; |
| 8708 | return NULL; |
| 8709 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8710 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 8711 | 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] | 8712 | 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] | 8713 | return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8714 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8715 | 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] | 8716 | 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] | 8717 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 8718 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 8719 | return NULL; |
| 8720 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8721 | 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] | 8722 | if (!arr || !sub) return NULL; |
| 8723 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8724 | return sub; |
| 8725 | } |
| 8726 | |
| 8727 | /* google.protobuf.MethodOptions */ |
| 8728 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8729 | UPB_INLINE google_protobuf_MethodOptions* google_protobuf_MethodOptions_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8730 | 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] | 8731 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8732 | UPB_INLINE google_protobuf_MethodOptions* google_protobuf_MethodOptions_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 8733 | google_protobuf_MethodOptions* ret = google_protobuf_MethodOptions_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 8734 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8735 | 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] | 8736 | return NULL; |
| 8737 | } |
| 8738 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8739 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8740 | UPB_INLINE google_protobuf_MethodOptions* google_protobuf_MethodOptions_parse_ex(const char* buf, size_t size, |
| 8741 | const upb_ExtensionRegistry* extreg, |
| 8742 | int options, upb_Arena* arena) { |
| 8743 | google_protobuf_MethodOptions* ret = google_protobuf_MethodOptions_new(arena); |
| 8744 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8745 | 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] | 8746 | kUpb_DecodeStatus_Ok) { |
| 8747 | return NULL; |
| 8748 | } |
| 8749 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8750 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8751 | 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] | 8752 | char* ptr; |
| 8753 | (void)upb_Encode(msg, &google_protobuf_MethodOptions_msg_init, 0, arena, &ptr, len); |
| 8754 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8755 | } |
| 8756 | UPB_INLINE char* google_protobuf_MethodOptions_serialize_ex(const google_protobuf_MethodOptions* msg, int options, |
| 8757 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8758 | char* ptr; |
| 8759 | (void)upb_Encode(msg, &google_protobuf_MethodOptions_msg_init, options, arena, &ptr, len); |
| 8760 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8761 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8762 | UPB_INLINE void google_protobuf_MethodOptions_clear_deprecated(google_protobuf_MethodOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8763 | 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] | 8764 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8765 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8766 | UPB_INLINE bool google_protobuf_MethodOptions_deprecated(const google_protobuf_MethodOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8767 | bool default_val = false; |
| 8768 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8769 | 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] | 8770 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8771 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8772 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8773 | 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] | 8774 | 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] | 8775 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8776 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8777 | 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] | 8778 | 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] | 8779 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8780 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8781 | 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] | 8782 | int32_t default_val = 0; |
| 8783 | int32_t ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8784 | 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] | 8785 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8786 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8787 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8788 | 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] | 8789 | const upb_MiniTableField field = {34, 4, 2, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
| 8790 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 8791 | } |
| 8792 | UPB_INLINE void google_protobuf_MethodOptions_clear_features(google_protobuf_MethodOptions* msg) { |
| 8793 | 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)}; |
| 8794 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 8795 | } |
| 8796 | UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_MethodOptions_features(const google_protobuf_MethodOptions* msg) { |
| 8797 | const google_protobuf_FeatureSet* default_val = NULL; |
| 8798 | const google_protobuf_FeatureSet* ret; |
| 8799 | 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)}; |
| 8800 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 8801 | return ret; |
| 8802 | } |
| 8803 | UPB_INLINE bool google_protobuf_MethodOptions_has_features(const google_protobuf_MethodOptions* msg) { |
| 8804 | 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] | 8805 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8806 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8807 | 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] | 8808 | 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] | 8809 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8810 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 8811 | 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] | 8812 | 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] | 8813 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 8814 | if (arr) { |
| 8815 | if (size) *size = arr->size; |
| 8816 | return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr); |
| 8817 | } else { |
| 8818 | if (size) *size = 0; |
| 8819 | return NULL; |
| 8820 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8821 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 8822 | 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] | 8823 | 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] | 8824 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 8825 | if (size) { |
| 8826 | *size = arr ? arr->size : 0; |
| 8827 | } |
| 8828 | return arr; |
| 8829 | } |
| 8830 | 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] | 8831 | 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] | 8832 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 8833 | (upb_Message*)msg, &field, arena); |
| 8834 | if (size) { |
| 8835 | *size = arr ? arr->size : 0; |
| 8836 | } |
| 8837 | return arr; |
| 8838 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8839 | UPB_INLINE bool google_protobuf_MethodOptions_has_uninterpreted_option(const google_protobuf_MethodOptions* msg) { |
| 8840 | size_t size; |
| 8841 | google_protobuf_MethodOptions_uninterpreted_option(msg, &size); |
| 8842 | return size != 0; |
| 8843 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8844 | |
| 8845 | 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] | 8846 | 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] | 8847 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8848 | } |
| 8849 | 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] | 8850 | 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] | 8851 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8852 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8853 | UPB_INLINE void google_protobuf_MethodOptions_set_features(google_protobuf_MethodOptions *msg, google_protobuf_FeatureSet* value) { |
| 8854 | 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)}; |
| 8855 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 8856 | } |
| 8857 | UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_MethodOptions_mutable_features(google_protobuf_MethodOptions* msg, upb_Arena* arena) { |
| 8858 | struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_MethodOptions_features(msg); |
| 8859 | if (sub == NULL) { |
| 8860 | sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google_protobuf_FeatureSet_msg_init, arena); |
| 8861 | if (sub) google_protobuf_MethodOptions_set_features(msg, sub); |
| 8862 | } |
| 8863 | return sub; |
| 8864 | } |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8865 | 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] | 8866 | 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] | 8867 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 8868 | if (arr) { |
| 8869 | if (size) *size = arr->size; |
| 8870 | return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr); |
| 8871 | } else { |
| 8872 | if (size) *size = 0; |
| 8873 | return NULL; |
| 8874 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8875 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 8876 | 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] | 8877 | 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] | 8878 | return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8879 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8880 | 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] | 8881 | 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] | 8882 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 8883 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 8884 | return NULL; |
| 8885 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8886 | 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] | 8887 | if (!arr || !sub) return NULL; |
| 8888 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8889 | return sub; |
| 8890 | } |
| 8891 | |
| 8892 | /* google.protobuf.UninterpretedOption */ |
| 8893 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8894 | UPB_INLINE google_protobuf_UninterpretedOption* google_protobuf_UninterpretedOption_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8895 | 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] | 8896 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8897 | UPB_INLINE google_protobuf_UninterpretedOption* google_protobuf_UninterpretedOption_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 8898 | google_protobuf_UninterpretedOption* ret = google_protobuf_UninterpretedOption_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 8899 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8900 | 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] | 8901 | return NULL; |
| 8902 | } |
| 8903 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8904 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8905 | UPB_INLINE google_protobuf_UninterpretedOption* google_protobuf_UninterpretedOption_parse_ex(const char* buf, size_t size, |
| 8906 | const upb_ExtensionRegistry* extreg, |
| 8907 | int options, upb_Arena* arena) { |
| 8908 | google_protobuf_UninterpretedOption* ret = google_protobuf_UninterpretedOption_new(arena); |
| 8909 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8910 | 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] | 8911 | kUpb_DecodeStatus_Ok) { |
| 8912 | return NULL; |
| 8913 | } |
| 8914 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8915 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8916 | 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] | 8917 | char* ptr; |
| 8918 | (void)upb_Encode(msg, &google_protobuf_UninterpretedOption_msg_init, 0, arena, &ptr, len); |
| 8919 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8920 | } |
| 8921 | UPB_INLINE char* google_protobuf_UninterpretedOption_serialize_ex(const google_protobuf_UninterpretedOption* msg, int options, |
| 8922 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8923 | char* ptr; |
| 8924 | (void)upb_Encode(msg, &google_protobuf_UninterpretedOption_msg_init, options, arena, &ptr, len); |
| 8925 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8926 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8927 | UPB_INLINE void google_protobuf_UninterpretedOption_clear_name(google_protobuf_UninterpretedOption* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8928 | 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] | 8929 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8930 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 8931 | 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] | 8932 | 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] | 8933 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 8934 | if (arr) { |
| 8935 | if (size) *size = arr->size; |
| 8936 | return (const google_protobuf_UninterpretedOption_NamePart* const*)_upb_array_constptr(arr); |
| 8937 | } else { |
| 8938 | if (size) *size = 0; |
| 8939 | return NULL; |
| 8940 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8941 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 8942 | 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] | 8943 | 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] | 8944 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 8945 | if (size) { |
| 8946 | *size = arr ? arr->size : 0; |
| 8947 | } |
| 8948 | return arr; |
| 8949 | } |
| 8950 | 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] | 8951 | 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] | 8952 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 8953 | (upb_Message*)msg, &field, arena); |
| 8954 | if (size) { |
| 8955 | *size = arr ? arr->size : 0; |
| 8956 | } |
| 8957 | return arr; |
| 8958 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8959 | UPB_INLINE bool google_protobuf_UninterpretedOption_has_name(const google_protobuf_UninterpretedOption* msg) { |
| 8960 | size_t size; |
| 8961 | google_protobuf_UninterpretedOption_name(msg, &size); |
| 8962 | return size != 0; |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8963 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8964 | 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] | 8965 | 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] | 8966 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8967 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8968 | 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] | 8969 | upb_StringView default_val = upb_StringView_FromString(""); |
| 8970 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8971 | 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] | 8972 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8973 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8974 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8975 | 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] | 8976 | 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] | 8977 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8978 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8979 | 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] | 8980 | 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] | 8981 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8982 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8983 | 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] | 8984 | uint64_t default_val = (uint64_t)0ull; |
| 8985 | uint64_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8986 | 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] | 8987 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8988 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8989 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8990 | 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] | 8991 | 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] | 8992 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8993 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8994 | 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] | 8995 | 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] | 8996 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8997 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8998 | 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] | 8999 | int64_t default_val = (int64_t)0ll; |
| 9000 | int64_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9001 | 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] | 9002 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 9003 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9004 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9005 | 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] | 9006 | 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] | 9007 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9008 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9009 | 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] | 9010 | 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] | 9011 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9012 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9013 | 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] | 9014 | double default_val = 0; |
| 9015 | double ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9016 | 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] | 9017 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 9018 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9019 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9020 | 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] | 9021 | 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] | 9022 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9023 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9024 | 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] | 9025 | 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] | 9026 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9027 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9028 | 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] | 9029 | upb_StringView default_val = upb_StringView_FromString(""); |
| 9030 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9031 | 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] | 9032 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 9033 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9034 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9035 | 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] | 9036 | 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] | 9037 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9038 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9039 | 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] | 9040 | 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] | 9041 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9042 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9043 | 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] | 9044 | upb_StringView default_val = upb_StringView_FromString(""); |
| 9045 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9046 | 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] | 9047 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 9048 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9049 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9050 | 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] | 9051 | 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] | 9052 | return _upb_Message_HasNonExtensionField(msg, &field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9053 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9054 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9055 | 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] | 9056 | 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] | 9057 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 9058 | if (arr) { |
| 9059 | if (size) *size = arr->size; |
| 9060 | return (google_protobuf_UninterpretedOption_NamePart**)_upb_array_ptr(arr); |
| 9061 | } else { |
| 9062 | if (size) *size = 0; |
| 9063 | return NULL; |
| 9064 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9065 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9066 | 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] | 9067 | 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] | 9068 | return (google_protobuf_UninterpretedOption_NamePart**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9069 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9070 | 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] | 9071 | 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] | 9072 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 9073 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 9074 | return NULL; |
| 9075 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9076 | 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] | 9077 | if (!arr || !sub) return NULL; |
| 9078 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9079 | return sub; |
| 9080 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9081 | 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] | 9082 | 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] | 9083 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 9084 | } |
| 9085 | 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] | 9086 | 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] | 9087 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 9088 | } |
| 9089 | 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] | 9090 | 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] | 9091 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 9092 | } |
| 9093 | 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] | 9094 | 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] | 9095 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 9096 | } |
| 9097 | 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] | 9098 | 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] | 9099 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 9100 | } |
| 9101 | 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] | 9102 | 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] | 9103 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9104 | } |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 9105 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9106 | /* google.protobuf.UninterpretedOption.NamePart */ |
| 9107 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9108 | UPB_INLINE google_protobuf_UninterpretedOption_NamePart* google_protobuf_UninterpretedOption_NamePart_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9109 | 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] | 9110 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9111 | UPB_INLINE google_protobuf_UninterpretedOption_NamePart* google_protobuf_UninterpretedOption_NamePart_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 9112 | google_protobuf_UninterpretedOption_NamePart* ret = google_protobuf_UninterpretedOption_NamePart_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 9113 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9114 | 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] | 9115 | return NULL; |
| 9116 | } |
| 9117 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9118 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9119 | UPB_INLINE google_protobuf_UninterpretedOption_NamePart* google_protobuf_UninterpretedOption_NamePart_parse_ex(const char* buf, size_t size, |
| 9120 | const upb_ExtensionRegistry* extreg, |
| 9121 | int options, upb_Arena* arena) { |
| 9122 | google_protobuf_UninterpretedOption_NamePart* ret = google_protobuf_UninterpretedOption_NamePart_new(arena); |
| 9123 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9124 | 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] | 9125 | kUpb_DecodeStatus_Ok) { |
| 9126 | return NULL; |
| 9127 | } |
| 9128 | return ret; |
| 9129 | } |
| 9130 | 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] | 9131 | char* ptr; |
| 9132 | (void)upb_Encode(msg, &google_protobuf_UninterpretedOption_NamePart_msg_init, 0, arena, &ptr, len); |
| 9133 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9134 | } |
| 9135 | UPB_INLINE char* google_protobuf_UninterpretedOption_NamePart_serialize_ex(const google_protobuf_UninterpretedOption_NamePart* msg, int options, |
| 9136 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9137 | char* ptr; |
| 9138 | (void)upb_Encode(msg, &google_protobuf_UninterpretedOption_NamePart_msg_init, options, arena, &ptr, len); |
| 9139 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9140 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9141 | 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] | 9142 | 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] | 9143 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9144 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9145 | 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] | 9146 | upb_StringView default_val = upb_StringView_FromString(""); |
| 9147 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9148 | 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] | 9149 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 9150 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9151 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9152 | 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] | 9153 | 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] | 9154 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9155 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9156 | 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] | 9157 | 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] | 9158 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9159 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9160 | 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] | 9161 | bool default_val = false; |
| 9162 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9163 | 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] | 9164 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 9165 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9166 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9167 | 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] | 9168 | 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] | 9169 | return _upb_Message_HasNonExtensionField(msg, &field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9170 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9171 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9172 | 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] | 9173 | 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] | 9174 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 9175 | } |
| 9176 | 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] | 9177 | 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] | 9178 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9179 | } |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 9180 | |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9181 | /* google.protobuf.FeatureSet */ |
| 9182 | |
| 9183 | UPB_INLINE google_protobuf_FeatureSet* google_protobuf_FeatureSet_new(upb_Arena* arena) { |
| 9184 | return (google_protobuf_FeatureSet*)_upb_Message_New(&google_protobuf_FeatureSet_msg_init, arena); |
| 9185 | } |
| 9186 | UPB_INLINE google_protobuf_FeatureSet* google_protobuf_FeatureSet_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 9187 | google_protobuf_FeatureSet* ret = google_protobuf_FeatureSet_new(arena); |
| 9188 | if (!ret) return NULL; |
| 9189 | if (upb_Decode(buf, size, ret, &google_protobuf_FeatureSet_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { |
| 9190 | return NULL; |
| 9191 | } |
| 9192 | return ret; |
| 9193 | } |
| 9194 | UPB_INLINE google_protobuf_FeatureSet* google_protobuf_FeatureSet_parse_ex(const char* buf, size_t size, |
| 9195 | const upb_ExtensionRegistry* extreg, |
| 9196 | int options, upb_Arena* arena) { |
| 9197 | google_protobuf_FeatureSet* ret = google_protobuf_FeatureSet_new(arena); |
| 9198 | if (!ret) return NULL; |
| 9199 | if (upb_Decode(buf, size, ret, &google_protobuf_FeatureSet_msg_init, extreg, options, arena) != |
| 9200 | kUpb_DecodeStatus_Ok) { |
| 9201 | return NULL; |
| 9202 | } |
| 9203 | return ret; |
| 9204 | } |
| 9205 | UPB_INLINE char* google_protobuf_FeatureSet_serialize(const google_protobuf_FeatureSet* msg, upb_Arena* arena, size_t* len) { |
| 9206 | char* ptr; |
| 9207 | (void)upb_Encode(msg, &google_protobuf_FeatureSet_msg_init, 0, arena, &ptr, len); |
| 9208 | return ptr; |
| 9209 | } |
| 9210 | UPB_INLINE char* google_protobuf_FeatureSet_serialize_ex(const google_protobuf_FeatureSet* msg, int options, |
| 9211 | upb_Arena* arena, size_t* len) { |
| 9212 | char* ptr; |
| 9213 | (void)upb_Encode(msg, &google_protobuf_FeatureSet_msg_init, options, arena, &ptr, len); |
| 9214 | return ptr; |
| 9215 | } |
| 9216 | 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] | 9217 | 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] | 9218 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 9219 | } |
| 9220 | UPB_INLINE int32_t google_protobuf_FeatureSet_field_presence(const google_protobuf_FeatureSet* msg) { |
| 9221 | int32_t default_val = 0; |
| 9222 | int32_t ret; |
Mike Kruskal | 60ec7bf | 2023-08-17 16:44:12 -0700 | [diff] [blame] | 9223 | 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] | 9224 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 9225 | return ret; |
| 9226 | } |
| 9227 | 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] | 9228 | 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] | 9229 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 9230 | } |
| 9231 | 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] | 9232 | 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] | 9233 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 9234 | } |
| 9235 | UPB_INLINE int32_t google_protobuf_FeatureSet_enum_type(const google_protobuf_FeatureSet* msg) { |
| 9236 | int32_t default_val = 0; |
| 9237 | int32_t ret; |
Mike Kruskal | 60ec7bf | 2023-08-17 16:44:12 -0700 | [diff] [blame] | 9238 | 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] | 9239 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 9240 | return ret; |
| 9241 | } |
| 9242 | 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] | 9243 | 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] | 9244 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 9245 | } |
| 9246 | 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] | 9247 | 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] | 9248 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 9249 | } |
| 9250 | UPB_INLINE int32_t google_protobuf_FeatureSet_repeated_field_encoding(const google_protobuf_FeatureSet* msg) { |
| 9251 | int32_t default_val = 0; |
| 9252 | int32_t ret; |
Mike Kruskal | 60ec7bf | 2023-08-17 16:44:12 -0700 | [diff] [blame] | 9253 | 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] | 9254 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 9255 | return ret; |
| 9256 | } |
| 9257 | 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] | 9258 | 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] | 9259 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 9260 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9261 | UPB_INLINE void google_protobuf_FeatureSet_clear_message_encoding(google_protobuf_FeatureSet* msg) { |
Mike Kruskal | 60ec7bf | 2023-08-17 16:44:12 -0700 | [diff] [blame] | 9262 | const upb_MiniTableField field = {5, 16, 4, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9263 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 9264 | } |
| 9265 | UPB_INLINE int32_t google_protobuf_FeatureSet_message_encoding(const google_protobuf_FeatureSet* msg) { |
| 9266 | int32_t default_val = 0; |
| 9267 | int32_t ret; |
Mike Kruskal | 60ec7bf | 2023-08-17 16:44:12 -0700 | [diff] [blame] | 9268 | const upb_MiniTableField field = {5, 16, 4, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9269 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 9270 | return ret; |
| 9271 | } |
| 9272 | UPB_INLINE bool google_protobuf_FeatureSet_has_message_encoding(const google_protobuf_FeatureSet* msg) { |
Mike Kruskal | 60ec7bf | 2023-08-17 16:44:12 -0700 | [diff] [blame] | 9273 | const upb_MiniTableField field = {5, 16, 4, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9274 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 9275 | } |
| 9276 | UPB_INLINE void google_protobuf_FeatureSet_clear_json_format(google_protobuf_FeatureSet* msg) { |
Mike Kruskal | 60ec7bf | 2023-08-17 16:44:12 -0700 | [diff] [blame] | 9277 | const upb_MiniTableField field = {6, 20, 5, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9278 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 9279 | } |
| 9280 | UPB_INLINE int32_t google_protobuf_FeatureSet_json_format(const google_protobuf_FeatureSet* msg) { |
| 9281 | int32_t default_val = 0; |
| 9282 | int32_t ret; |
Mike Kruskal | 60ec7bf | 2023-08-17 16:44:12 -0700 | [diff] [blame] | 9283 | const upb_MiniTableField field = {6, 20, 5, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9284 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 9285 | return ret; |
| 9286 | } |
| 9287 | UPB_INLINE bool google_protobuf_FeatureSet_has_json_format(const google_protobuf_FeatureSet* msg) { |
Mike Kruskal | 60ec7bf | 2023-08-17 16:44:12 -0700 | [diff] [blame] | 9288 | const upb_MiniTableField field = {6, 20, 5, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9289 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 9290 | } |
| 9291 | |
| 9292 | 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] | 9293 | 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] | 9294 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 9295 | } |
| 9296 | 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] | 9297 | 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] | 9298 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 9299 | } |
| 9300 | 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] | 9301 | 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] | 9302 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 9303 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9304 | UPB_INLINE void google_protobuf_FeatureSet_set_message_encoding(google_protobuf_FeatureSet *msg, int32_t value) { |
Mike Kruskal | 60ec7bf | 2023-08-17 16:44:12 -0700 | [diff] [blame] | 9305 | const upb_MiniTableField field = {5, 16, 4, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9306 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 9307 | } |
| 9308 | UPB_INLINE void google_protobuf_FeatureSet_set_json_format(google_protobuf_FeatureSet *msg, int32_t value) { |
Mike Kruskal | 60ec7bf | 2023-08-17 16:44:12 -0700 | [diff] [blame] | 9309 | const upb_MiniTableField field = {6, 20, 5, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9310 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 9311 | } |
| 9312 | |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9313 | /* google.protobuf.FeatureSetDefaults */ |
| 9314 | |
| 9315 | UPB_INLINE google_protobuf_FeatureSetDefaults* google_protobuf_FeatureSetDefaults_new(upb_Arena* arena) { |
| 9316 | return (google_protobuf_FeatureSetDefaults*)_upb_Message_New(&google_protobuf_FeatureSetDefaults_msg_init, arena); |
| 9317 | } |
| 9318 | UPB_INLINE google_protobuf_FeatureSetDefaults* google_protobuf_FeatureSetDefaults_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 9319 | google_protobuf_FeatureSetDefaults* ret = google_protobuf_FeatureSetDefaults_new(arena); |
| 9320 | if (!ret) return NULL; |
| 9321 | if (upb_Decode(buf, size, ret, &google_protobuf_FeatureSetDefaults_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { |
| 9322 | return NULL; |
| 9323 | } |
| 9324 | return ret; |
| 9325 | } |
| 9326 | UPB_INLINE google_protobuf_FeatureSetDefaults* google_protobuf_FeatureSetDefaults_parse_ex(const char* buf, size_t size, |
| 9327 | const upb_ExtensionRegistry* extreg, |
| 9328 | int options, upb_Arena* arena) { |
| 9329 | google_protobuf_FeatureSetDefaults* ret = google_protobuf_FeatureSetDefaults_new(arena); |
| 9330 | if (!ret) return NULL; |
| 9331 | if (upb_Decode(buf, size, ret, &google_protobuf_FeatureSetDefaults_msg_init, extreg, options, arena) != |
| 9332 | kUpb_DecodeStatus_Ok) { |
| 9333 | return NULL; |
| 9334 | } |
| 9335 | return ret; |
| 9336 | } |
| 9337 | UPB_INLINE char* google_protobuf_FeatureSetDefaults_serialize(const google_protobuf_FeatureSetDefaults* msg, upb_Arena* arena, size_t* len) { |
| 9338 | char* ptr; |
| 9339 | (void)upb_Encode(msg, &google_protobuf_FeatureSetDefaults_msg_init, 0, arena, &ptr, len); |
| 9340 | return ptr; |
| 9341 | } |
| 9342 | UPB_INLINE char* google_protobuf_FeatureSetDefaults_serialize_ex(const google_protobuf_FeatureSetDefaults* msg, int options, |
| 9343 | upb_Arena* arena, size_t* len) { |
| 9344 | char* ptr; |
| 9345 | (void)upb_Encode(msg, &google_protobuf_FeatureSetDefaults_msg_init, options, arena, &ptr, len); |
| 9346 | return ptr; |
| 9347 | } |
| 9348 | 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] | 9349 | 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] | 9350 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 9351 | } |
| 9352 | 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] | 9353 | 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] | 9354 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 9355 | if (arr) { |
| 9356 | if (size) *size = arr->size; |
| 9357 | return (const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* const*)_upb_array_constptr(arr); |
| 9358 | } else { |
| 9359 | if (size) *size = 0; |
| 9360 | return NULL; |
| 9361 | } |
| 9362 | } |
| 9363 | 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] | 9364 | 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] | 9365 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 9366 | if (size) { |
| 9367 | *size = arr ? arr->size : 0; |
| 9368 | } |
| 9369 | return arr; |
| 9370 | } |
| 9371 | 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] | 9372 | 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] | 9373 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 9374 | (upb_Message*)msg, &field, arena); |
| 9375 | if (size) { |
| 9376 | *size = arr ? arr->size : 0; |
| 9377 | } |
| 9378 | return arr; |
| 9379 | } |
| 9380 | UPB_INLINE bool google_protobuf_FeatureSetDefaults_has_defaults(const google_protobuf_FeatureSetDefaults* msg) { |
| 9381 | size_t size; |
| 9382 | google_protobuf_FeatureSetDefaults_defaults(msg, &size); |
| 9383 | return size != 0; |
| 9384 | } |
| 9385 | UPB_INLINE void google_protobuf_FeatureSetDefaults_clear_minimum_edition(google_protobuf_FeatureSetDefaults* msg) { |
Protobuf Team Bot | fa98bb3 | 2023-09-01 18:11:09 +0000 | [diff] [blame] | 9386 | const upb_MiniTableField field = {2, UPB_SIZE(16, 24), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9387 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 9388 | } |
| 9389 | UPB_INLINE upb_StringView google_protobuf_FeatureSetDefaults_minimum_edition(const google_protobuf_FeatureSetDefaults* msg) { |
| 9390 | upb_StringView default_val = upb_StringView_FromString(""); |
| 9391 | upb_StringView ret; |
Protobuf Team Bot | fa98bb3 | 2023-09-01 18:11:09 +0000 | [diff] [blame] | 9392 | const upb_MiniTableField field = {2, UPB_SIZE(16, 24), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9393 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 9394 | return ret; |
| 9395 | } |
| 9396 | UPB_INLINE bool google_protobuf_FeatureSetDefaults_has_minimum_edition(const google_protobuf_FeatureSetDefaults* msg) { |
Protobuf Team Bot | fa98bb3 | 2023-09-01 18:11:09 +0000 | [diff] [blame] | 9397 | const upb_MiniTableField field = {2, UPB_SIZE(16, 24), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9398 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 9399 | } |
| 9400 | UPB_INLINE void google_protobuf_FeatureSetDefaults_clear_maximum_edition(google_protobuf_FeatureSetDefaults* msg) { |
Protobuf Team Bot | fa98bb3 | 2023-09-01 18:11:09 +0000 | [diff] [blame] | 9401 | const upb_MiniTableField field = {3, UPB_SIZE(24, 40), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9402 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 9403 | } |
| 9404 | UPB_INLINE upb_StringView google_protobuf_FeatureSetDefaults_maximum_edition(const google_protobuf_FeatureSetDefaults* msg) { |
| 9405 | upb_StringView default_val = upb_StringView_FromString(""); |
| 9406 | upb_StringView ret; |
Protobuf Team Bot | fa98bb3 | 2023-09-01 18:11:09 +0000 | [diff] [blame] | 9407 | const upb_MiniTableField field = {3, UPB_SIZE(24, 40), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9408 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 9409 | return ret; |
| 9410 | } |
| 9411 | UPB_INLINE bool google_protobuf_FeatureSetDefaults_has_maximum_edition(const google_protobuf_FeatureSetDefaults* msg) { |
Protobuf Team Bot | fa98bb3 | 2023-09-01 18:11:09 +0000 | [diff] [blame] | 9412 | const upb_MiniTableField field = {3, UPB_SIZE(24, 40), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
| 9413 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 9414 | } |
| 9415 | UPB_INLINE void google_protobuf_FeatureSetDefaults_clear_minimum_edition_enum(google_protobuf_FeatureSetDefaults* msg) { |
| 9416 | const upb_MiniTableField field = {4, UPB_SIZE(8, 4), 3, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
| 9417 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 9418 | } |
| 9419 | UPB_INLINE int32_t google_protobuf_FeatureSetDefaults_minimum_edition_enum(const google_protobuf_FeatureSetDefaults* msg) { |
| 9420 | int32_t default_val = 0; |
| 9421 | int32_t ret; |
| 9422 | const upb_MiniTableField field = {4, UPB_SIZE(8, 4), 3, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
| 9423 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 9424 | return ret; |
| 9425 | } |
| 9426 | UPB_INLINE bool google_protobuf_FeatureSetDefaults_has_minimum_edition_enum(const google_protobuf_FeatureSetDefaults* msg) { |
| 9427 | const upb_MiniTableField field = {4, UPB_SIZE(8, 4), 3, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
| 9428 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 9429 | } |
| 9430 | UPB_INLINE void google_protobuf_FeatureSetDefaults_clear_maximum_edition_enum(google_protobuf_FeatureSetDefaults* msg) { |
| 9431 | const upb_MiniTableField field = {5, UPB_SIZE(12, 8), 4, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
| 9432 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 9433 | } |
| 9434 | UPB_INLINE int32_t google_protobuf_FeatureSetDefaults_maximum_edition_enum(const google_protobuf_FeatureSetDefaults* msg) { |
| 9435 | int32_t default_val = 0; |
| 9436 | int32_t ret; |
| 9437 | const upb_MiniTableField field = {5, UPB_SIZE(12, 8), 4, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
| 9438 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 9439 | return ret; |
| 9440 | } |
| 9441 | UPB_INLINE bool google_protobuf_FeatureSetDefaults_has_maximum_edition_enum(const google_protobuf_FeatureSetDefaults* msg) { |
| 9442 | const upb_MiniTableField field = {5, UPB_SIZE(12, 8), 4, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9443 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 9444 | } |
| 9445 | |
| 9446 | 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] | 9447 | 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] | 9448 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 9449 | if (arr) { |
| 9450 | if (size) *size = arr->size; |
| 9451 | return (google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault**)_upb_array_ptr(arr); |
| 9452 | } else { |
| 9453 | if (size) *size = 0; |
| 9454 | return NULL; |
| 9455 | } |
| 9456 | } |
| 9457 | 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] | 9458 | 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] | 9459 | return (google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
| 9460 | } |
| 9461 | 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] | 9462 | 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] | 9463 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 9464 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 9465 | return NULL; |
| 9466 | } |
| 9467 | struct google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* sub = (struct google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault*)_upb_Message_New(&google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_msg_init, arena); |
| 9468 | if (!arr || !sub) return NULL; |
| 9469 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
| 9470 | return sub; |
| 9471 | } |
| 9472 | UPB_INLINE void google_protobuf_FeatureSetDefaults_set_minimum_edition(google_protobuf_FeatureSetDefaults *msg, upb_StringView value) { |
Protobuf Team Bot | fa98bb3 | 2023-09-01 18:11:09 +0000 | [diff] [blame] | 9473 | const upb_MiniTableField field = {2, UPB_SIZE(16, 24), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9474 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 9475 | } |
| 9476 | UPB_INLINE void google_protobuf_FeatureSetDefaults_set_maximum_edition(google_protobuf_FeatureSetDefaults *msg, upb_StringView value) { |
Protobuf Team Bot | fa98bb3 | 2023-09-01 18:11:09 +0000 | [diff] [blame] | 9477 | const upb_MiniTableField field = {3, UPB_SIZE(24, 40), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
| 9478 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 9479 | } |
| 9480 | UPB_INLINE void google_protobuf_FeatureSetDefaults_set_minimum_edition_enum(google_protobuf_FeatureSetDefaults *msg, int32_t value) { |
| 9481 | const upb_MiniTableField field = {4, UPB_SIZE(8, 4), 3, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
| 9482 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 9483 | } |
| 9484 | UPB_INLINE void google_protobuf_FeatureSetDefaults_set_maximum_edition_enum(google_protobuf_FeatureSetDefaults *msg, int32_t value) { |
| 9485 | const upb_MiniTableField field = {5, UPB_SIZE(12, 8), 4, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9486 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 9487 | } |
| 9488 | |
| 9489 | /* google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault */ |
| 9490 | |
| 9491 | UPB_INLINE google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_new(upb_Arena* arena) { |
| 9492 | return (google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault*)_upb_Message_New(&google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_msg_init, arena); |
| 9493 | } |
| 9494 | UPB_INLINE google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 9495 | google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* ret = google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_new(arena); |
| 9496 | if (!ret) return NULL; |
| 9497 | if (upb_Decode(buf, size, ret, &google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { |
| 9498 | return NULL; |
| 9499 | } |
| 9500 | return ret; |
| 9501 | } |
| 9502 | UPB_INLINE google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_parse_ex(const char* buf, size_t size, |
| 9503 | const upb_ExtensionRegistry* extreg, |
| 9504 | int options, upb_Arena* arena) { |
| 9505 | google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* ret = google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_new(arena); |
| 9506 | if (!ret) return NULL; |
| 9507 | if (upb_Decode(buf, size, ret, &google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_msg_init, extreg, options, arena) != |
| 9508 | kUpb_DecodeStatus_Ok) { |
| 9509 | return NULL; |
| 9510 | } |
| 9511 | return ret; |
| 9512 | } |
| 9513 | UPB_INLINE char* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_serialize(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg, upb_Arena* arena, size_t* len) { |
| 9514 | char* ptr; |
| 9515 | (void)upb_Encode(msg, &google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_msg_init, 0, arena, &ptr, len); |
| 9516 | return ptr; |
| 9517 | } |
| 9518 | UPB_INLINE char* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_serialize_ex(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg, int options, |
| 9519 | upb_Arena* arena, size_t* len) { |
| 9520 | char* ptr; |
| 9521 | (void)upb_Encode(msg, &google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_msg_init, options, arena, &ptr, len); |
| 9522 | return ptr; |
| 9523 | } |
| 9524 | UPB_INLINE void google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_clear_edition(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) { |
Protobuf Team Bot | fa98bb3 | 2023-09-01 18:11:09 +0000 | [diff] [blame] | 9525 | const upb_MiniTableField field = {1, UPB_SIZE(12, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9526 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 9527 | } |
| 9528 | UPB_INLINE upb_StringView google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_edition(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) { |
| 9529 | upb_StringView default_val = upb_StringView_FromString(""); |
| 9530 | upb_StringView ret; |
Protobuf Team Bot | fa98bb3 | 2023-09-01 18:11:09 +0000 | [diff] [blame] | 9531 | const upb_MiniTableField field = {1, UPB_SIZE(12, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9532 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 9533 | return ret; |
| 9534 | } |
| 9535 | UPB_INLINE bool google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_has_edition(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) { |
Protobuf Team Bot | fa98bb3 | 2023-09-01 18:11:09 +0000 | [diff] [blame] | 9536 | const upb_MiniTableField field = {1, UPB_SIZE(12, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9537 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 9538 | } |
| 9539 | UPB_INLINE void google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_clear_features(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) { |
| 9540 | 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)}; |
| 9541 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 9542 | } |
| 9543 | UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_features(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) { |
| 9544 | const google_protobuf_FeatureSet* default_val = NULL; |
| 9545 | const google_protobuf_FeatureSet* ret; |
| 9546 | 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)}; |
| 9547 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 9548 | return ret; |
| 9549 | } |
| 9550 | UPB_INLINE bool google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_has_features(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) { |
| 9551 | 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)}; |
| 9552 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 9553 | } |
Protobuf Team Bot | fa98bb3 | 2023-09-01 18:11:09 +0000 | [diff] [blame] | 9554 | UPB_INLINE void google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_clear_edition_enum(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) { |
| 9555 | const upb_MiniTableField field = {3, UPB_SIZE(8, 4), 3, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
| 9556 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 9557 | } |
| 9558 | UPB_INLINE int32_t google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_edition_enum(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) { |
| 9559 | int32_t default_val = 0; |
| 9560 | int32_t ret; |
| 9561 | const upb_MiniTableField field = {3, UPB_SIZE(8, 4), 3, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
| 9562 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 9563 | return ret; |
| 9564 | } |
| 9565 | UPB_INLINE bool google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_has_edition_enum(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) { |
| 9566 | const upb_MiniTableField field = {3, UPB_SIZE(8, 4), 3, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
| 9567 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 9568 | } |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9569 | |
| 9570 | UPB_INLINE void google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_set_edition(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault *msg, upb_StringView value) { |
Protobuf Team Bot | fa98bb3 | 2023-09-01 18:11:09 +0000 | [diff] [blame] | 9571 | const upb_MiniTableField field = {1, UPB_SIZE(12, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9572 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 9573 | } |
| 9574 | UPB_INLINE void google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_set_features(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault *msg, google_protobuf_FeatureSet* value) { |
| 9575 | 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)}; |
| 9576 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 9577 | } |
| 9578 | UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_mutable_features(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg, upb_Arena* arena) { |
| 9579 | struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_features(msg); |
| 9580 | if (sub == NULL) { |
| 9581 | sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google_protobuf_FeatureSet_msg_init, arena); |
| 9582 | if (sub) google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_set_features(msg, sub); |
| 9583 | } |
| 9584 | return sub; |
| 9585 | } |
Protobuf Team Bot | fa98bb3 | 2023-09-01 18:11:09 +0000 | [diff] [blame] | 9586 | UPB_INLINE void google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_set_edition_enum(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault *msg, int32_t value) { |
| 9587 | const upb_MiniTableField field = {3, UPB_SIZE(8, 4), 3, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
| 9588 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 9589 | } |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9590 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9591 | /* google.protobuf.SourceCodeInfo */ |
| 9592 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9593 | UPB_INLINE google_protobuf_SourceCodeInfo* google_protobuf_SourceCodeInfo_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9594 | 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] | 9595 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9596 | UPB_INLINE google_protobuf_SourceCodeInfo* google_protobuf_SourceCodeInfo_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 9597 | google_protobuf_SourceCodeInfo* ret = google_protobuf_SourceCodeInfo_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 9598 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9599 | 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] | 9600 | return NULL; |
| 9601 | } |
| 9602 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9603 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9604 | UPB_INLINE google_protobuf_SourceCodeInfo* google_protobuf_SourceCodeInfo_parse_ex(const char* buf, size_t size, |
| 9605 | const upb_ExtensionRegistry* extreg, |
| 9606 | int options, upb_Arena* arena) { |
| 9607 | google_protobuf_SourceCodeInfo* ret = google_protobuf_SourceCodeInfo_new(arena); |
| 9608 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9609 | 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] | 9610 | kUpb_DecodeStatus_Ok) { |
| 9611 | return NULL; |
| 9612 | } |
| 9613 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9614 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9615 | 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] | 9616 | char* ptr; |
| 9617 | (void)upb_Encode(msg, &google_protobuf_SourceCodeInfo_msg_init, 0, arena, &ptr, len); |
| 9618 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9619 | } |
| 9620 | UPB_INLINE char* google_protobuf_SourceCodeInfo_serialize_ex(const google_protobuf_SourceCodeInfo* msg, int options, |
| 9621 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9622 | char* ptr; |
| 9623 | (void)upb_Encode(msg, &google_protobuf_SourceCodeInfo_msg_init, options, arena, &ptr, len); |
| 9624 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9625 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9626 | UPB_INLINE void google_protobuf_SourceCodeInfo_clear_location(google_protobuf_SourceCodeInfo* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9627 | 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] | 9628 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9629 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9630 | 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] | 9631 | 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] | 9632 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 9633 | if (arr) { |
| 9634 | if (size) *size = arr->size; |
| 9635 | return (const google_protobuf_SourceCodeInfo_Location* const*)_upb_array_constptr(arr); |
| 9636 | } else { |
| 9637 | if (size) *size = 0; |
| 9638 | return NULL; |
| 9639 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9640 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 9641 | 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] | 9642 | 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] | 9643 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 9644 | if (size) { |
| 9645 | *size = arr ? arr->size : 0; |
| 9646 | } |
| 9647 | return arr; |
| 9648 | } |
| 9649 | 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] | 9650 | 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] | 9651 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 9652 | (upb_Message*)msg, &field, arena); |
| 9653 | if (size) { |
| 9654 | *size = arr ? arr->size : 0; |
| 9655 | } |
| 9656 | return arr; |
| 9657 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9658 | UPB_INLINE bool google_protobuf_SourceCodeInfo_has_location(const google_protobuf_SourceCodeInfo* msg) { |
| 9659 | size_t size; |
| 9660 | google_protobuf_SourceCodeInfo_location(msg, &size); |
| 9661 | return size != 0; |
| 9662 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9663 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9664 | 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] | 9665 | 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] | 9666 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 9667 | if (arr) { |
| 9668 | if (size) *size = arr->size; |
| 9669 | return (google_protobuf_SourceCodeInfo_Location**)_upb_array_ptr(arr); |
| 9670 | } else { |
| 9671 | if (size) *size = 0; |
| 9672 | return NULL; |
| 9673 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9674 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9675 | 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] | 9676 | 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] | 9677 | return (google_protobuf_SourceCodeInfo_Location**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9678 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9679 | 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] | 9680 | 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] | 9681 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 9682 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 9683 | return NULL; |
| 9684 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9685 | 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] | 9686 | if (!arr || !sub) return NULL; |
| 9687 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9688 | return sub; |
| 9689 | } |
| 9690 | |
| 9691 | /* google.protobuf.SourceCodeInfo.Location */ |
| 9692 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9693 | UPB_INLINE google_protobuf_SourceCodeInfo_Location* google_protobuf_SourceCodeInfo_Location_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9694 | 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] | 9695 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9696 | UPB_INLINE google_protobuf_SourceCodeInfo_Location* google_protobuf_SourceCodeInfo_Location_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 9697 | google_protobuf_SourceCodeInfo_Location* ret = google_protobuf_SourceCodeInfo_Location_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 9698 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9699 | 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] | 9700 | return NULL; |
| 9701 | } |
| 9702 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9703 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9704 | UPB_INLINE google_protobuf_SourceCodeInfo_Location* google_protobuf_SourceCodeInfo_Location_parse_ex(const char* buf, size_t size, |
| 9705 | const upb_ExtensionRegistry* extreg, |
| 9706 | int options, upb_Arena* arena) { |
| 9707 | google_protobuf_SourceCodeInfo_Location* ret = google_protobuf_SourceCodeInfo_Location_new(arena); |
| 9708 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9709 | 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] | 9710 | kUpb_DecodeStatus_Ok) { |
| 9711 | return NULL; |
| 9712 | } |
| 9713 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9714 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9715 | 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] | 9716 | char* ptr; |
| 9717 | (void)upb_Encode(msg, &google_protobuf_SourceCodeInfo_Location_msg_init, 0, arena, &ptr, len); |
| 9718 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9719 | } |
| 9720 | UPB_INLINE char* google_protobuf_SourceCodeInfo_Location_serialize_ex(const google_protobuf_SourceCodeInfo_Location* msg, int options, |
| 9721 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9722 | char* ptr; |
| 9723 | (void)upb_Encode(msg, &google_protobuf_SourceCodeInfo_Location_msg_init, options, arena, &ptr, len); |
| 9724 | return ptr; |
| 9725 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9726 | 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] | 9727 | 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] | 9728 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9729 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9730 | 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] | 9731 | 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] | 9732 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 9733 | if (arr) { |
| 9734 | if (size) *size = arr->size; |
| 9735 | return (int32_t const*)_upb_array_constptr(arr); |
| 9736 | } else { |
| 9737 | if (size) *size = 0; |
| 9738 | return NULL; |
| 9739 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9740 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 9741 | 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] | 9742 | 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] | 9743 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 9744 | if (size) { |
| 9745 | *size = arr ? arr->size : 0; |
| 9746 | } |
| 9747 | return arr; |
| 9748 | } |
| 9749 | 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] | 9750 | 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] | 9751 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 9752 | (upb_Message*)msg, &field, arena); |
| 9753 | if (size) { |
| 9754 | *size = arr ? arr->size : 0; |
| 9755 | } |
| 9756 | return arr; |
| 9757 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9758 | UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_has_path(const google_protobuf_SourceCodeInfo_Location* msg) { |
| 9759 | size_t size; |
| 9760 | google_protobuf_SourceCodeInfo_Location_path(msg, &size); |
| 9761 | return size != 0; |
| 9762 | } |
| 9763 | 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] | 9764 | 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] | 9765 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9766 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9767 | 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] | 9768 | 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] | 9769 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 9770 | if (arr) { |
| 9771 | if (size) *size = arr->size; |
| 9772 | return (int32_t const*)_upb_array_constptr(arr); |
| 9773 | } else { |
| 9774 | if (size) *size = 0; |
| 9775 | return NULL; |
| 9776 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9777 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 9778 | 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] | 9779 | 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] | 9780 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 9781 | if (size) { |
| 9782 | *size = arr ? arr->size : 0; |
| 9783 | } |
| 9784 | return arr; |
| 9785 | } |
| 9786 | 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] | 9787 | 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] | 9788 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 9789 | (upb_Message*)msg, &field, arena); |
| 9790 | if (size) { |
| 9791 | *size = arr ? arr->size : 0; |
| 9792 | } |
| 9793 | return arr; |
| 9794 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9795 | UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_has_span(const google_protobuf_SourceCodeInfo_Location* msg) { |
| 9796 | size_t size; |
| 9797 | google_protobuf_SourceCodeInfo_Location_span(msg, &size); |
| 9798 | return size != 0; |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9799 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9800 | 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] | 9801 | 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] | 9802 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9803 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9804 | 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] | 9805 | upb_StringView default_val = upb_StringView_FromString(""); |
| 9806 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9807 | 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] | 9808 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 9809 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9810 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9811 | 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] | 9812 | 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] | 9813 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9814 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9815 | 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] | 9816 | 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] | 9817 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9818 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9819 | 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] | 9820 | upb_StringView default_val = upb_StringView_FromString(""); |
| 9821 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9822 | 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] | 9823 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 9824 | return ret; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9825 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9826 | 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] | 9827 | 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] | 9828 | return _upb_Message_HasNonExtensionField(msg, &field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9829 | } |
| 9830 | 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] | 9831 | 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] | 9832 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9833 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9834 | 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] | 9835 | 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] | 9836 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 9837 | if (arr) { |
| 9838 | if (size) *size = arr->size; |
| 9839 | return (upb_StringView const*)_upb_array_constptr(arr); |
| 9840 | } else { |
| 9841 | if (size) *size = 0; |
| 9842 | return NULL; |
| 9843 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9844 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 9845 | 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] | 9846 | 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] | 9847 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 9848 | if (size) { |
| 9849 | *size = arr ? arr->size : 0; |
| 9850 | } |
| 9851 | return arr; |
| 9852 | } |
| 9853 | 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] | 9854 | 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] | 9855 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 9856 | (upb_Message*)msg, &field, arena); |
| 9857 | if (size) { |
| 9858 | *size = arr ? arr->size : 0; |
| 9859 | } |
| 9860 | return arr; |
| 9861 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9862 | UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_has_leading_detached_comments(const google_protobuf_SourceCodeInfo_Location* msg) { |
| 9863 | size_t size; |
| 9864 | google_protobuf_SourceCodeInfo_Location_leading_detached_comments(msg, &size); |
| 9865 | return size != 0; |
| 9866 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9867 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9868 | 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] | 9869 | 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] | 9870 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 9871 | if (arr) { |
| 9872 | if (size) *size = arr->size; |
| 9873 | return (int32_t*)_upb_array_ptr(arr); |
| 9874 | } else { |
| 9875 | if (size) *size = 0; |
| 9876 | return NULL; |
| 9877 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9878 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9879 | 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] | 9880 | 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] | 9881 | return (int32_t*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9882 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9883 | 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] | 9884 | 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] | 9885 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 9886 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 9887 | return false; |
| 9888 | } |
| 9889 | _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val)); |
| 9890 | return true; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9891 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9892 | 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] | 9893 | 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] | 9894 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 9895 | if (arr) { |
| 9896 | if (size) *size = arr->size; |
| 9897 | return (int32_t*)_upb_array_ptr(arr); |
| 9898 | } else { |
| 9899 | if (size) *size = 0; |
| 9900 | return NULL; |
| 9901 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9902 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9903 | 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] | 9904 | 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] | 9905 | return (int32_t*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9906 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9907 | 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] | 9908 | 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] | 9909 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 9910 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 9911 | return false; |
| 9912 | } |
| 9913 | _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val)); |
| 9914 | return true; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9915 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9916 | 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] | 9917 | 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] | 9918 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 9919 | } |
| 9920 | 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] | 9921 | 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] | 9922 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 9923 | } |
| 9924 | 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] | 9925 | 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] | 9926 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 9927 | if (arr) { |
| 9928 | if (size) *size = arr->size; |
| 9929 | return (upb_StringView*)_upb_array_ptr(arr); |
| 9930 | } else { |
| 9931 | if (size) *size = 0; |
| 9932 | return NULL; |
| 9933 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9934 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9935 | 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] | 9936 | 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] | 9937 | return (upb_StringView*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9938 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9939 | 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] | 9940 | 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] | 9941 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 9942 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 9943 | return false; |
| 9944 | } |
| 9945 | _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val)); |
| 9946 | return true; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9947 | } |
| 9948 | |
| 9949 | /* google.protobuf.GeneratedCodeInfo */ |
| 9950 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9951 | UPB_INLINE google_protobuf_GeneratedCodeInfo* google_protobuf_GeneratedCodeInfo_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9952 | 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] | 9953 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9954 | UPB_INLINE google_protobuf_GeneratedCodeInfo* google_protobuf_GeneratedCodeInfo_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 9955 | google_protobuf_GeneratedCodeInfo* ret = google_protobuf_GeneratedCodeInfo_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 9956 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9957 | 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] | 9958 | return NULL; |
| 9959 | } |
| 9960 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9961 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9962 | UPB_INLINE google_protobuf_GeneratedCodeInfo* google_protobuf_GeneratedCodeInfo_parse_ex(const char* buf, size_t size, |
| 9963 | const upb_ExtensionRegistry* extreg, |
| 9964 | int options, upb_Arena* arena) { |
| 9965 | google_protobuf_GeneratedCodeInfo* ret = google_protobuf_GeneratedCodeInfo_new(arena); |
| 9966 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9967 | 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] | 9968 | kUpb_DecodeStatus_Ok) { |
| 9969 | return NULL; |
| 9970 | } |
| 9971 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9972 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9973 | 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] | 9974 | char* ptr; |
| 9975 | (void)upb_Encode(msg, &google_protobuf_GeneratedCodeInfo_msg_init, 0, arena, &ptr, len); |
| 9976 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9977 | } |
| 9978 | UPB_INLINE char* google_protobuf_GeneratedCodeInfo_serialize_ex(const google_protobuf_GeneratedCodeInfo* msg, int options, |
| 9979 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9980 | char* ptr; |
| 9981 | (void)upb_Encode(msg, &google_protobuf_GeneratedCodeInfo_msg_init, options, arena, &ptr, len); |
| 9982 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9983 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9984 | UPB_INLINE void google_protobuf_GeneratedCodeInfo_clear_annotation(google_protobuf_GeneratedCodeInfo* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9985 | 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] | 9986 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9987 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9988 | 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] | 9989 | 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] | 9990 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 9991 | if (arr) { |
| 9992 | if (size) *size = arr->size; |
| 9993 | return (const google_protobuf_GeneratedCodeInfo_Annotation* const*)_upb_array_constptr(arr); |
| 9994 | } else { |
| 9995 | if (size) *size = 0; |
| 9996 | return NULL; |
| 9997 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9998 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 9999 | 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] | 10000 | 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] | 10001 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 10002 | if (size) { |
| 10003 | *size = arr ? arr->size : 0; |
| 10004 | } |
| 10005 | return arr; |
| 10006 | } |
| 10007 | 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] | 10008 | 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] | 10009 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 10010 | (upb_Message*)msg, &field, arena); |
| 10011 | if (size) { |
| 10012 | *size = arr ? arr->size : 0; |
| 10013 | } |
| 10014 | return arr; |
| 10015 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10016 | UPB_INLINE bool google_protobuf_GeneratedCodeInfo_has_annotation(const google_protobuf_GeneratedCodeInfo* msg) { |
| 10017 | size_t size; |
| 10018 | google_protobuf_GeneratedCodeInfo_annotation(msg, &size); |
| 10019 | return size != 0; |
| 10020 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10021 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10022 | 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] | 10023 | 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] | 10024 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 10025 | if (arr) { |
| 10026 | if (size) *size = arr->size; |
| 10027 | return (google_protobuf_GeneratedCodeInfo_Annotation**)_upb_array_ptr(arr); |
| 10028 | } else { |
| 10029 | if (size) *size = 0; |
| 10030 | return NULL; |
| 10031 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10032 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10033 | 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] | 10034 | 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] | 10035 | return (google_protobuf_GeneratedCodeInfo_Annotation**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10036 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 10037 | 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] | 10038 | 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] | 10039 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 10040 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 10041 | return NULL; |
| 10042 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10043 | 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] | 10044 | if (!arr || !sub) return NULL; |
| 10045 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10046 | return sub; |
| 10047 | } |
| 10048 | |
| 10049 | /* google.protobuf.GeneratedCodeInfo.Annotation */ |
| 10050 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10051 | UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation* google_protobuf_GeneratedCodeInfo_Annotation_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10052 | 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] | 10053 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10054 | UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation* google_protobuf_GeneratedCodeInfo_Annotation_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 10055 | google_protobuf_GeneratedCodeInfo_Annotation* ret = google_protobuf_GeneratedCodeInfo_Annotation_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 10056 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10057 | 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] | 10058 | return NULL; |
| 10059 | } |
| 10060 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10061 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10062 | UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation* google_protobuf_GeneratedCodeInfo_Annotation_parse_ex(const char* buf, size_t size, |
| 10063 | const upb_ExtensionRegistry* extreg, |
| 10064 | int options, upb_Arena* arena) { |
| 10065 | google_protobuf_GeneratedCodeInfo_Annotation* ret = google_protobuf_GeneratedCodeInfo_Annotation_new(arena); |
| 10066 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10067 | 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] | 10068 | kUpb_DecodeStatus_Ok) { |
| 10069 | return NULL; |
| 10070 | } |
| 10071 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10072 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10073 | 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] | 10074 | char* ptr; |
| 10075 | (void)upb_Encode(msg, &google_protobuf_GeneratedCodeInfo_Annotation_msg_init, 0, arena, &ptr, len); |
| 10076 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10077 | } |
| 10078 | UPB_INLINE char* google_protobuf_GeneratedCodeInfo_Annotation_serialize_ex(const google_protobuf_GeneratedCodeInfo_Annotation* msg, int options, |
| 10079 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10080 | char* ptr; |
| 10081 | (void)upb_Encode(msg, &google_protobuf_GeneratedCodeInfo_Annotation_msg_init, options, arena, &ptr, len); |
| 10082 | return ptr; |
| 10083 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10084 | 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] | 10085 | 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] | 10086 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10087 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10088 | 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] | 10089 | 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] | 10090 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 10091 | if (arr) { |
| 10092 | if (size) *size = arr->size; |
| 10093 | return (int32_t const*)_upb_array_constptr(arr); |
| 10094 | } else { |
| 10095 | if (size) *size = 0; |
| 10096 | return NULL; |
| 10097 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 10098 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 10099 | 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] | 10100 | 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] | 10101 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 10102 | if (size) { |
| 10103 | *size = arr ? arr->size : 0; |
| 10104 | } |
| 10105 | return arr; |
| 10106 | } |
| 10107 | 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] | 10108 | 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] | 10109 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 10110 | (upb_Message*)msg, &field, arena); |
| 10111 | if (size) { |
| 10112 | *size = arr ? arr->size : 0; |
| 10113 | } |
| 10114 | return arr; |
| 10115 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10116 | UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_path(const google_protobuf_GeneratedCodeInfo_Annotation* msg) { |
| 10117 | size_t size; |
| 10118 | google_protobuf_GeneratedCodeInfo_Annotation_path(msg, &size); |
| 10119 | return size != 0; |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 10120 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10121 | 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] | 10122 | 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] | 10123 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10124 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10125 | 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] | 10126 | upb_StringView default_val = upb_StringView_FromString(""); |
| 10127 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10128 | 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] | 10129 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10130 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10131 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10132 | 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] | 10133 | 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] | 10134 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 10135 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10136 | 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] | 10137 | 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] | 10138 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10139 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10140 | 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] | 10141 | int32_t default_val = (int32_t)0; |
| 10142 | int32_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10143 | 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] | 10144 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10145 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10146 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10147 | 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] | 10148 | 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] | 10149 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 10150 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10151 | 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] | 10152 | 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] | 10153 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10154 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10155 | 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] | 10156 | int32_t default_val = (int32_t)0; |
| 10157 | int32_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10158 | 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] | 10159 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10160 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10161 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10162 | 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] | 10163 | 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] | 10164 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10165 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10166 | 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] | 10167 | 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] | 10168 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10169 | } |
| 10170 | 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] | 10171 | int32_t default_val = 0; |
| 10172 | int32_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10173 | 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] | 10174 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10175 | return ret; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10176 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10177 | 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] | 10178 | 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] | 10179 | return _upb_Message_HasNonExtensionField(msg, &field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10180 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10181 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10182 | 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] | 10183 | 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] | 10184 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 10185 | if (arr) { |
| 10186 | if (size) *size = arr->size; |
| 10187 | return (int32_t*)_upb_array_ptr(arr); |
| 10188 | } else { |
| 10189 | if (size) *size = 0; |
| 10190 | return NULL; |
| 10191 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10192 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10193 | 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] | 10194 | 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] | 10195 | return (int32_t*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10196 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 10197 | 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] | 10198 | 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] | 10199 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 10200 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 10201 | return false; |
| 10202 | } |
| 10203 | _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val)); |
| 10204 | return true; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10205 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10206 | 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] | 10207 | 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] | 10208 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 10209 | } |
| 10210 | 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] | 10211 | 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] | 10212 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 10213 | } |
| 10214 | 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] | 10215 | 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] | 10216 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 10217 | } |
| 10218 | 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] | 10219 | 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] | 10220 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10221 | } |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 10222 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10223 | extern const upb_MiniTableFile google_protobuf_descriptor_proto_upb_file_layout; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10224 | |
| 10225 | /* Max size 32 is google.protobuf.FileOptions */ |
| 10226 | /* Max size 64 is google.protobuf.FileOptions */ |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 10227 | #define _UPB_MAXOPT_SIZE UPB_SIZE(112, 200) |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10228 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10229 | #ifdef __cplusplus |
| 10230 | } /* extern "C" */ |
| 10231 | #endif |
| 10232 | |
| 10233 | |
| 10234 | #endif /* GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_H_ */ |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 10235 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10236 | #ifndef UPB_WIRE_EPS_COPY_INPUT_STREAM_H_ |
| 10237 | #define UPB_WIRE_EPS_COPY_INPUT_STREAM_H_ |
| 10238 | |
| 10239 | #include <string.h> |
| 10240 | |
| 10241 | |
| 10242 | // Must be last. |
| 10243 | |
| 10244 | #ifdef __cplusplus |
| 10245 | extern "C" { |
| 10246 | #endif |
| 10247 | |
| 10248 | // The maximum number of bytes a single protobuf field can take up in the |
| 10249 | // wire format. We only want to do one bounds check per field, so the input |
| 10250 | // stream guarantees that after upb_EpsCopyInputStream_IsDone() is called, |
| 10251 | // the decoder can read this many bytes without performing another bounds |
| 10252 | // check. The stream will copy into a patch buffer as necessary to guarantee |
| 10253 | // this invariant. |
| 10254 | #define kUpb_EpsCopyInputStream_SlopBytes 16 |
| 10255 | |
| 10256 | enum { |
| 10257 | kUpb_EpsCopyInputStream_NoAliasing = 0, |
| 10258 | kUpb_EpsCopyInputStream_OnPatch = 1, |
| 10259 | kUpb_EpsCopyInputStream_NoDelta = 2 |
| 10260 | }; |
| 10261 | |
| 10262 | typedef struct { |
| 10263 | const char* end; // Can read up to SlopBytes bytes beyond this. |
| 10264 | const char* limit_ptr; // For bounds checks, = end + UPB_MIN(limit, 0) |
| 10265 | uintptr_t aliasing; |
| 10266 | int limit; // Submessage limit relative to end |
| 10267 | bool error; // To distinguish between EOF and error. |
| 10268 | char patch[kUpb_EpsCopyInputStream_SlopBytes * 2]; |
| 10269 | } upb_EpsCopyInputStream; |
| 10270 | |
| 10271 | // Returns true if the stream is in the error state. A stream enters the error |
| 10272 | // state when the user reads past a limit (caught in IsDone()) or the |
| 10273 | // ZeroCopyInputStream returns an error. |
| 10274 | UPB_INLINE bool upb_EpsCopyInputStream_IsError(upb_EpsCopyInputStream* e) { |
| 10275 | return e->error; |
| 10276 | } |
| 10277 | |
| 10278 | typedef const char* upb_EpsCopyInputStream_BufferFlipCallback( |
| 10279 | upb_EpsCopyInputStream* e, const char* old_end, const char* new_start); |
| 10280 | |
| 10281 | typedef const char* upb_EpsCopyInputStream_IsDoneFallbackFunc( |
| 10282 | upb_EpsCopyInputStream* e, const char* ptr, int overrun); |
| 10283 | |
| 10284 | // Initializes a upb_EpsCopyInputStream using the contents of the buffer |
| 10285 | // [*ptr, size]. Updates `*ptr` as necessary to guarantee that at least |
| 10286 | // kUpb_EpsCopyInputStream_SlopBytes are available to read. |
| 10287 | UPB_INLINE void upb_EpsCopyInputStream_Init(upb_EpsCopyInputStream* e, |
| 10288 | const char** ptr, size_t size, |
| 10289 | bool enable_aliasing) { |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10290 | if (size <= kUpb_EpsCopyInputStream_SlopBytes) { |
| 10291 | memset(&e->patch, 0, 32); |
| 10292 | if (size) memcpy(&e->patch, *ptr, size); |
| 10293 | e->aliasing = enable_aliasing ? (uintptr_t)*ptr - (uintptr_t)e->patch |
| 10294 | : kUpb_EpsCopyInputStream_NoAliasing; |
| 10295 | *ptr = e->patch; |
| 10296 | e->end = *ptr + size; |
| 10297 | e->limit = 0; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10298 | } else { |
| 10299 | e->end = *ptr + size - kUpb_EpsCopyInputStream_SlopBytes; |
| 10300 | e->limit = kUpb_EpsCopyInputStream_SlopBytes; |
| 10301 | e->aliasing = enable_aliasing ? kUpb_EpsCopyInputStream_NoDelta |
| 10302 | : kUpb_EpsCopyInputStream_NoAliasing; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10303 | } |
| 10304 | e->limit_ptr = e->end; |
| 10305 | e->error = false; |
| 10306 | } |
| 10307 | |
| 10308 | typedef enum { |
| 10309 | // The current stream position is at a limit. |
| 10310 | kUpb_IsDoneStatus_Done, |
| 10311 | |
| 10312 | // The current stream position is not at a limit. |
| 10313 | kUpb_IsDoneStatus_NotDone, |
| 10314 | |
| 10315 | // The current stream position is not at a limit, and the stream needs to |
| 10316 | // be flipped to a new buffer before more data can be read. |
| 10317 | kUpb_IsDoneStatus_NeedFallback, |
| 10318 | } upb_IsDoneStatus; |
| 10319 | |
| 10320 | // Returns the status of the current stream position. This is a low-level |
| 10321 | // function, it is simpler to call upb_EpsCopyInputStream_IsDone() if possible. |
| 10322 | UPB_INLINE upb_IsDoneStatus upb_EpsCopyInputStream_IsDoneStatus( |
| 10323 | upb_EpsCopyInputStream* e, const char* ptr, int* overrun) { |
| 10324 | *overrun = ptr - e->end; |
| 10325 | if (UPB_LIKELY(ptr < e->limit_ptr)) { |
| 10326 | return kUpb_IsDoneStatus_NotDone; |
| 10327 | } else if (UPB_LIKELY(*overrun == e->limit)) { |
| 10328 | return kUpb_IsDoneStatus_Done; |
| 10329 | } else { |
| 10330 | return kUpb_IsDoneStatus_NeedFallback; |
| 10331 | } |
| 10332 | } |
| 10333 | |
| 10334 | // Returns true if the stream has hit a limit, either the current delimited |
| 10335 | // limit or the overall end-of-stream. As a side effect, this function may flip |
| 10336 | // the pointer to a new buffer if there are less than |
| 10337 | // kUpb_EpsCopyInputStream_SlopBytes of data to be read in the current buffer. |
| 10338 | // |
| 10339 | // Postcondition: if the function returns false, there are at least |
| 10340 | // kUpb_EpsCopyInputStream_SlopBytes of data available to read at *ptr. |
| 10341 | UPB_INLINE bool upb_EpsCopyInputStream_IsDoneWithCallback( |
| 10342 | upb_EpsCopyInputStream* e, const char** ptr, |
| 10343 | upb_EpsCopyInputStream_IsDoneFallbackFunc* func) { |
| 10344 | int overrun; |
| 10345 | switch (upb_EpsCopyInputStream_IsDoneStatus(e, *ptr, &overrun)) { |
| 10346 | case kUpb_IsDoneStatus_Done: |
| 10347 | return true; |
| 10348 | case kUpb_IsDoneStatus_NotDone: |
| 10349 | return false; |
| 10350 | case kUpb_IsDoneStatus_NeedFallback: |
| 10351 | *ptr = func(e, *ptr, overrun); |
| 10352 | return *ptr == NULL; |
| 10353 | } |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 10354 | UPB_UNREACHABLE(); |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10355 | } |
| 10356 | |
| 10357 | const char* _upb_EpsCopyInputStream_IsDoneFallbackNoCallback( |
| 10358 | upb_EpsCopyInputStream* e, const char* ptr, int overrun); |
| 10359 | |
| 10360 | // A simpler version of IsDoneWithCallback() that does not support a buffer flip |
| 10361 | // callback. Useful in cases where we do not need to insert custom logic at |
| 10362 | // every buffer flip. |
| 10363 | // |
| 10364 | // If this returns true, the user must call upb_EpsCopyInputStream_IsError() |
| 10365 | // to distinguish between EOF and error. |
| 10366 | UPB_INLINE bool upb_EpsCopyInputStream_IsDone(upb_EpsCopyInputStream* e, |
| 10367 | const char** ptr) { |
| 10368 | return upb_EpsCopyInputStream_IsDoneWithCallback( |
| 10369 | e, ptr, _upb_EpsCopyInputStream_IsDoneFallbackNoCallback); |
| 10370 | } |
| 10371 | |
| 10372 | // Returns the total number of bytes that are safe to read from the current |
| 10373 | // buffer without reading uninitialized or unallocated memory. |
| 10374 | // |
| 10375 | // Note that this check does not respect any semantic limits on the stream, |
| 10376 | // either limits from PushLimit() or the overall stream end, so some of these |
| 10377 | // bytes may have unpredictable, nonsense values in them. The guarantee is only |
| 10378 | // that the bytes are valid to read from the perspective of the C language |
| 10379 | // (ie. you can read without triggering UBSAN or ASAN). |
| 10380 | UPB_INLINE size_t upb_EpsCopyInputStream_BytesAvailable( |
| 10381 | upb_EpsCopyInputStream* e, const char* ptr) { |
| 10382 | return (e->end - ptr) + kUpb_EpsCopyInputStream_SlopBytes; |
| 10383 | } |
| 10384 | |
| 10385 | // Returns true if the given delimited field size is valid (it does not extend |
| 10386 | // beyond any previously-pushed limits). `ptr` should point to the beginning |
| 10387 | // of the field data, after the delimited size. |
| 10388 | // |
| 10389 | // Note that this does *not* guarantee that all of the data for this field is in |
| 10390 | // the current buffer. |
| 10391 | UPB_INLINE bool upb_EpsCopyInputStream_CheckSize( |
| 10392 | const upb_EpsCopyInputStream* e, const char* ptr, int size) { |
| 10393 | UPB_ASSERT(size >= 0); |
| 10394 | return ptr - e->end + size <= e->limit; |
| 10395 | } |
| 10396 | |
| 10397 | UPB_INLINE bool _upb_EpsCopyInputStream_CheckSizeAvailable( |
| 10398 | upb_EpsCopyInputStream* e, const char* ptr, int size, bool submessage) { |
| 10399 | // This is one extra branch compared to the more normal: |
| 10400 | // return (size_t)(end - ptr) < size; |
| 10401 | // However it is one less computation if we are just about to use "ptr + len": |
| 10402 | // https://godbolt.org/z/35YGPz |
| 10403 | // In microbenchmarks this shows a small improvement. |
| 10404 | uintptr_t uptr = (uintptr_t)ptr; |
| 10405 | uintptr_t uend = (uintptr_t)e->limit_ptr; |
| 10406 | uintptr_t res = uptr + (size_t)size; |
| 10407 | if (!submessage) uend += kUpb_EpsCopyInputStream_SlopBytes; |
| 10408 | // NOTE: this check depends on having a linear address space. This is not |
| 10409 | // technically guaranteed by uintptr_t. |
| 10410 | bool ret = res >= uptr && res <= uend; |
| 10411 | if (size < 0) UPB_ASSERT(!ret); |
| 10412 | return ret; |
| 10413 | } |
| 10414 | |
| 10415 | // Returns true if the given delimited field size is valid (it does not extend |
| 10416 | // beyond any previously-pushed limited) *and* all of the data for this field is |
| 10417 | // available to be read in the current buffer. |
| 10418 | // |
| 10419 | // If the size is negative, this function will always return false. This |
| 10420 | // property can be useful in some cases. |
| 10421 | UPB_INLINE bool upb_EpsCopyInputStream_CheckDataSizeAvailable( |
| 10422 | upb_EpsCopyInputStream* e, const char* ptr, int size) { |
| 10423 | return _upb_EpsCopyInputStream_CheckSizeAvailable(e, ptr, size, false); |
| 10424 | } |
| 10425 | |
| 10426 | // Returns true if the given sub-message size is valid (it does not extend |
| 10427 | // beyond any previously-pushed limited) *and* all of the data for this |
| 10428 | // sub-message is available to be parsed in the current buffer. |
| 10429 | // |
| 10430 | // This implies that all fields from the sub-message can be parsed from the |
| 10431 | // current buffer while maintaining the invariant that we always have at least |
| 10432 | // kUpb_EpsCopyInputStream_SlopBytes of data available past the beginning of |
| 10433 | // any individual field start. |
| 10434 | // |
| 10435 | // If the size is negative, this function will always return false. This |
| 10436 | // property can be useful in some cases. |
| 10437 | UPB_INLINE bool upb_EpsCopyInputStream_CheckSubMessageSizeAvailable( |
| 10438 | upb_EpsCopyInputStream* e, const char* ptr, int size) { |
| 10439 | return _upb_EpsCopyInputStream_CheckSizeAvailable(e, ptr, size, true); |
| 10440 | } |
| 10441 | |
| 10442 | // Returns true if aliasing_enabled=true was passed to |
| 10443 | // upb_EpsCopyInputStream_Init() when this stream was initialized. |
| 10444 | UPB_INLINE bool upb_EpsCopyInputStream_AliasingEnabled( |
| 10445 | upb_EpsCopyInputStream* e) { |
| 10446 | return e->aliasing != kUpb_EpsCopyInputStream_NoAliasing; |
| 10447 | } |
| 10448 | |
| 10449 | // Returns true if aliasing_enabled=true was passed to |
| 10450 | // upb_EpsCopyInputStream_Init() when this stream was initialized *and* we can |
| 10451 | // alias into the region [ptr, size] in an input buffer. |
| 10452 | UPB_INLINE bool upb_EpsCopyInputStream_AliasingAvailable( |
| 10453 | upb_EpsCopyInputStream* e, const char* ptr, size_t size) { |
| 10454 | // When EpsCopyInputStream supports streaming, this will need to become a |
| 10455 | // runtime check. |
| 10456 | return upb_EpsCopyInputStream_CheckDataSizeAvailable(e, ptr, size) && |
| 10457 | e->aliasing >= kUpb_EpsCopyInputStream_NoDelta; |
| 10458 | } |
| 10459 | |
| 10460 | // Returns a pointer into an input buffer that corresponds to the parsing |
| 10461 | // pointer `ptr`. The returned pointer may be the same as `ptr`, but also may |
| 10462 | // be different if we are currently parsing out of the patch buffer. |
| 10463 | // |
| 10464 | // REQUIRES: Aliasing must be available for the given pointer. If the input is a |
| 10465 | // flat buffer and aliasing is enabled, then aliasing will always be available. |
| 10466 | UPB_INLINE const char* upb_EpsCopyInputStream_GetAliasedPtr( |
| 10467 | upb_EpsCopyInputStream* e, const char* ptr) { |
| 10468 | UPB_ASSUME(upb_EpsCopyInputStream_AliasingAvailable(e, ptr, 0)); |
| 10469 | uintptr_t delta = |
| 10470 | e->aliasing == kUpb_EpsCopyInputStream_NoDelta ? 0 : e->aliasing; |
| 10471 | return (const char*)((uintptr_t)ptr + delta); |
| 10472 | } |
| 10473 | |
| 10474 | // Reads string data from the input, aliasing into the input buffer instead of |
| 10475 | // copying. The parsing pointer is passed in `*ptr`, and will be updated if |
| 10476 | // necessary to point to the actual input buffer. Returns the new parsing |
| 10477 | // pointer, which will be advanced past the string data. |
| 10478 | // |
| 10479 | // REQUIRES: Aliasing must be available for this data region (test with |
| 10480 | // upb_EpsCopyInputStream_AliasingAvailable(). |
| 10481 | UPB_INLINE const char* upb_EpsCopyInputStream_ReadStringAliased( |
| 10482 | upb_EpsCopyInputStream* e, const char** ptr, size_t size) { |
| 10483 | UPB_ASSUME(upb_EpsCopyInputStream_AliasingAvailable(e, *ptr, size)); |
| 10484 | const char* ret = *ptr + size; |
| 10485 | *ptr = upb_EpsCopyInputStream_GetAliasedPtr(e, *ptr); |
| 10486 | UPB_ASSUME(ret != NULL); |
| 10487 | return ret; |
| 10488 | } |
| 10489 | |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 10490 | // Skips `size` bytes of data from the input and returns a pointer past the end. |
| 10491 | // Returns NULL on end of stream or error. |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10492 | UPB_INLINE const char* upb_EpsCopyInputStream_Skip(upb_EpsCopyInputStream* e, |
| 10493 | const char* ptr, int size) { |
| 10494 | if (!upb_EpsCopyInputStream_CheckDataSizeAvailable(e, ptr, size)) return NULL; |
| 10495 | return ptr + size; |
| 10496 | } |
| 10497 | |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 10498 | // Copies `size` bytes of data from the input `ptr` into the buffer `to`, and |
| 10499 | // returns a pointer past the end. Returns NULL on end of stream or error. |
| 10500 | UPB_INLINE const char* upb_EpsCopyInputStream_Copy(upb_EpsCopyInputStream* e, |
| 10501 | const char* ptr, void* to, |
| 10502 | int size) { |
| 10503 | if (!upb_EpsCopyInputStream_CheckDataSizeAvailable(e, ptr, size)) return NULL; |
| 10504 | memcpy(to, ptr, size); |
| 10505 | return ptr + size; |
| 10506 | } |
| 10507 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10508 | // Reads string data from the stream and advances the pointer accordingly. |
| 10509 | // If aliasing was enabled when the stream was initialized, then the returned |
| 10510 | // pointer will point into the input buffer if possible, otherwise new data |
| 10511 | // will be allocated from arena and copied into. We may be forced to copy even |
| 10512 | // if aliasing was enabled if the input data spans input buffers. |
| 10513 | // |
| 10514 | // Returns NULL if memory allocation failed, or we reached a premature EOF. |
| 10515 | UPB_INLINE const char* upb_EpsCopyInputStream_ReadString( |
| 10516 | upb_EpsCopyInputStream* e, const char** ptr, size_t size, |
| 10517 | upb_Arena* arena) { |
| 10518 | if (upb_EpsCopyInputStream_AliasingAvailable(e, *ptr, size)) { |
| 10519 | return upb_EpsCopyInputStream_ReadStringAliased(e, ptr, size); |
| 10520 | } else { |
| 10521 | // We need to allocate and copy. |
| 10522 | if (!upb_EpsCopyInputStream_CheckDataSizeAvailable(e, *ptr, size)) { |
| 10523 | return NULL; |
| 10524 | } |
| 10525 | UPB_ASSERT(arena); |
| 10526 | char* data = (char*)upb_Arena_Malloc(arena, size); |
| 10527 | if (!data) return NULL; |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 10528 | const char* ret = upb_EpsCopyInputStream_Copy(e, *ptr, data, size); |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10529 | *ptr = data; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10530 | return ret; |
| 10531 | } |
| 10532 | } |
| 10533 | |
| 10534 | UPB_INLINE void _upb_EpsCopyInputStream_CheckLimit(upb_EpsCopyInputStream* e) { |
| 10535 | UPB_ASSERT(e->limit_ptr == e->end + UPB_MIN(0, e->limit)); |
| 10536 | } |
| 10537 | |
| 10538 | // Pushes a limit onto the stack of limits for the current stream. The limit |
| 10539 | // will extend for `size` bytes beyond the position in `ptr`. Future calls to |
| 10540 | // upb_EpsCopyInputStream_IsDone() will return `true` when the stream position |
| 10541 | // reaches this limit. |
| 10542 | // |
| 10543 | // Returns a delta that the caller must store and supply to PopLimit() below. |
| 10544 | UPB_INLINE int upb_EpsCopyInputStream_PushLimit(upb_EpsCopyInputStream* e, |
| 10545 | const char* ptr, int size) { |
| 10546 | int limit = size + (int)(ptr - e->end); |
| 10547 | int delta = e->limit - limit; |
| 10548 | _upb_EpsCopyInputStream_CheckLimit(e); |
Deanna Garcia | 59cfc2f | 2023-01-31 13:19:28 -0800 | [diff] [blame] | 10549 | UPB_ASSERT(limit <= e->limit); |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10550 | e->limit = limit; |
| 10551 | e->limit_ptr = e->end + UPB_MIN(0, limit); |
| 10552 | _upb_EpsCopyInputStream_CheckLimit(e); |
| 10553 | return delta; |
| 10554 | } |
| 10555 | |
| 10556 | // Pops the last limit that was pushed on this stream. This may only be called |
| 10557 | // once IsDone() returns true. The user must pass the delta that was returned |
| 10558 | // from PushLimit(). |
| 10559 | UPB_INLINE void upb_EpsCopyInputStream_PopLimit(upb_EpsCopyInputStream* e, |
| 10560 | const char* ptr, |
| 10561 | int saved_delta) { |
| 10562 | UPB_ASSERT(ptr - e->end == e->limit); |
| 10563 | _upb_EpsCopyInputStream_CheckLimit(e); |
| 10564 | e->limit += saved_delta; |
| 10565 | e->limit_ptr = e->end + UPB_MIN(0, e->limit); |
| 10566 | _upb_EpsCopyInputStream_CheckLimit(e); |
| 10567 | } |
| 10568 | |
| 10569 | UPB_INLINE const char* _upb_EpsCopyInputStream_IsDoneFallbackInline( |
| 10570 | upb_EpsCopyInputStream* e, const char* ptr, int overrun, |
| 10571 | upb_EpsCopyInputStream_BufferFlipCallback* callback) { |
| 10572 | if (overrun < e->limit) { |
| 10573 | // Need to copy remaining data into patch buffer. |
| 10574 | UPB_ASSERT(overrun < kUpb_EpsCopyInputStream_SlopBytes); |
| 10575 | const char* old_end = ptr; |
| 10576 | const char* new_start = &e->patch[0] + overrun; |
| 10577 | memset(e->patch + kUpb_EpsCopyInputStream_SlopBytes, 0, |
| 10578 | kUpb_EpsCopyInputStream_SlopBytes); |
| 10579 | memcpy(e->patch, e->end, kUpb_EpsCopyInputStream_SlopBytes); |
| 10580 | ptr = new_start; |
| 10581 | e->end = &e->patch[kUpb_EpsCopyInputStream_SlopBytes]; |
| 10582 | e->limit -= kUpb_EpsCopyInputStream_SlopBytes; |
| 10583 | e->limit_ptr = e->end + e->limit; |
| 10584 | UPB_ASSERT(ptr < e->limit_ptr); |
| 10585 | if (e->aliasing != kUpb_EpsCopyInputStream_NoAliasing) { |
| 10586 | e->aliasing = (uintptr_t)old_end - (uintptr_t)new_start; |
| 10587 | } |
| 10588 | return callback(e, old_end, new_start); |
| 10589 | } else { |
| 10590 | UPB_ASSERT(overrun > e->limit); |
| 10591 | e->error = true; |
| 10592 | return callback(e, NULL, NULL); |
| 10593 | } |
| 10594 | } |
| 10595 | |
| 10596 | typedef const char* upb_EpsCopyInputStream_ParseDelimitedFunc( |
| 10597 | upb_EpsCopyInputStream* e, const char* ptr, void* ctx); |
| 10598 | |
| 10599 | // Tries to perform a fast-path handling of the given delimited message data. |
| 10600 | // If the sub-message beginning at `*ptr` and extending for `len` is short and |
| 10601 | // fits within this buffer, calls `func` with `ctx` as a parameter, where the |
| 10602 | // pushing and popping of limits is handled automatically and with lower cost |
| 10603 | // than the normal PushLimit()/PopLimit() sequence. |
| 10604 | static UPB_FORCEINLINE bool upb_EpsCopyInputStream_TryParseDelimitedFast( |
| 10605 | upb_EpsCopyInputStream* e, const char** ptr, int len, |
| 10606 | upb_EpsCopyInputStream_ParseDelimitedFunc* func, void* ctx) { |
| 10607 | if (!upb_EpsCopyInputStream_CheckSubMessageSizeAvailable(e, *ptr, len)) { |
| 10608 | return false; |
| 10609 | } |
| 10610 | |
| 10611 | // Fast case: Sub-message is <128 bytes and fits in the current buffer. |
| 10612 | // This means we can preserve limit/limit_ptr verbatim. |
| 10613 | const char* saved_limit_ptr = e->limit_ptr; |
| 10614 | int saved_limit = e->limit; |
| 10615 | e->limit_ptr = *ptr + len; |
| 10616 | e->limit = e->limit_ptr - e->end; |
| 10617 | UPB_ASSERT(e->limit_ptr == e->end + UPB_MIN(0, e->limit)); |
| 10618 | *ptr = func(e, *ptr, ctx); |
| 10619 | e->limit_ptr = saved_limit_ptr; |
| 10620 | e->limit = saved_limit; |
| 10621 | UPB_ASSERT(e->limit_ptr == e->end + UPB_MIN(0, e->limit)); |
| 10622 | return true; |
| 10623 | } |
| 10624 | |
| 10625 | #ifdef __cplusplus |
| 10626 | } /* extern "C" */ |
| 10627 | #endif |
| 10628 | |
| 10629 | |
| 10630 | #endif // UPB_WIRE_EPS_COPY_INPUT_STREAM_H_ |
| 10631 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10632 | #ifndef UPB_HASH_INT_TABLE_H_ |
| 10633 | #define UPB_HASH_INT_TABLE_H_ |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10634 | |
| 10635 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10636 | // Must be last. |
| 10637 | |
| 10638 | typedef struct { |
| 10639 | upb_table t; // For entries that don't fit in the array part. |
| 10640 | const upb_tabval* array; // Array part of the table. See const note above. |
| 10641 | size_t array_size; // Array part size. |
| 10642 | size_t array_count; // Array part number of elements. |
| 10643 | } upb_inttable; |
| 10644 | |
| 10645 | #ifdef __cplusplus |
| 10646 | extern "C" { |
| 10647 | #endif |
| 10648 | |
| 10649 | // Initialize a table. If memory allocation failed, false is returned and |
| 10650 | // the table is uninitialized. |
| 10651 | bool upb_inttable_init(upb_inttable* table, upb_Arena* a); |
| 10652 | |
| 10653 | // Returns the number of values in the table. |
| 10654 | size_t upb_inttable_count(const upb_inttable* t); |
| 10655 | |
| 10656 | // Inserts the given key into the hashtable with the given value. |
| 10657 | // The key must not already exist in the hash table. |
| 10658 | // The value must not be UINTPTR_MAX. |
| 10659 | // |
| 10660 | // If a table resize was required but memory allocation failed, false is |
| 10661 | // returned and the table is unchanged. |
| 10662 | bool upb_inttable_insert(upb_inttable* t, uintptr_t key, upb_value val, |
| 10663 | upb_Arena* a); |
| 10664 | |
| 10665 | // Looks up key in this table, returning "true" if the key was found. |
| 10666 | // If v is non-NULL, copies the value for this key into *v. |
| 10667 | bool upb_inttable_lookup(const upb_inttable* t, uintptr_t key, upb_value* v); |
| 10668 | |
| 10669 | // Removes an item from the table. Returns true if the remove was successful, |
| 10670 | // and stores the removed item in *val if non-NULL. |
| 10671 | bool upb_inttable_remove(upb_inttable* t, uintptr_t key, upb_value* val); |
| 10672 | |
| 10673 | // Updates an existing entry in an inttable. |
| 10674 | // If the entry does not exist, returns false and does nothing. |
| 10675 | // Unlike insert/remove, this does not invalidate iterators. |
| 10676 | bool upb_inttable_replace(upb_inttable* t, uintptr_t key, upb_value val); |
| 10677 | |
| 10678 | // Optimizes the table for the current set of entries, for both memory use and |
| 10679 | // lookup time. Client should call this after all entries have been inserted; |
| 10680 | // inserting more entries is legal, but will likely require a table resize. |
| 10681 | void upb_inttable_compact(upb_inttable* t, upb_Arena* a); |
| 10682 | |
| 10683 | // Iteration over inttable: |
| 10684 | // |
| 10685 | // intptr_t iter = UPB_INTTABLE_BEGIN; |
| 10686 | // uintptr_t key; |
| 10687 | // upb_value val; |
| 10688 | // while (upb_inttable_next(t, &key, &val, &iter)) { |
| 10689 | // // ... |
| 10690 | // } |
| 10691 | |
| 10692 | #define UPB_INTTABLE_BEGIN -1 |
| 10693 | |
| 10694 | bool upb_inttable_next(const upb_inttable* t, uintptr_t* key, upb_value* val, |
| 10695 | intptr_t* iter); |
| 10696 | void upb_inttable_removeiter(upb_inttable* t, intptr_t* iter); |
| 10697 | |
| 10698 | #ifdef __cplusplus |
| 10699 | } /* extern "C" */ |
| 10700 | #endif |
| 10701 | |
| 10702 | |
| 10703 | #endif /* UPB_HASH_INT_TABLE_H_ */ |
| 10704 | |
| 10705 | #ifndef UPB_JSON_DECODE_H_ |
| 10706 | #define UPB_JSON_DECODE_H_ |
| 10707 | |
| 10708 | |
| 10709 | #ifndef UPB_REFLECTION_DEF_H_ |
| 10710 | #define UPB_REFLECTION_DEF_H_ |
| 10711 | |
| 10712 | |
| 10713 | // IWYU pragma: private, include "upb/reflection/def.h" |
| 10714 | |
| 10715 | #ifndef UPB_REFLECTION_DEF_POOL_H_ |
| 10716 | #define UPB_REFLECTION_DEF_POOL_H_ |
| 10717 | |
| 10718 | |
| 10719 | // IWYU pragma: private, include "upb/reflection/def.h" |
| 10720 | |
| 10721 | // Declarations common to all public def types. |
| 10722 | |
| 10723 | #ifndef UPB_REFLECTION_COMMON_H_ |
| 10724 | #define UPB_REFLECTION_COMMON_H_ |
| 10725 | |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 10726 | // begin:google_only |
| 10727 | // #ifndef UPB_BOOTSTRAP_STAGE0 |
| 10728 | // #include "net/proto2/proto/descriptor.upb.h" |
| 10729 | // #else |
| 10730 | // #include "google/protobuf/descriptor.upb.h" |
| 10731 | // #endif |
| 10732 | // end:google_only |
| 10733 | |
| 10734 | // begin:github_only |
| 10735 | // end:github_only |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10736 | |
Protobuf Team Bot | 7dabac9 | 2023-09-07 18:35:50 +0000 | [diff] [blame] | 10737 | typedef enum { |
| 10738 | kUpb_Syntax_Proto2 = 2, |
| 10739 | kUpb_Syntax_Proto3 = 3, |
| 10740 | kUpb_Syntax_Editions = 99 |
| 10741 | } upb_Syntax; |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10742 | |
| 10743 | // Forward declarations for circular references. |
| 10744 | typedef struct upb_DefPool upb_DefPool; |
| 10745 | typedef struct upb_EnumDef upb_EnumDef; |
| 10746 | typedef struct upb_EnumReservedRange upb_EnumReservedRange; |
| 10747 | typedef struct upb_EnumValueDef upb_EnumValueDef; |
| 10748 | typedef struct upb_ExtensionRange upb_ExtensionRange; |
| 10749 | typedef struct upb_FieldDef upb_FieldDef; |
| 10750 | typedef struct upb_FileDef upb_FileDef; |
| 10751 | typedef struct upb_MessageDef upb_MessageDef; |
| 10752 | typedef struct upb_MessageReservedRange upb_MessageReservedRange; |
| 10753 | typedef struct upb_MethodDef upb_MethodDef; |
| 10754 | typedef struct upb_OneofDef upb_OneofDef; |
| 10755 | typedef struct upb_ServiceDef upb_ServiceDef; |
| 10756 | |
| 10757 | // EVERYTHING BELOW THIS LINE IS INTERNAL - DO NOT USE ///////////////////////// |
| 10758 | |
| 10759 | typedef struct upb_DefBuilder upb_DefBuilder; |
| 10760 | |
| 10761 | #endif /* UPB_REFLECTION_COMMON_H_ */ |
| 10762 | |
| 10763 | #ifndef UPB_REFLECTION_DEF_TYPE_H_ |
| 10764 | #define UPB_REFLECTION_DEF_TYPE_H_ |
| 10765 | |
| 10766 | |
| 10767 | // Must be last. |
| 10768 | |
| 10769 | // Inside a symtab we store tagged pointers to specific def types. |
| 10770 | typedef enum { |
| 10771 | UPB_DEFTYPE_MASK = 7, |
| 10772 | |
| 10773 | // Only inside symtab table. |
| 10774 | UPB_DEFTYPE_EXT = 0, |
| 10775 | UPB_DEFTYPE_MSG = 1, |
| 10776 | UPB_DEFTYPE_ENUM = 2, |
| 10777 | UPB_DEFTYPE_ENUMVAL = 3, |
| 10778 | UPB_DEFTYPE_SERVICE = 4, |
| 10779 | |
| 10780 | // Only inside message table. |
| 10781 | UPB_DEFTYPE_FIELD = 0, |
| 10782 | UPB_DEFTYPE_ONEOF = 1, |
| 10783 | UPB_DEFTYPE_FIELD_JSONNAME = 2, |
| 10784 | } upb_deftype_t; |
| 10785 | |
| 10786 | #ifdef __cplusplus |
| 10787 | extern "C" { |
| 10788 | #endif |
| 10789 | |
| 10790 | // Our 3-bit pointer tagging requires all pointers to be multiples of 8. |
| 10791 | // The arena will always yield 8-byte-aligned addresses, however we put |
| 10792 | // the defs into arrays. For each element in the array to be 8-byte-aligned, |
| 10793 | // the sizes of each def type must also be a multiple of 8. |
| 10794 | // |
| 10795 | // If any of these asserts fail, we need to add or remove padding on 32-bit |
| 10796 | // machines (64-bit machines will have 8-byte alignment already due to |
| 10797 | // pointers, which all of these structs have). |
| 10798 | UPB_INLINE void _upb_DefType_CheckPadding(size_t size) { |
| 10799 | UPB_ASSERT((size & UPB_DEFTYPE_MASK) == 0); |
| 10800 | } |
| 10801 | |
| 10802 | upb_deftype_t _upb_DefType_Type(upb_value v); |
| 10803 | |
| 10804 | upb_value _upb_DefType_Pack(const void* ptr, upb_deftype_t type); |
| 10805 | |
| 10806 | const void* _upb_DefType_Unpack(upb_value v, upb_deftype_t type); |
| 10807 | |
| 10808 | #ifdef __cplusplus |
| 10809 | } /* extern "C" */ |
| 10810 | #endif |
| 10811 | |
| 10812 | |
| 10813 | #endif /* UPB_REFLECTION_DEF_TYPE_H_ */ |
| 10814 | |
| 10815 | // Must be last. |
| 10816 | |
| 10817 | #ifdef __cplusplus |
| 10818 | extern "C" { |
| 10819 | #endif |
| 10820 | |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 10821 | UPB_API void upb_DefPool_Free(upb_DefPool* s); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10822 | |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 10823 | UPB_API upb_DefPool* upb_DefPool_New(void); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10824 | |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 10825 | UPB_API const upb_MessageDef* upb_DefPool_FindMessageByName( |
| 10826 | const upb_DefPool* s, const char* sym); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10827 | |
| 10828 | const upb_MessageDef* upb_DefPool_FindMessageByNameWithSize( |
| 10829 | const upb_DefPool* s, const char* sym, size_t len); |
| 10830 | |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 10831 | UPB_API const upb_EnumDef* upb_DefPool_FindEnumByName(const upb_DefPool* s, |
| 10832 | const char* sym); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10833 | |
| 10834 | const upb_EnumValueDef* upb_DefPool_FindEnumByNameval(const upb_DefPool* s, |
| 10835 | const char* sym); |
| 10836 | |
| 10837 | const upb_FileDef* upb_DefPool_FindFileByName(const upb_DefPool* s, |
| 10838 | const char* name); |
| 10839 | |
| 10840 | const upb_FileDef* upb_DefPool_FindFileByNameWithSize(const upb_DefPool* s, |
| 10841 | const char* name, |
| 10842 | size_t len); |
| 10843 | |
| 10844 | const upb_FieldDef* upb_DefPool_FindExtensionByMiniTable( |
| 10845 | const upb_DefPool* s, const upb_MiniTableExtension* ext); |
| 10846 | |
| 10847 | const upb_FieldDef* upb_DefPool_FindExtensionByName(const upb_DefPool* s, |
| 10848 | const char* sym); |
| 10849 | |
| 10850 | const upb_FieldDef* upb_DefPool_FindExtensionByNameWithSize( |
| 10851 | const upb_DefPool* s, const char* name, size_t size); |
| 10852 | |
| 10853 | const upb_FieldDef* upb_DefPool_FindExtensionByNumber(const upb_DefPool* s, |
| 10854 | const upb_MessageDef* m, |
| 10855 | int32_t fieldnum); |
| 10856 | |
| 10857 | const upb_ServiceDef* upb_DefPool_FindServiceByName(const upb_DefPool* s, |
| 10858 | const char* name); |
| 10859 | |
| 10860 | const upb_ServiceDef* upb_DefPool_FindServiceByNameWithSize( |
| 10861 | const upb_DefPool* s, const char* name, size_t size); |
| 10862 | |
| 10863 | const upb_FileDef* upb_DefPool_FindFileContainingSymbol(const upb_DefPool* s, |
| 10864 | const char* name); |
| 10865 | |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 10866 | UPB_API const upb_FileDef* upb_DefPool_AddFile( |
| 10867 | upb_DefPool* s, const UPB_DESC(FileDescriptorProto) * file_proto, |
| 10868 | upb_Status* status); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10869 | |
| 10870 | const upb_ExtensionRegistry* upb_DefPool_ExtensionRegistry( |
| 10871 | const upb_DefPool* s); |
| 10872 | |
| 10873 | const upb_FieldDef** upb_DefPool_GetAllExtensions(const upb_DefPool* s, |
| 10874 | const upb_MessageDef* m, |
| 10875 | size_t* count); |
| 10876 | |
| 10877 | #ifdef __cplusplus |
| 10878 | } /* extern "C" */ |
| 10879 | #endif |
| 10880 | |
| 10881 | |
| 10882 | #endif /* UPB_REFLECTION_DEF_POOL_H_ */ |
| 10883 | |
| 10884 | // IWYU pragma: private, include "upb/reflection/def.h" |
| 10885 | |
| 10886 | #ifndef UPB_REFLECTION_ENUM_DEF_H_ |
| 10887 | #define UPB_REFLECTION_ENUM_DEF_H_ |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10888 | |
| 10889 | |
| 10890 | // Must be last. |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10891 | |
| 10892 | #ifdef __cplusplus |
| 10893 | extern "C" { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10894 | #endif |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10895 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10896 | bool upb_EnumDef_CheckNumber(const upb_EnumDef* e, int32_t num); |
| 10897 | const upb_MessageDef* upb_EnumDef_ContainingType(const upb_EnumDef* e); |
| 10898 | int32_t upb_EnumDef_Default(const upb_EnumDef* e); |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 10899 | UPB_API const upb_FileDef* upb_EnumDef_File(const upb_EnumDef* e); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10900 | const upb_EnumValueDef* upb_EnumDef_FindValueByName(const upb_EnumDef* e, |
| 10901 | const char* name); |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 10902 | UPB_API const upb_EnumValueDef* upb_EnumDef_FindValueByNameWithSize( |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10903 | const upb_EnumDef* e, const char* name, size_t size); |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 10904 | UPB_API const upb_EnumValueDef* upb_EnumDef_FindValueByNumber( |
| 10905 | const upb_EnumDef* e, int32_t num); |
| 10906 | UPB_API const char* upb_EnumDef_FullName(const upb_EnumDef* e); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10907 | bool upb_EnumDef_HasOptions(const upb_EnumDef* e); |
| 10908 | bool upb_EnumDef_IsClosed(const upb_EnumDef* e); |
| 10909 | |
| 10910 | // Creates a mini descriptor string for an enum, returns true on success. |
| 10911 | bool upb_EnumDef_MiniDescriptorEncode(const upb_EnumDef* e, upb_Arena* a, |
| 10912 | upb_StringView* out); |
| 10913 | |
| 10914 | const char* upb_EnumDef_Name(const upb_EnumDef* e); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 10915 | const UPB_DESC(EnumOptions) * upb_EnumDef_Options(const upb_EnumDef* e); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10916 | |
| 10917 | upb_StringView upb_EnumDef_ReservedName(const upb_EnumDef* e, int i); |
| 10918 | int upb_EnumDef_ReservedNameCount(const upb_EnumDef* e); |
| 10919 | |
| 10920 | const upb_EnumReservedRange* upb_EnumDef_ReservedRange(const upb_EnumDef* e, |
| 10921 | int i); |
| 10922 | int upb_EnumDef_ReservedRangeCount(const upb_EnumDef* e); |
| 10923 | |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 10924 | UPB_API const upb_EnumValueDef* upb_EnumDef_Value(const upb_EnumDef* e, int i); |
| 10925 | UPB_API int upb_EnumDef_ValueCount(const upb_EnumDef* e); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10926 | |
| 10927 | #ifdef __cplusplus |
| 10928 | } /* extern "C" */ |
| 10929 | #endif |
| 10930 | |
| 10931 | |
| 10932 | #endif /* UPB_REFLECTION_ENUM_DEF_H_ */ |
| 10933 | |
| 10934 | // IWYU pragma: private, include "upb/reflection/def.h" |
| 10935 | |
| 10936 | #ifndef UPB_REFLECTION_ENUM_VALUE_DEF_H_ |
| 10937 | #define UPB_REFLECTION_ENUM_VALUE_DEF_H_ |
| 10938 | |
| 10939 | |
| 10940 | // Must be last. |
| 10941 | |
| 10942 | #ifdef __cplusplus |
| 10943 | extern "C" { |
| 10944 | #endif |
| 10945 | |
| 10946 | const upb_EnumDef* upb_EnumValueDef_Enum(const upb_EnumValueDef* v); |
| 10947 | const char* upb_EnumValueDef_FullName(const upb_EnumValueDef* v); |
| 10948 | bool upb_EnumValueDef_HasOptions(const upb_EnumValueDef* v); |
| 10949 | uint32_t upb_EnumValueDef_Index(const upb_EnumValueDef* v); |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 10950 | UPB_API const char* upb_EnumValueDef_Name(const upb_EnumValueDef* v); |
| 10951 | UPB_API int32_t upb_EnumValueDef_Number(const upb_EnumValueDef* v); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 10952 | const UPB_DESC(EnumValueOptions) * |
| 10953 | upb_EnumValueDef_Options(const upb_EnumValueDef* v); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10954 | |
| 10955 | #ifdef __cplusplus |
| 10956 | } /* extern "C" */ |
| 10957 | #endif |
| 10958 | |
| 10959 | |
| 10960 | #endif /* UPB_REFLECTION_ENUM_VALUE_DEF_H_ */ |
| 10961 | |
| 10962 | // IWYU pragma: private, include "upb/reflection/def.h" |
| 10963 | |
| 10964 | #ifndef UPB_REFLECTION_EXTENSION_RANGE_H_ |
| 10965 | #define UPB_REFLECTION_EXTENSION_RANGE_H_ |
| 10966 | |
| 10967 | |
| 10968 | // Must be last. |
| 10969 | |
| 10970 | #ifdef __cplusplus |
| 10971 | extern "C" { |
| 10972 | #endif |
| 10973 | |
| 10974 | int32_t upb_ExtensionRange_Start(const upb_ExtensionRange* r); |
| 10975 | int32_t upb_ExtensionRange_End(const upb_ExtensionRange* r); |
| 10976 | |
| 10977 | bool upb_ExtensionRange_HasOptions(const upb_ExtensionRange* r); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 10978 | const UPB_DESC(ExtensionRangeOptions) * |
| 10979 | upb_ExtensionRange_Options(const upb_ExtensionRange* r); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10980 | |
| 10981 | #ifdef __cplusplus |
| 10982 | } /* extern "C" */ |
| 10983 | #endif |
| 10984 | |
| 10985 | |
| 10986 | #endif /* UPB_REFLECTION_EXTENSION_RANGE_H_ */ |
| 10987 | |
| 10988 | // IWYU pragma: private, include "upb/reflection/def.h" |
| 10989 | |
| 10990 | #ifndef UPB_REFLECTION_FIELD_DEF_H_ |
| 10991 | #define UPB_REFLECTION_FIELD_DEF_H_ |
| 10992 | |
| 10993 | |
| 10994 | // Must be last. |
| 10995 | |
| 10996 | // Maximum field number allowed for FieldDefs. |
| 10997 | // This is an inherent limit of the protobuf wire format. |
| 10998 | #define kUpb_MaxFieldNumber ((1 << 29) - 1) |
| 10999 | |
| 11000 | #ifdef __cplusplus |
| 11001 | extern "C" { |
| 11002 | #endif |
| 11003 | |
| 11004 | const upb_OneofDef* upb_FieldDef_ContainingOneof(const upb_FieldDef* f); |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11005 | UPB_API const upb_MessageDef* upb_FieldDef_ContainingType( |
| 11006 | const upb_FieldDef* f); |
| 11007 | UPB_API upb_CType upb_FieldDef_CType(const upb_FieldDef* f); |
| 11008 | UPB_API upb_MessageValue upb_FieldDef_Default(const upb_FieldDef* f); |
| 11009 | UPB_API const upb_EnumDef* upb_FieldDef_EnumSubDef(const upb_FieldDef* f); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11010 | const upb_MessageDef* upb_FieldDef_ExtensionScope(const upb_FieldDef* f); |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11011 | UPB_API const upb_FileDef* upb_FieldDef_File(const upb_FieldDef* f); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11012 | const char* upb_FieldDef_FullName(const upb_FieldDef* f); |
| 11013 | bool upb_FieldDef_HasDefault(const upb_FieldDef* f); |
| 11014 | bool upb_FieldDef_HasJsonName(const upb_FieldDef* f); |
| 11015 | bool upb_FieldDef_HasOptions(const upb_FieldDef* f); |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11016 | UPB_API bool upb_FieldDef_HasPresence(const upb_FieldDef* f); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11017 | bool upb_FieldDef_HasSubDef(const upb_FieldDef* f); |
| 11018 | uint32_t upb_FieldDef_Index(const upb_FieldDef* f); |
| 11019 | bool upb_FieldDef_IsExtension(const upb_FieldDef* f); |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11020 | UPB_API bool upb_FieldDef_IsMap(const upb_FieldDef* f); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11021 | bool upb_FieldDef_IsOptional(const upb_FieldDef* f); |
| 11022 | bool upb_FieldDef_IsPacked(const upb_FieldDef* f); |
| 11023 | bool upb_FieldDef_IsPrimitive(const upb_FieldDef* f); |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11024 | UPB_API bool upb_FieldDef_IsRepeated(const upb_FieldDef* f); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11025 | bool upb_FieldDef_IsRequired(const upb_FieldDef* f); |
| 11026 | bool upb_FieldDef_IsString(const upb_FieldDef* f); |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11027 | UPB_API bool upb_FieldDef_IsSubMessage(const upb_FieldDef* f); |
| 11028 | UPB_API const char* upb_FieldDef_JsonName(const upb_FieldDef* f); |
| 11029 | UPB_API upb_Label upb_FieldDef_Label(const upb_FieldDef* f); |
| 11030 | UPB_API const upb_MessageDef* upb_FieldDef_MessageSubDef(const upb_FieldDef* f); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11031 | |
| 11032 | // Creates a mini descriptor string for a field, returns true on success. |
| 11033 | bool upb_FieldDef_MiniDescriptorEncode(const upb_FieldDef* f, upb_Arena* a, |
| 11034 | upb_StringView* out); |
| 11035 | |
| 11036 | const upb_MiniTableField* upb_FieldDef_MiniTable(const upb_FieldDef* f); |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11037 | UPB_API const char* upb_FieldDef_Name(const upb_FieldDef* f); |
| 11038 | UPB_API uint32_t upb_FieldDef_Number(const upb_FieldDef* f); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 11039 | const UPB_DESC(FieldOptions) * upb_FieldDef_Options(const upb_FieldDef* f); |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11040 | UPB_API const upb_OneofDef* upb_FieldDef_RealContainingOneof( |
| 11041 | const upb_FieldDef* f); |
| 11042 | UPB_API upb_FieldType upb_FieldDef_Type(const upb_FieldDef* f); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11043 | |
| 11044 | #ifdef __cplusplus |
| 11045 | } /* extern "C" */ |
| 11046 | #endif |
| 11047 | |
| 11048 | |
| 11049 | #endif /* UPB_REFLECTION_FIELD_DEF_H_ */ |
| 11050 | |
| 11051 | // IWYU pragma: private, include "upb/reflection/def.h" |
| 11052 | |
| 11053 | #ifndef UPB_REFLECTION_FILE_DEF_H_ |
| 11054 | #define UPB_REFLECTION_FILE_DEF_H_ |
| 11055 | |
| 11056 | |
| 11057 | // Must be last. |
| 11058 | |
| 11059 | #ifdef __cplusplus |
| 11060 | extern "C" { |
| 11061 | #endif |
| 11062 | |
| 11063 | const upb_FileDef* upb_FileDef_Dependency(const upb_FileDef* f, int i); |
| 11064 | int upb_FileDef_DependencyCount(const upb_FileDef* f); |
| 11065 | bool upb_FileDef_HasOptions(const upb_FileDef* f); |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11066 | UPB_API const char* upb_FileDef_Name(const upb_FileDef* f); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 11067 | const UPB_DESC(FileOptions) * upb_FileDef_Options(const upb_FileDef* f); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11068 | const char* upb_FileDef_Package(const upb_FileDef* f); |
Protobuf Team Bot | 7dabac9 | 2023-09-07 18:35:50 +0000 | [diff] [blame] | 11069 | UPB_DESC(Edition) upb_FileDef_Edition(const upb_FileDef* f); |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11070 | UPB_API const upb_DefPool* upb_FileDef_Pool(const upb_FileDef* f); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11071 | |
| 11072 | const upb_FileDef* upb_FileDef_PublicDependency(const upb_FileDef* f, int i); |
| 11073 | int upb_FileDef_PublicDependencyCount(const upb_FileDef* f); |
| 11074 | |
| 11075 | const upb_ServiceDef* upb_FileDef_Service(const upb_FileDef* f, int i); |
| 11076 | int upb_FileDef_ServiceCount(const upb_FileDef* f); |
| 11077 | |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11078 | UPB_API upb_Syntax upb_FileDef_Syntax(const upb_FileDef* f); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11079 | |
| 11080 | const upb_EnumDef* upb_FileDef_TopLevelEnum(const upb_FileDef* f, int i); |
| 11081 | int upb_FileDef_TopLevelEnumCount(const upb_FileDef* f); |
| 11082 | |
| 11083 | const upb_FieldDef* upb_FileDef_TopLevelExtension(const upb_FileDef* f, int i); |
| 11084 | int upb_FileDef_TopLevelExtensionCount(const upb_FileDef* f); |
| 11085 | |
| 11086 | const upb_MessageDef* upb_FileDef_TopLevelMessage(const upb_FileDef* f, int i); |
| 11087 | int upb_FileDef_TopLevelMessageCount(const upb_FileDef* f); |
| 11088 | |
| 11089 | const upb_FileDef* upb_FileDef_WeakDependency(const upb_FileDef* f, int i); |
| 11090 | int upb_FileDef_WeakDependencyCount(const upb_FileDef* f); |
| 11091 | |
| 11092 | #ifdef __cplusplus |
| 11093 | } /* extern "C" */ |
| 11094 | #endif |
| 11095 | |
| 11096 | |
| 11097 | #endif /* UPB_REFLECTION_FILE_DEF_H_ */ |
| 11098 | |
| 11099 | // IWYU pragma: private, include "upb/reflection/def.h" |
| 11100 | |
| 11101 | #ifndef UPB_REFLECTION_MESSAGE_DEF_H_ |
| 11102 | #define UPB_REFLECTION_MESSAGE_DEF_H_ |
| 11103 | |
| 11104 | |
| 11105 | // Must be last. |
| 11106 | |
| 11107 | // Well-known field tag numbers for map-entry messages. |
| 11108 | #define kUpb_MapEntry_KeyFieldNumber 1 |
| 11109 | #define kUpb_MapEntry_ValueFieldNumber 2 |
| 11110 | |
| 11111 | // Well-known field tag numbers for Any messages. |
| 11112 | #define kUpb_Any_TypeFieldNumber 1 |
| 11113 | #define kUpb_Any_ValueFieldNumber 2 |
| 11114 | |
| 11115 | // Well-known field tag numbers for duration messages. |
| 11116 | #define kUpb_Duration_SecondsFieldNumber 1 |
| 11117 | #define kUpb_Duration_NanosFieldNumber 2 |
| 11118 | |
| 11119 | // Well-known field tag numbers for timestamp messages. |
| 11120 | #define kUpb_Timestamp_SecondsFieldNumber 1 |
| 11121 | #define kUpb_Timestamp_NanosFieldNumber 2 |
| 11122 | |
| 11123 | // All the different kind of well known type messages. For simplicity of check, |
| 11124 | // number wrappers and string wrappers are grouped together. Make sure the |
| 11125 | // order and number of these groups are not changed. |
| 11126 | typedef enum { |
| 11127 | kUpb_WellKnown_Unspecified, |
| 11128 | kUpb_WellKnown_Any, |
| 11129 | kUpb_WellKnown_FieldMask, |
| 11130 | kUpb_WellKnown_Duration, |
| 11131 | kUpb_WellKnown_Timestamp, |
| 11132 | |
| 11133 | // number wrappers |
| 11134 | kUpb_WellKnown_DoubleValue, |
| 11135 | kUpb_WellKnown_FloatValue, |
| 11136 | kUpb_WellKnown_Int64Value, |
| 11137 | kUpb_WellKnown_UInt64Value, |
| 11138 | kUpb_WellKnown_Int32Value, |
| 11139 | kUpb_WellKnown_UInt32Value, |
| 11140 | |
| 11141 | // string wrappers |
| 11142 | kUpb_WellKnown_StringValue, |
| 11143 | kUpb_WellKnown_BytesValue, |
| 11144 | kUpb_WellKnown_BoolValue, |
| 11145 | kUpb_WellKnown_Value, |
| 11146 | kUpb_WellKnown_ListValue, |
| 11147 | kUpb_WellKnown_Struct, |
| 11148 | } upb_WellKnown; |
| 11149 | |
| 11150 | #ifdef __cplusplus |
| 11151 | extern "C" { |
| 11152 | #endif |
| 11153 | |
| 11154 | const upb_MessageDef* upb_MessageDef_ContainingType(const upb_MessageDef* m); |
| 11155 | |
| 11156 | const upb_ExtensionRange* upb_MessageDef_ExtensionRange(const upb_MessageDef* m, |
| 11157 | int i); |
| 11158 | int upb_MessageDef_ExtensionRangeCount(const upb_MessageDef* m); |
| 11159 | |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11160 | UPB_API const upb_FieldDef* upb_MessageDef_Field(const upb_MessageDef* m, |
| 11161 | int i); |
| 11162 | UPB_API int upb_MessageDef_FieldCount(const upb_MessageDef* m); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11163 | |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11164 | UPB_API const upb_FileDef* upb_MessageDef_File(const upb_MessageDef* m); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11165 | |
| 11166 | // Returns a field by either JSON name or regular proto name. |
| 11167 | const upb_FieldDef* upb_MessageDef_FindByJsonNameWithSize( |
| 11168 | const upb_MessageDef* m, const char* name, size_t size); |
| 11169 | UPB_INLINE const upb_FieldDef* upb_MessageDef_FindByJsonName( |
| 11170 | const upb_MessageDef* m, const char* name) { |
| 11171 | return upb_MessageDef_FindByJsonNameWithSize(m, name, strlen(name)); |
| 11172 | } |
| 11173 | |
| 11174 | // Lookup of either field or oneof by name. Returns whether either was found. |
| 11175 | // If the return is true, then the found def will be set, and the non-found |
| 11176 | // one set to NULL. |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11177 | UPB_API bool upb_MessageDef_FindByNameWithSize(const upb_MessageDef* m, |
| 11178 | const char* name, size_t size, |
| 11179 | const upb_FieldDef** f, |
| 11180 | const upb_OneofDef** o); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11181 | UPB_INLINE bool upb_MessageDef_FindByName(const upb_MessageDef* m, |
| 11182 | const char* name, |
| 11183 | const upb_FieldDef** f, |
| 11184 | const upb_OneofDef** o) { |
| 11185 | return upb_MessageDef_FindByNameWithSize(m, name, strlen(name), f, o); |
| 11186 | } |
| 11187 | |
| 11188 | const upb_FieldDef* upb_MessageDef_FindFieldByName(const upb_MessageDef* m, |
| 11189 | const char* name); |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11190 | UPB_API const upb_FieldDef* upb_MessageDef_FindFieldByNameWithSize( |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11191 | const upb_MessageDef* m, const char* name, size_t size); |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11192 | UPB_API const upb_FieldDef* upb_MessageDef_FindFieldByNumber( |
| 11193 | const upb_MessageDef* m, uint32_t i); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11194 | const upb_OneofDef* upb_MessageDef_FindOneofByName(const upb_MessageDef* m, |
| 11195 | const char* name); |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11196 | UPB_API const upb_OneofDef* upb_MessageDef_FindOneofByNameWithSize( |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11197 | const upb_MessageDef* m, const char* name, size_t size); |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11198 | UPB_API const char* upb_MessageDef_FullName(const upb_MessageDef* m); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11199 | bool upb_MessageDef_HasOptions(const upb_MessageDef* m); |
| 11200 | bool upb_MessageDef_IsMapEntry(const upb_MessageDef* m); |
| 11201 | bool upb_MessageDef_IsMessageSet(const upb_MessageDef* m); |
| 11202 | |
| 11203 | // Creates a mini descriptor string for a message, returns true on success. |
| 11204 | bool upb_MessageDef_MiniDescriptorEncode(const upb_MessageDef* m, upb_Arena* a, |
| 11205 | upb_StringView* out); |
| 11206 | |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11207 | UPB_API const upb_MiniTable* upb_MessageDef_MiniTable(const upb_MessageDef* m); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11208 | const char* upb_MessageDef_Name(const upb_MessageDef* m); |
| 11209 | |
| 11210 | const upb_EnumDef* upb_MessageDef_NestedEnum(const upb_MessageDef* m, int i); |
| 11211 | const upb_FieldDef* upb_MessageDef_NestedExtension(const upb_MessageDef* m, |
| 11212 | int i); |
| 11213 | const upb_MessageDef* upb_MessageDef_NestedMessage(const upb_MessageDef* m, |
| 11214 | int i); |
| 11215 | |
| 11216 | int upb_MessageDef_NestedEnumCount(const upb_MessageDef* m); |
| 11217 | int upb_MessageDef_NestedExtensionCount(const upb_MessageDef* m); |
| 11218 | int upb_MessageDef_NestedMessageCount(const upb_MessageDef* m); |
| 11219 | |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11220 | UPB_API const upb_OneofDef* upb_MessageDef_Oneof(const upb_MessageDef* m, |
| 11221 | int i); |
| 11222 | UPB_API int upb_MessageDef_OneofCount(const upb_MessageDef* m); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 11223 | int upb_MessageDef_RealOneofCount(const upb_MessageDef* m); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11224 | |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 11225 | const UPB_DESC(MessageOptions) * |
| 11226 | upb_MessageDef_Options(const upb_MessageDef* m); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11227 | |
| 11228 | upb_StringView upb_MessageDef_ReservedName(const upb_MessageDef* m, int i); |
| 11229 | int upb_MessageDef_ReservedNameCount(const upb_MessageDef* m); |
| 11230 | |
| 11231 | const upb_MessageReservedRange* upb_MessageDef_ReservedRange( |
| 11232 | const upb_MessageDef* m, int i); |
| 11233 | int upb_MessageDef_ReservedRangeCount(const upb_MessageDef* m); |
| 11234 | |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11235 | UPB_API upb_Syntax upb_MessageDef_Syntax(const upb_MessageDef* m); |
| 11236 | UPB_API upb_WellKnown upb_MessageDef_WellKnownType(const upb_MessageDef* m); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11237 | |
| 11238 | #ifdef __cplusplus |
| 11239 | } /* extern "C" */ |
| 11240 | #endif |
| 11241 | |
| 11242 | |
| 11243 | #endif /* UPB_REFLECTION_MESSAGE_DEF_H_ */ |
| 11244 | |
| 11245 | // IWYU pragma: private, include "upb/reflection/def.h" |
| 11246 | |
| 11247 | #ifndef UPB_REFLECTION_METHOD_DEF_H_ |
| 11248 | #define UPB_REFLECTION_METHOD_DEF_H_ |
| 11249 | |
| 11250 | |
| 11251 | // Must be last. |
| 11252 | |
| 11253 | #ifdef __cplusplus |
| 11254 | extern "C" { |
| 11255 | #endif |
| 11256 | |
| 11257 | bool upb_MethodDef_ClientStreaming(const upb_MethodDef* m); |
| 11258 | const char* upb_MethodDef_FullName(const upb_MethodDef* m); |
| 11259 | bool upb_MethodDef_HasOptions(const upb_MethodDef* m); |
| 11260 | int upb_MethodDef_Index(const upb_MethodDef* m); |
| 11261 | const upb_MessageDef* upb_MethodDef_InputType(const upb_MethodDef* m); |
| 11262 | const char* upb_MethodDef_Name(const upb_MethodDef* m); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 11263 | const UPB_DESC(MethodOptions) * upb_MethodDef_Options(const upb_MethodDef* m); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11264 | const upb_MessageDef* upb_MethodDef_OutputType(const upb_MethodDef* m); |
| 11265 | bool upb_MethodDef_ServerStreaming(const upb_MethodDef* m); |
| 11266 | const upb_ServiceDef* upb_MethodDef_Service(const upb_MethodDef* m); |
| 11267 | |
| 11268 | #ifdef __cplusplus |
| 11269 | } /* extern "C" */ |
| 11270 | #endif |
| 11271 | |
| 11272 | |
| 11273 | #endif /* UPB_REFLECTION_METHOD_DEF_H_ */ |
| 11274 | |
| 11275 | // IWYU pragma: private, include "upb/reflection/def.h" |
| 11276 | |
| 11277 | #ifndef UPB_REFLECTION_ONEOF_DEF_H_ |
| 11278 | #define UPB_REFLECTION_ONEOF_DEF_H_ |
| 11279 | |
| 11280 | |
| 11281 | // Must be last. |
| 11282 | |
| 11283 | #ifdef __cplusplus |
| 11284 | extern "C" { |
| 11285 | #endif |
| 11286 | |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11287 | UPB_API const upb_MessageDef* upb_OneofDef_ContainingType( |
| 11288 | const upb_OneofDef* o); |
| 11289 | UPB_API const upb_FieldDef* upb_OneofDef_Field(const upb_OneofDef* o, int i); |
| 11290 | UPB_API int upb_OneofDef_FieldCount(const upb_OneofDef* o); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11291 | const char* upb_OneofDef_FullName(const upb_OneofDef* o); |
| 11292 | bool upb_OneofDef_HasOptions(const upb_OneofDef* o); |
| 11293 | uint32_t upb_OneofDef_Index(const upb_OneofDef* o); |
| 11294 | bool upb_OneofDef_IsSynthetic(const upb_OneofDef* o); |
| 11295 | const upb_FieldDef* upb_OneofDef_LookupName(const upb_OneofDef* o, |
| 11296 | const char* name); |
| 11297 | const upb_FieldDef* upb_OneofDef_LookupNameWithSize(const upb_OneofDef* o, |
| 11298 | const char* name, |
| 11299 | size_t size); |
| 11300 | const upb_FieldDef* upb_OneofDef_LookupNumber(const upb_OneofDef* o, |
| 11301 | uint32_t num); |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11302 | UPB_API const char* upb_OneofDef_Name(const upb_OneofDef* o); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11303 | int upb_OneofDef_numfields(const upb_OneofDef* o); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 11304 | const UPB_DESC(OneofOptions) * upb_OneofDef_Options(const upb_OneofDef* o); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11305 | |
| 11306 | #ifdef __cplusplus |
| 11307 | } /* extern "C" */ |
| 11308 | #endif |
| 11309 | |
| 11310 | |
| 11311 | #endif /* UPB_REFLECTION_ONEOF_DEF_H_ */ |
| 11312 | |
| 11313 | // IWYU pragma: private, include "upb/reflection/def.h" |
| 11314 | |
| 11315 | #ifndef UPB_REFLECTION_SERVICE_DEF_H_ |
| 11316 | #define UPB_REFLECTION_SERVICE_DEF_H_ |
| 11317 | |
| 11318 | |
| 11319 | // Must be last. |
| 11320 | |
| 11321 | #ifdef __cplusplus |
| 11322 | extern "C" { |
| 11323 | #endif |
| 11324 | |
| 11325 | const upb_FileDef* upb_ServiceDef_File(const upb_ServiceDef* s); |
| 11326 | const upb_MethodDef* upb_ServiceDef_FindMethodByName(const upb_ServiceDef* s, |
| 11327 | const char* name); |
| 11328 | const char* upb_ServiceDef_FullName(const upb_ServiceDef* s); |
| 11329 | bool upb_ServiceDef_HasOptions(const upb_ServiceDef* s); |
| 11330 | int upb_ServiceDef_Index(const upb_ServiceDef* s); |
| 11331 | const upb_MethodDef* upb_ServiceDef_Method(const upb_ServiceDef* s, int i); |
| 11332 | int upb_ServiceDef_MethodCount(const upb_ServiceDef* s); |
| 11333 | const char* upb_ServiceDef_Name(const upb_ServiceDef* s); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 11334 | const UPB_DESC(ServiceOptions) * |
| 11335 | upb_ServiceDef_Options(const upb_ServiceDef* s); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11336 | |
| 11337 | #ifdef __cplusplus |
| 11338 | } /* extern "C" */ |
| 11339 | #endif |
| 11340 | |
| 11341 | |
| 11342 | #endif /* UPB_REFLECTION_SERVICE_DEF_H_ */ |
| 11343 | |
| 11344 | #endif /* UPB_REFLECTION_DEF_H_ */ |
| 11345 | |
| 11346 | // Must be last. |
| 11347 | |
| 11348 | #ifdef __cplusplus |
| 11349 | extern "C" { |
| 11350 | #endif |
| 11351 | |
| 11352 | enum { upb_JsonDecode_IgnoreUnknown = 1 }; |
| 11353 | |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11354 | UPB_API bool upb_JsonDecode(const char* buf, size_t size, upb_Message* msg, |
| 11355 | const upb_MessageDef* m, const upb_DefPool* symtab, |
| 11356 | int options, upb_Arena* arena, upb_Status* status); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11357 | |
| 11358 | #ifdef __cplusplus |
| 11359 | } /* extern "C" */ |
| 11360 | #endif |
| 11361 | |
| 11362 | |
| 11363 | #endif /* UPB_JSONDECODE_H_ */ |
| 11364 | |
| 11365 | #ifndef UPB_LEX_ATOI_H_ |
| 11366 | #define UPB_LEX_ATOI_H_ |
| 11367 | |
Adam Cozzette | 7d5592e | 2023-08-23 12:15:26 -0700 | [diff] [blame] | 11368 | #include <stdint.h> |
| 11369 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11370 | // Must be last. |
| 11371 | |
| 11372 | #ifdef __cplusplus |
| 11373 | extern "C" { |
| 11374 | #endif |
| 11375 | |
| 11376 | // We use these hand-written routines instead of strto[u]l() because the "long |
| 11377 | // long" variants aren't in c89. Also our version allows setting a ptr limit. |
| 11378 | // Return the new position of the pointer after parsing the int, or NULL on |
| 11379 | // integer overflow. |
| 11380 | |
| 11381 | const char* upb_BufToUint64(const char* ptr, const char* end, uint64_t* val); |
| 11382 | const char* upb_BufToInt64(const char* ptr, const char* end, int64_t* val, |
| 11383 | bool* is_neg); |
| 11384 | |
| 11385 | #ifdef __cplusplus |
| 11386 | } /* extern "C" */ |
| 11387 | #endif |
| 11388 | |
| 11389 | |
| 11390 | #endif /* UPB_LEX_ATOI_H_ */ |
| 11391 | |
| 11392 | #ifndef UPB_LEX_UNICODE_H_ |
| 11393 | #define UPB_LEX_UNICODE_H_ |
| 11394 | |
Adam Cozzette | 7d5592e | 2023-08-23 12:15:26 -0700 | [diff] [blame] | 11395 | #include <stdint.h> |
| 11396 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11397 | // Must be last. |
| 11398 | |
| 11399 | #ifdef __cplusplus |
| 11400 | extern "C" { |
| 11401 | #endif |
| 11402 | |
| 11403 | // Returns true iff a codepoint is the value for a high surrogate. |
| 11404 | UPB_INLINE bool upb_Unicode_IsHigh(uint32_t cp) { |
| 11405 | return (cp >= 0xd800 && cp <= 0xdbff); |
| 11406 | } |
| 11407 | |
| 11408 | // Returns true iff a codepoint is the value for a low surrogate. |
| 11409 | UPB_INLINE bool upb_Unicode_IsLow(uint32_t cp) { |
| 11410 | return (cp >= 0xdc00 && cp <= 0xdfff); |
| 11411 | } |
| 11412 | |
| 11413 | // Returns the high 16-bit surrogate value for a supplementary codepoint. |
| 11414 | // Does not sanity-check the input. |
| 11415 | UPB_INLINE uint16_t upb_Unicode_ToHigh(uint32_t cp) { |
| 11416 | return (cp >> 10) + 0xd7c0; |
| 11417 | } |
| 11418 | |
| 11419 | // Returns the low 16-bit surrogate value for a supplementary codepoint. |
| 11420 | // Does not sanity-check the input. |
| 11421 | UPB_INLINE uint16_t upb_Unicode_ToLow(uint32_t cp) { |
| 11422 | return (cp & 0x3ff) | 0xdc00; |
| 11423 | } |
| 11424 | |
| 11425 | // Returns the 32-bit value corresponding to a pair of 16-bit surrogates. |
| 11426 | // Does not sanity-check the input. |
| 11427 | UPB_INLINE uint32_t upb_Unicode_FromPair(uint32_t high, uint32_t low) { |
| 11428 | return ((high & 0x3ff) << 10) + (low & 0x3ff) + 0x10000; |
| 11429 | } |
| 11430 | |
| 11431 | // Outputs a codepoint as UTF8. |
| 11432 | // Returns the number of bytes written (1-4 on success, 0 on error). |
| 11433 | // Does not sanity-check the input. Specifically does not check for surrogates. |
| 11434 | int upb_Unicode_ToUTF8(uint32_t cp, char* out); |
| 11435 | |
| 11436 | #ifdef __cplusplus |
| 11437 | } /* extern "C" */ |
| 11438 | #endif |
| 11439 | |
| 11440 | |
| 11441 | #endif /* UPB_LEX_UNICODE_H_ */ |
| 11442 | |
| 11443 | #ifndef UPB_REFLECTION_MESSAGE_H_ |
| 11444 | #define UPB_REFLECTION_MESSAGE_H_ |
| 11445 | |
| 11446 | |
| 11447 | // Must be last. |
| 11448 | |
| 11449 | #ifdef __cplusplus |
| 11450 | extern "C" { |
| 11451 | #endif |
| 11452 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 11453 | // Returns a mutable pointer to a map, array, or submessage value. If the given |
| 11454 | // arena is non-NULL this will construct a new object if it was not previously |
| 11455 | // present. May not be called for primitive fields. |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11456 | UPB_API upb_MutableMessageValue upb_Message_Mutable(upb_Message* msg, |
| 11457 | const upb_FieldDef* f, |
| 11458 | upb_Arena* a); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11459 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 11460 | // 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] | 11461 | UPB_API const upb_FieldDef* upb_Message_WhichOneof(const upb_Message* msg, |
| 11462 | const upb_OneofDef* o); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11463 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 11464 | // Clear all data and unknown fields. |
| 11465 | void upb_Message_ClearByDef(upb_Message* msg, const upb_MessageDef* m); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11466 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 11467 | // Clears any field presence and sets the value back to its default. |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11468 | UPB_API void upb_Message_ClearFieldByDef(upb_Message* msg, |
| 11469 | const upb_FieldDef* f); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11470 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 11471 | // May only be called for fields where upb_FieldDef_HasPresence(f) == true. |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11472 | UPB_API bool upb_Message_HasFieldByDef(const upb_Message* msg, |
| 11473 | const upb_FieldDef* f); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11474 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 11475 | // Returns the value in the message associated with this field def. |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11476 | UPB_API upb_MessageValue upb_Message_GetFieldByDef(const upb_Message* msg, |
| 11477 | const upb_FieldDef* f); |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 11478 | |
| 11479 | // Sets the given field to the given value. For a msg/array/map/string, the |
| 11480 | // caller must ensure that the target data outlives |msg| (by living either in |
| 11481 | // the same arena or a different arena that outlives it). |
| 11482 | // |
| 11483 | // Returns false if allocation fails. |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11484 | UPB_API bool upb_Message_SetFieldByDef(upb_Message* msg, const upb_FieldDef* f, |
| 11485 | upb_MessageValue val, upb_Arena* a); |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 11486 | |
| 11487 | // Iterate over present fields. |
| 11488 | // |
| 11489 | // size_t iter = kUpb_Message_Begin; |
| 11490 | // const upb_FieldDef *f; |
| 11491 | // upb_MessageValue val; |
| 11492 | // while (upb_Message_Next(msg, m, ext_pool, &f, &val, &iter)) { |
| 11493 | // process_field(f, val); |
| 11494 | // } |
| 11495 | // |
| 11496 | // If ext_pool is NULL, no extensions will be returned. If the given symtab |
| 11497 | // returns extensions that don't match what is in this message, those extensions |
| 11498 | // will be skipped. |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11499 | |
| 11500 | #define kUpb_Message_Begin -1 |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 11501 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11502 | bool upb_Message_Next(const upb_Message* msg, const upb_MessageDef* m, |
| 11503 | const upb_DefPool* ext_pool, const upb_FieldDef** f, |
| 11504 | upb_MessageValue* val, size_t* iter); |
| 11505 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 11506 | // Clears all unknown field data from this message and all submessages. |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11507 | UPB_API bool upb_Message_DiscardUnknown(upb_Message* msg, |
| 11508 | const upb_MessageDef* m, int maxdepth); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11509 | |
| 11510 | #ifdef __cplusplus |
| 11511 | } /* extern "C" */ |
| 11512 | #endif |
| 11513 | |
| 11514 | |
| 11515 | #endif /* UPB_REFLECTION_MESSAGE_H_ */ |
| 11516 | |
| 11517 | #ifndef UPB_JSON_ENCODE_H_ |
| 11518 | #define UPB_JSON_ENCODE_H_ |
| 11519 | |
| 11520 | |
| 11521 | // Must be last. |
| 11522 | |
| 11523 | #ifdef __cplusplus |
| 11524 | extern "C" { |
| 11525 | #endif |
| 11526 | |
| 11527 | enum { |
| 11528 | /* When set, emits 0/default values. TODO(haberman): proto3 only? */ |
| 11529 | upb_JsonEncode_EmitDefaults = 1 << 0, |
| 11530 | |
| 11531 | /* When set, use normal (snake_case) field names instead of JSON (camelCase) |
| 11532 | names. */ |
| 11533 | upb_JsonEncode_UseProtoNames = 1 << 1, |
| 11534 | |
| 11535 | /* When set, emits enums as their integer values instead of as their names. */ |
| 11536 | upb_JsonEncode_FormatEnumsAsIntegers = 1 << 2 |
| 11537 | }; |
| 11538 | |
| 11539 | /* 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] | 11540 | * |m|. The DefPool in |ext_pool| is used to find extensions (if NULL, |
| 11541 | * extensions will not be printed). |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11542 | * |
| 11543 | * Output is placed in the given buffer, and always NULL-terminated. The output |
| 11544 | * size (excluding NULL) is returned. This means that a return value >= |size| |
| 11545 | * implies that the output was truncated. (These are the same semantics as |
| 11546 | * snprintf()). */ |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11547 | UPB_API size_t upb_JsonEncode(const upb_Message* msg, const upb_MessageDef* m, |
| 11548 | const upb_DefPool* ext_pool, int options, |
| 11549 | char* buf, size_t size, upb_Status* status); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11550 | |
| 11551 | #ifdef __cplusplus |
| 11552 | } /* extern "C" */ |
| 11553 | #endif |
| 11554 | |
| 11555 | |
| 11556 | #endif /* UPB_JSONENCODE_H_ */ |
| 11557 | |
| 11558 | #ifndef UPB_LEX_ROUND_TRIP_H_ |
| 11559 | #define UPB_LEX_ROUND_TRIP_H_ |
| 11560 | |
| 11561 | // Must be last. |
| 11562 | |
| 11563 | // Encodes a float or double that is round-trippable, but as short as possible. |
| 11564 | // These routines are not fully optimal (not guaranteed to be shortest), but are |
| 11565 | // short-ish and match the implementation that has been used in protobuf since |
| 11566 | // the beginning. |
| 11567 | |
| 11568 | // The given buffer size must be at least kUpb_RoundTripBufferSize. |
| 11569 | enum { kUpb_RoundTripBufferSize = 32 }; |
| 11570 | |
| 11571 | #ifdef __cplusplus |
| 11572 | extern "C" { |
| 11573 | #endif |
| 11574 | |
| 11575 | void _upb_EncodeRoundTripDouble(double val, char* buf, size_t size); |
| 11576 | void _upb_EncodeRoundTripFloat(float val, char* buf, size_t size); |
| 11577 | |
| 11578 | #ifdef __cplusplus |
| 11579 | } /* extern "C" */ |
| 11580 | #endif |
| 11581 | |
| 11582 | |
| 11583 | #endif /* UPB_LEX_ROUND_TRIP_H_ */ |
| 11584 | |
| 11585 | #ifndef UPB_PORT_VSNPRINTF_COMPAT_H_ |
| 11586 | #define UPB_PORT_VSNPRINTF_COMPAT_H_ |
| 11587 | |
| 11588 | // Must be last. |
| 11589 | |
| 11590 | UPB_INLINE int _upb_vsnprintf(char* buf, size_t size, const char* fmt, |
| 11591 | va_list ap) { |
| 11592 | #if defined(__MINGW64__) || defined(__MINGW32__) || defined(_MSC_VER) |
| 11593 | // The msvc runtime has a non-conforming vsnprintf() that requires the |
| 11594 | // following compatibility code to become conformant. |
| 11595 | int n = -1; |
| 11596 | if (size != 0) n = _vsnprintf_s(buf, size, _TRUNCATE, fmt, ap); |
| 11597 | if (n == -1) n = _vscprintf(fmt, ap); |
| 11598 | return n; |
| 11599 | #else |
| 11600 | return vsnprintf(buf, size, fmt, ap); |
| 11601 | #endif |
| 11602 | } |
| 11603 | |
| 11604 | |
| 11605 | #endif // UPB_PORT_VSNPRINTF_COMPAT_H_ |
| 11606 | |
| 11607 | #ifndef UPB_LEX_STRTOD_H_ |
| 11608 | #define UPB_LEX_STRTOD_H_ |
| 11609 | |
| 11610 | // Must be last. |
| 11611 | |
| 11612 | #ifdef __cplusplus |
| 11613 | extern "C" { |
| 11614 | #endif |
| 11615 | |
| 11616 | double _upb_NoLocaleStrtod(const char *str, char **endptr); |
| 11617 | |
| 11618 | #ifdef __cplusplus |
| 11619 | } /* extern "C" */ |
| 11620 | #endif |
| 11621 | |
| 11622 | |
| 11623 | #endif /* UPB_LEX_STRTOD_H_ */ |
| 11624 | |
Sandy Zhang | e3b0943 | 2023-08-07 09:30:02 -0700 | [diff] [blame] | 11625 | #ifndef UPB_MEM_INTERNAL_ARENA_H_ |
| 11626 | #define UPB_MEM_INTERNAL_ARENA_H_ |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11627 | |
| 11628 | |
| 11629 | // Must be last. |
| 11630 | |
| 11631 | typedef struct _upb_MemBlock _upb_MemBlock; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 11632 | |
| 11633 | struct upb_Arena { |
| 11634 | _upb_ArenaHead head; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 11635 | |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 11636 | // upb_alloc* together with a low bit which signals if there is an initial |
| 11637 | // block. |
| 11638 | uintptr_t block_alloc; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 11639 | |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 11640 | // When multiple arenas are fused together, each arena points to a parent |
| 11641 | // arena (root points to itself). The root tracks how many live arenas |
| 11642 | // reference it. |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 11643 | |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 11644 | // The low bit is tagged: |
| 11645 | // 0: pointer to parent |
| 11646 | // 1: count, left shifted by one |
| 11647 | UPB_ATOMIC(uintptr_t) parent_or_count; |
| 11648 | |
| 11649 | // All nodes that are fused together are in a singly-linked list. |
| 11650 | UPB_ATOMIC(upb_Arena*) next; // NULL at end of list. |
| 11651 | |
| 11652 | // The last element of the linked list. This is present only as an |
| 11653 | // optimization, so that we do not have to iterate over all members for every |
| 11654 | // fuse. Only significant for an arena root. In other cases it is ignored. |
| 11655 | UPB_ATOMIC(upb_Arena*) tail; // == self when no other list members. |
| 11656 | |
| 11657 | // Linked list of blocks to free/cleanup. Atomic only for the benefit of |
| 11658 | // upb_Arena_SpaceAllocated(). |
| 11659 | UPB_ATOMIC(_upb_MemBlock*) blocks; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 11660 | }; |
| 11661 | |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 11662 | UPB_INLINE bool _upb_Arena_IsTaggedRefcount(uintptr_t parent_or_count) { |
| 11663 | return (parent_or_count & 1) == 1; |
| 11664 | } |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11665 | |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 11666 | UPB_INLINE bool _upb_Arena_IsTaggedPointer(uintptr_t parent_or_count) { |
| 11667 | return (parent_or_count & 1) == 0; |
| 11668 | } |
| 11669 | |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 11670 | UPB_INLINE uintptr_t _upb_Arena_RefCountFromTagged(uintptr_t parent_or_count) { |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 11671 | UPB_ASSERT(_upb_Arena_IsTaggedRefcount(parent_or_count)); |
| 11672 | return parent_or_count >> 1; |
| 11673 | } |
| 11674 | |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 11675 | UPB_INLINE uintptr_t _upb_Arena_TaggedFromRefcount(uintptr_t refcount) { |
| 11676 | uintptr_t parent_or_count = (refcount << 1) | 1; |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 11677 | UPB_ASSERT(_upb_Arena_IsTaggedRefcount(parent_or_count)); |
| 11678 | return parent_or_count; |
| 11679 | } |
| 11680 | |
| 11681 | UPB_INLINE upb_Arena* _upb_Arena_PointerFromTagged(uintptr_t parent_or_count) { |
| 11682 | UPB_ASSERT(_upb_Arena_IsTaggedPointer(parent_or_count)); |
| 11683 | return (upb_Arena*)parent_or_count; |
| 11684 | } |
| 11685 | |
| 11686 | UPB_INLINE uintptr_t _upb_Arena_TaggedFromPointer(upb_Arena* a) { |
| 11687 | uintptr_t parent_or_count = (uintptr_t)a; |
| 11688 | UPB_ASSERT(_upb_Arena_IsTaggedPointer(parent_or_count)); |
| 11689 | return parent_or_count; |
| 11690 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 11691 | |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 11692 | UPB_INLINE upb_alloc* upb_Arena_BlockAlloc(upb_Arena* arena) { |
| 11693 | return (upb_alloc*)(arena->block_alloc & ~0x1); |
| 11694 | } |
| 11695 | |
| 11696 | UPB_INLINE uintptr_t upb_Arena_MakeBlockAlloc(upb_alloc* alloc, |
| 11697 | bool has_initial) { |
| 11698 | uintptr_t alloc_uint = (uintptr_t)alloc; |
| 11699 | UPB_ASSERT((alloc_uint & 1) == 0); |
| 11700 | return alloc_uint | (has_initial ? 1 : 0); |
| 11701 | } |
| 11702 | |
| 11703 | UPB_INLINE bool upb_Arena_HasInitialBlock(upb_Arena* arena) { |
| 11704 | return arena->block_alloc & 0x1; |
| 11705 | } |
| 11706 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 11707 | |
Sandy Zhang | e3b0943 | 2023-08-07 09:30:02 -0700 | [diff] [blame] | 11708 | #endif /* UPB_MEM_INTERNAL_ARENA_H_ */ |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11709 | |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 11710 | #ifndef UPB_PORT_ATOMIC_H_ |
| 11711 | #define UPB_PORT_ATOMIC_H_ |
| 11712 | |
| 11713 | |
| 11714 | #ifdef UPB_USE_C11_ATOMICS |
| 11715 | |
| 11716 | #include <stdatomic.h> |
| 11717 | #include <stdbool.h> |
| 11718 | |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 11719 | #define upb_Atomic_Init(addr, val) atomic_init(addr, val) |
| 11720 | #define upb_Atomic_Load(addr, order) atomic_load_explicit(addr, order) |
| 11721 | #define upb_Atomic_Store(addr, val, order) \ |
| 11722 | atomic_store_explicit(addr, val, order) |
| 11723 | #define upb_Atomic_Add(addr, val, order) \ |
| 11724 | atomic_fetch_add_explicit(addr, val, order) |
| 11725 | #define upb_Atomic_Sub(addr, val, order) \ |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 11726 | atomic_fetch_sub_explicit(addr, val, order) |
| 11727 | #define upb_Atomic_Exchange(addr, val, order) \ |
| 11728 | atomic_exchange_explicit(addr, val, order) |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 11729 | #define upb_Atomic_CompareExchangeStrong(addr, expected, desired, \ |
| 11730 | success_order, failure_order) \ |
| 11731 | atomic_compare_exchange_strong_explicit(addr, expected, desired, \ |
| 11732 | success_order, failure_order) |
| 11733 | #define upb_Atomic_CompareExchangeWeak(addr, expected, desired, success_order, \ |
| 11734 | failure_order) \ |
| 11735 | atomic_compare_exchange_weak_explicit(addr, expected, desired, \ |
| 11736 | success_order, failure_order) |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 11737 | |
| 11738 | #else // !UPB_USE_C11_ATOMICS |
| 11739 | |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 11740 | #include <string.h> |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 11741 | |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 11742 | #define upb_Atomic_Init(addr, val) (*addr = val) |
| 11743 | #define upb_Atomic_Load(addr, order) (*addr) |
| 11744 | #define upb_Atomic_Store(addr, val, order) (*(addr) = val) |
| 11745 | #define upb_Atomic_Add(addr, val, order) (*(addr) += val) |
| 11746 | #define upb_Atomic_Sub(addr, val, order) (*(addr) -= val) |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 11747 | |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 11748 | UPB_INLINE void* _upb_NonAtomic_Exchange(void* addr, void* value) { |
| 11749 | void* old; |
| 11750 | memcpy(&old, addr, sizeof(value)); |
| 11751 | memcpy(addr, &value, sizeof(value)); |
| 11752 | return old; |
| 11753 | } |
| 11754 | |
| 11755 | #define upb_Atomic_Exchange(addr, val, order) _upb_NonAtomic_Exchange(addr, val) |
| 11756 | |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 11757 | // `addr` and `expected` are logically double pointers. |
| 11758 | UPB_INLINE bool _upb_NonAtomic_CompareExchangeStrongP(void* addr, |
| 11759 | void* expected, |
| 11760 | void* desired) { |
| 11761 | if (memcmp(addr, expected, sizeof(desired)) == 0) { |
| 11762 | memcpy(addr, &desired, sizeof(desired)); |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 11763 | return true; |
| 11764 | } else { |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 11765 | memcpy(expected, addr, sizeof(desired)); |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 11766 | return false; |
| 11767 | } |
| 11768 | } |
| 11769 | |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 11770 | #define upb_Atomic_CompareExchangeStrong(addr, expected, desired, \ |
| 11771 | success_order, failure_order) \ |
| 11772 | _upb_NonAtomic_CompareExchangeStrongP((void*)addr, (void*)expected, \ |
| 11773 | (void*)desired) |
| 11774 | #define upb_Atomic_CompareExchangeWeak(addr, expected, desired, success_order, \ |
| 11775 | failure_order) \ |
| 11776 | upb_Atomic_CompareExchangeStrong(addr, expected, desired, 0, 0) |
| 11777 | |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 11778 | #endif |
| 11779 | |
| 11780 | |
| 11781 | #endif // UPB_PORT_ATOMIC_H_ |
| 11782 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 11783 | #ifndef UPB_WIRE_READER_H_ |
| 11784 | #define UPB_WIRE_READER_H_ |
| 11785 | |
| 11786 | |
Sandy Zhang | e3b0943 | 2023-08-07 09:30:02 -0700 | [diff] [blame] | 11787 | #ifndef UPB_WIRE_INTERNAL_SWAP_H_ |
| 11788 | #define UPB_WIRE_INTERNAL_SWAP_H_ |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 11789 | |
Adam Cozzette | 7d5592e | 2023-08-23 12:15:26 -0700 | [diff] [blame] | 11790 | #include <stdint.h> |
| 11791 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 11792 | // Must be last. |
| 11793 | |
| 11794 | #ifdef __cplusplus |
| 11795 | extern "C" { |
| 11796 | #endif |
| 11797 | |
| 11798 | UPB_INLINE bool _upb_IsLittleEndian(void) { |
| 11799 | int x = 1; |
| 11800 | return *(char*)&x == 1; |
| 11801 | } |
| 11802 | |
| 11803 | UPB_INLINE uint32_t _upb_BigEndian_Swap32(uint32_t val) { |
| 11804 | if (_upb_IsLittleEndian()) return val; |
| 11805 | |
| 11806 | return ((val & 0xff) << 24) | ((val & 0xff00) << 8) | |
| 11807 | ((val & 0xff0000) >> 8) | ((val & 0xff000000) >> 24); |
| 11808 | } |
| 11809 | |
| 11810 | UPB_INLINE uint64_t _upb_BigEndian_Swap64(uint64_t val) { |
| 11811 | if (_upb_IsLittleEndian()) return val; |
| 11812 | |
| 11813 | return ((uint64_t)_upb_BigEndian_Swap32((uint32_t)val) << 32) | |
| 11814 | _upb_BigEndian_Swap32((uint32_t)(val >> 32)); |
| 11815 | } |
| 11816 | |
| 11817 | #ifdef __cplusplus |
| 11818 | } /* extern "C" */ |
| 11819 | #endif |
| 11820 | |
| 11821 | |
Sandy Zhang | e3b0943 | 2023-08-07 09:30:02 -0700 | [diff] [blame] | 11822 | #endif /* UPB_WIRE_INTERNAL_SWAP_H_ */ |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 11823 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 11824 | // Must be last. |
| 11825 | |
| 11826 | #ifdef __cplusplus |
| 11827 | extern "C" { |
| 11828 | #endif |
| 11829 | |
| 11830 | // The upb_WireReader interface is suitable for general-purpose parsing of |
| 11831 | // protobuf binary wire format. It is designed to be used along with |
| 11832 | // upb_EpsCopyInputStream for buffering, and all parsing routines in this file |
| 11833 | // assume that at least kUpb_EpsCopyInputStream_SlopBytes worth of data is |
| 11834 | // available to read without any bounds checks. |
| 11835 | |
| 11836 | #define kUpb_WireReader_WireTypeMask 7 |
| 11837 | #define kUpb_WireReader_WireTypeBits 3 |
| 11838 | |
| 11839 | typedef struct { |
| 11840 | const char* ptr; |
| 11841 | uint64_t val; |
| 11842 | } _upb_WireReader_ReadLongVarintRet; |
| 11843 | |
| 11844 | _upb_WireReader_ReadLongVarintRet _upb_WireReader_ReadLongVarint( |
| 11845 | const char* ptr, uint64_t val); |
| 11846 | |
| 11847 | static UPB_FORCEINLINE const char* _upb_WireReader_ReadVarint(const char* ptr, |
| 11848 | uint64_t* val, |
| 11849 | int maxlen, |
| 11850 | uint64_t maxval) { |
| 11851 | uint64_t byte = (uint8_t)*ptr; |
| 11852 | if (UPB_LIKELY((byte & 0x80) == 0)) { |
| 11853 | *val = (uint32_t)byte; |
| 11854 | return ptr + 1; |
| 11855 | } |
| 11856 | const char* start = ptr; |
| 11857 | _upb_WireReader_ReadLongVarintRet res = |
| 11858 | _upb_WireReader_ReadLongVarint(ptr, byte); |
| 11859 | if (!res.ptr || (maxlen < 10 && res.ptr - start > maxlen) || |
| 11860 | res.val > maxval) { |
| 11861 | return NULL; // Malformed. |
| 11862 | } |
| 11863 | *val = res.val; |
| 11864 | return res.ptr; |
| 11865 | } |
| 11866 | |
| 11867 | // Parses a tag into `tag`, and returns a pointer past the end of the tag, or |
| 11868 | // NULL if there was an error in the tag data. |
| 11869 | // |
| 11870 | // REQUIRES: there must be at least 10 bytes of data available at `ptr`. |
| 11871 | // Bounds checks must be performed before calling this function, preferably |
| 11872 | // by calling upb_EpsCopyInputStream_IsDone(). |
| 11873 | static UPB_FORCEINLINE const char* upb_WireReader_ReadTag(const char* ptr, |
| 11874 | uint32_t* tag) { |
| 11875 | uint64_t val; |
| 11876 | ptr = _upb_WireReader_ReadVarint(ptr, &val, 5, UINT32_MAX); |
| 11877 | if (!ptr) return NULL; |
| 11878 | *tag = val; |
| 11879 | return ptr; |
| 11880 | } |
| 11881 | |
| 11882 | // Given a tag, returns the field number. |
| 11883 | UPB_INLINE uint32_t upb_WireReader_GetFieldNumber(uint32_t tag) { |
| 11884 | return tag >> kUpb_WireReader_WireTypeBits; |
| 11885 | } |
| 11886 | |
| 11887 | // Given a tag, returns the wire type. |
| 11888 | UPB_INLINE uint8_t upb_WireReader_GetWireType(uint32_t tag) { |
| 11889 | return tag & kUpb_WireReader_WireTypeMask; |
| 11890 | } |
| 11891 | |
| 11892 | UPB_INLINE const char* upb_WireReader_ReadVarint(const char* ptr, |
| 11893 | uint64_t* val) { |
| 11894 | return _upb_WireReader_ReadVarint(ptr, val, 10, UINT64_MAX); |
| 11895 | } |
| 11896 | |
| 11897 | // Skips data for a varint, returning a pointer past the end of the varint, or |
| 11898 | // NULL if there was an error in the varint data. |
| 11899 | // |
| 11900 | // REQUIRES: there must be at least 10 bytes of data available at `ptr`. |
| 11901 | // Bounds checks must be performed before calling this function, preferably |
| 11902 | // by calling upb_EpsCopyInputStream_IsDone(). |
| 11903 | UPB_INLINE const char* upb_WireReader_SkipVarint(const char* ptr) { |
| 11904 | uint64_t val; |
| 11905 | return upb_WireReader_ReadVarint(ptr, &val); |
| 11906 | } |
| 11907 | |
| 11908 | // Reads a varint indicating the size of a delimited field into `size`, or |
| 11909 | // NULL if there was an error in the varint data. |
| 11910 | // |
| 11911 | // REQUIRES: there must be at least 10 bytes of data available at `ptr`. |
| 11912 | // Bounds checks must be performed before calling this function, preferably |
| 11913 | // by calling upb_EpsCopyInputStream_IsDone(). |
| 11914 | UPB_INLINE const char* upb_WireReader_ReadSize(const char* ptr, int* size) { |
| 11915 | uint64_t size64; |
| 11916 | ptr = upb_WireReader_ReadVarint(ptr, &size64); |
| 11917 | if (!ptr || size64 >= INT32_MAX) return NULL; |
| 11918 | *size = size64; |
| 11919 | return ptr; |
| 11920 | } |
| 11921 | |
| 11922 | // Reads a fixed32 field, performing byte swapping if necessary. |
| 11923 | // |
| 11924 | // REQUIRES: there must be at least 4 bytes of data available at `ptr`. |
| 11925 | // Bounds checks must be performed before calling this function, preferably |
| 11926 | // by calling upb_EpsCopyInputStream_IsDone(). |
| 11927 | UPB_INLINE const char* upb_WireReader_ReadFixed32(const char* ptr, void* val) { |
| 11928 | uint32_t uval; |
| 11929 | memcpy(&uval, ptr, 4); |
| 11930 | uval = _upb_BigEndian_Swap32(uval); |
| 11931 | memcpy(val, &uval, 4); |
| 11932 | return ptr + 4; |
| 11933 | } |
| 11934 | |
| 11935 | // Reads a fixed64 field, performing byte swapping if necessary. |
| 11936 | // |
| 11937 | // REQUIRES: there must be at least 4 bytes of data available at `ptr`. |
| 11938 | // Bounds checks must be performed before calling this function, preferably |
| 11939 | // by calling upb_EpsCopyInputStream_IsDone(). |
| 11940 | UPB_INLINE const char* upb_WireReader_ReadFixed64(const char* ptr, void* val) { |
| 11941 | uint64_t uval; |
| 11942 | memcpy(&uval, ptr, 8); |
| 11943 | uval = _upb_BigEndian_Swap64(uval); |
| 11944 | memcpy(val, &uval, 8); |
| 11945 | return ptr + 8; |
| 11946 | } |
| 11947 | |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 11948 | const char* _upb_WireReader_SkipGroup(const char* ptr, uint32_t tag, |
| 11949 | int depth_limit, |
| 11950 | upb_EpsCopyInputStream* stream); |
| 11951 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 11952 | // Skips data for a group, returning a pointer past the end of the group, or |
| 11953 | // NULL if there was an error parsing the group. The `tag` argument should be |
| 11954 | // the start group tag that begins the group. The `depth_limit` argument |
| 11955 | // indicates how many levels of recursion the group is allowed to have before |
| 11956 | // reporting a parse error (this limit exists to protect against stack |
| 11957 | // overflow). |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 11958 | // |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 11959 | // TODO: evaluate how the depth_limit should be specified. Do users need |
| 11960 | // control over this? |
| 11961 | UPB_INLINE const char* upb_WireReader_SkipGroup( |
| 11962 | const char* ptr, uint32_t tag, upb_EpsCopyInputStream* stream) { |
| 11963 | return _upb_WireReader_SkipGroup(ptr, tag, 100, stream); |
| 11964 | } |
| 11965 | |
| 11966 | UPB_INLINE const char* _upb_WireReader_SkipValue( |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 11967 | const char* ptr, uint32_t tag, int depth_limit, |
| 11968 | upb_EpsCopyInputStream* stream) { |
| 11969 | switch (upb_WireReader_GetWireType(tag)) { |
| 11970 | case kUpb_WireType_Varint: |
| 11971 | return upb_WireReader_SkipVarint(ptr); |
| 11972 | case kUpb_WireType_32Bit: |
| 11973 | return ptr + 4; |
| 11974 | case kUpb_WireType_64Bit: |
| 11975 | return ptr + 8; |
| 11976 | case kUpb_WireType_Delimited: { |
| 11977 | int size; |
| 11978 | ptr = upb_WireReader_ReadSize(ptr, &size); |
| 11979 | if (!ptr) return NULL; |
| 11980 | ptr += size; |
| 11981 | return ptr; |
| 11982 | } |
| 11983 | case kUpb_WireType_StartGroup: |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 11984 | return _upb_WireReader_SkipGroup(ptr, tag, depth_limit, stream); |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 11985 | case kUpb_WireType_EndGroup: |
| 11986 | return NULL; // Should be handled before now. |
| 11987 | default: |
| 11988 | return NULL; // Unknown wire type. |
| 11989 | } |
| 11990 | } |
| 11991 | |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 11992 | // Skips data for a wire value of any type, returning a pointer past the end of |
| 11993 | // the data, or NULL if there was an error parsing the group. The `tag` argument |
| 11994 | // should be the tag that was just parsed. The `depth_limit` argument indicates |
| 11995 | // how many levels of recursion a group is allowed to have before reporting a |
| 11996 | // parse error (this limit exists to protect against stack overflow). |
| 11997 | // |
| 11998 | // REQUIRES: there must be at least 10 bytes of data available at `ptr`. |
| 11999 | // Bounds checks must be performed before calling this function, preferably |
| 12000 | // by calling upb_EpsCopyInputStream_IsDone(). |
| 12001 | // |
| 12002 | // TODO: evaluate how the depth_limit should be specified. Do users need |
| 12003 | // control over this? |
| 12004 | UPB_INLINE const char* upb_WireReader_SkipValue( |
| 12005 | const char* ptr, uint32_t tag, upb_EpsCopyInputStream* stream) { |
| 12006 | return _upb_WireReader_SkipValue(ptr, tag, 100, stream); |
| 12007 | } |
| 12008 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 12009 | #ifdef __cplusplus |
| 12010 | } /* extern "C" */ |
| 12011 | #endif |
| 12012 | |
| 12013 | |
| 12014 | #endif // UPB_WIRE_READER_H_ |
| 12015 | |
Adam Cozzette | 8059da2 | 2023-08-16 07:57:14 -0700 | [diff] [blame] | 12016 | #ifndef UPB_MINI_DESCRIPTOR_INTERNAL_DECODER_H_ |
| 12017 | #define UPB_MINI_DESCRIPTOR_INTERNAL_DECODER_H_ |
| 12018 | |
| 12019 | |
| 12020 | #ifndef UPB_MINI_DESCRIPTOR_INTERNAL_BASE92_H_ |
| 12021 | #define UPB_MINI_DESCRIPTOR_INTERNAL_BASE92_H_ |
| 12022 | |
Adam Cozzette | 7d5592e | 2023-08-23 12:15:26 -0700 | [diff] [blame] | 12023 | #include <stdint.h> |
| 12024 | |
Adam Cozzette | 8059da2 | 2023-08-16 07:57:14 -0700 | [diff] [blame] | 12025 | |
| 12026 | // Must be last. |
| 12027 | |
| 12028 | #ifdef __cplusplus |
| 12029 | extern "C" { |
| 12030 | #endif |
| 12031 | |
| 12032 | UPB_INLINE char _upb_ToBase92(int8_t ch) { |
| 12033 | extern const char _kUpb_ToBase92[]; |
| 12034 | UPB_ASSERT(0 <= ch && ch < 92); |
| 12035 | return _kUpb_ToBase92[ch]; |
| 12036 | } |
| 12037 | |
| 12038 | UPB_INLINE char _upb_FromBase92(uint8_t ch) { |
| 12039 | extern const int8_t _kUpb_FromBase92[]; |
| 12040 | if (' ' > ch || ch > '~') return -1; |
| 12041 | return _kUpb_FromBase92[ch - ' ']; |
| 12042 | } |
| 12043 | |
| 12044 | UPB_INLINE const char* _upb_Base92_DecodeVarint(const char* ptr, |
| 12045 | const char* end, char first_ch, |
| 12046 | uint8_t min, uint8_t max, |
| 12047 | uint32_t* out_val) { |
| 12048 | uint32_t val = 0; |
| 12049 | uint32_t shift = 0; |
| 12050 | const int bits_per_char = |
| 12051 | upb_Log2Ceiling(_upb_FromBase92(max) - _upb_FromBase92(min)); |
| 12052 | char ch = first_ch; |
| 12053 | while (1) { |
| 12054 | uint32_t bits = _upb_FromBase92(ch) - _upb_FromBase92(min); |
| 12055 | val |= bits << shift; |
| 12056 | if (ptr == end || *ptr < min || max < *ptr) { |
| 12057 | *out_val = val; |
| 12058 | UPB_ASSUME(ptr != NULL); |
| 12059 | return ptr; |
| 12060 | } |
| 12061 | ch = *ptr++; |
| 12062 | shift += bits_per_char; |
| 12063 | if (shift >= 32) return NULL; |
| 12064 | } |
| 12065 | } |
| 12066 | |
| 12067 | #ifdef __cplusplus |
| 12068 | } /* extern "C" */ |
| 12069 | #endif |
| 12070 | |
| 12071 | |
| 12072 | #endif // UPB_MINI_DESCRIPTOR_INTERNAL_BASE92_H_ |
| 12073 | |
| 12074 | // Must be last. |
| 12075 | |
| 12076 | // upb_MdDecoder: used internally for decoding MiniDescriptors for messages, |
| 12077 | // extensions, and enums. |
| 12078 | typedef struct { |
| 12079 | const char* end; |
| 12080 | upb_Status* status; |
| 12081 | jmp_buf err; |
| 12082 | } upb_MdDecoder; |
| 12083 | |
| 12084 | UPB_PRINTF(2, 3) |
| 12085 | UPB_NORETURN UPB_INLINE void upb_MdDecoder_ErrorJmp(upb_MdDecoder* d, |
| 12086 | const char* fmt, ...) { |
| 12087 | if (d->status) { |
| 12088 | va_list argp; |
| 12089 | upb_Status_SetErrorMessage(d->status, "Error building mini table: "); |
| 12090 | va_start(argp, fmt); |
| 12091 | upb_Status_VAppendErrorFormat(d->status, fmt, argp); |
| 12092 | va_end(argp); |
| 12093 | } |
| 12094 | UPB_LONGJMP(d->err, 1); |
| 12095 | } |
| 12096 | |
| 12097 | UPB_INLINE void upb_MdDecoder_CheckOutOfMemory(upb_MdDecoder* d, |
| 12098 | const void* ptr) { |
| 12099 | if (!ptr) upb_MdDecoder_ErrorJmp(d, "Out of memory"); |
| 12100 | } |
| 12101 | |
| 12102 | UPB_INLINE const char* upb_MdDecoder_DecodeBase92Varint( |
| 12103 | upb_MdDecoder* d, const char* ptr, char first_ch, uint8_t min, uint8_t max, |
| 12104 | uint32_t* out_val) { |
| 12105 | ptr = _upb_Base92_DecodeVarint(ptr, d->end, first_ch, min, max, out_val); |
| 12106 | if (!ptr) upb_MdDecoder_ErrorJmp(d, "Overlong varint"); |
| 12107 | return ptr; |
| 12108 | } |
| 12109 | |
| 12110 | |
| 12111 | #endif // UPB_MINI_DESCRIPTOR_INTERNAL_DECODER_H_ |
| 12112 | |
| 12113 | #ifndef UPB_MINI_DESCRIPTOR_INTERNAL_WIRE_CONSTANTS_H_ |
| 12114 | #define UPB_MINI_DESCRIPTOR_INTERNAL_WIRE_CONSTANTS_H_ |
| 12115 | |
| 12116 | |
| 12117 | // Must be last. |
| 12118 | |
| 12119 | typedef enum { |
| 12120 | kUpb_EncodedType_Double = 0, |
| 12121 | kUpb_EncodedType_Float = 1, |
| 12122 | kUpb_EncodedType_Fixed32 = 2, |
| 12123 | kUpb_EncodedType_Fixed64 = 3, |
| 12124 | kUpb_EncodedType_SFixed32 = 4, |
| 12125 | kUpb_EncodedType_SFixed64 = 5, |
| 12126 | kUpb_EncodedType_Int32 = 6, |
| 12127 | kUpb_EncodedType_UInt32 = 7, |
| 12128 | kUpb_EncodedType_SInt32 = 8, |
| 12129 | kUpb_EncodedType_Int64 = 9, |
| 12130 | kUpb_EncodedType_UInt64 = 10, |
| 12131 | kUpb_EncodedType_SInt64 = 11, |
| 12132 | kUpb_EncodedType_OpenEnum = 12, |
| 12133 | kUpb_EncodedType_Bool = 13, |
| 12134 | kUpb_EncodedType_Bytes = 14, |
| 12135 | kUpb_EncodedType_String = 15, |
| 12136 | kUpb_EncodedType_Group = 16, |
| 12137 | kUpb_EncodedType_Message = 17, |
| 12138 | kUpb_EncodedType_ClosedEnum = 18, |
| 12139 | |
| 12140 | kUpb_EncodedType_RepeatedBase = 20, |
| 12141 | } upb_EncodedType; |
| 12142 | |
| 12143 | typedef enum { |
| 12144 | kUpb_EncodedFieldModifier_FlipPacked = 1 << 0, |
| 12145 | kUpb_EncodedFieldModifier_IsRequired = 1 << 1, |
| 12146 | kUpb_EncodedFieldModifier_IsProto3Singular = 1 << 2, |
| 12147 | } upb_EncodedFieldModifier; |
| 12148 | |
| 12149 | enum { |
| 12150 | kUpb_EncodedValue_MinField = ' ', |
| 12151 | kUpb_EncodedValue_MaxField = 'I', |
| 12152 | kUpb_EncodedValue_MinModifier = 'L', |
| 12153 | kUpb_EncodedValue_MaxModifier = '[', |
| 12154 | kUpb_EncodedValue_End = '^', |
| 12155 | kUpb_EncodedValue_MinSkip = '_', |
| 12156 | kUpb_EncodedValue_MaxSkip = '~', |
| 12157 | kUpb_EncodedValue_OneofSeparator = '~', |
| 12158 | kUpb_EncodedValue_FieldSeparator = '|', |
| 12159 | kUpb_EncodedValue_MinOneofField = ' ', |
| 12160 | kUpb_EncodedValue_MaxOneofField = 'b', |
| 12161 | kUpb_EncodedValue_MaxEnumMask = 'A', |
| 12162 | }; |
| 12163 | |
| 12164 | enum { |
| 12165 | kUpb_EncodedVersion_EnumV1 = '!', |
| 12166 | kUpb_EncodedVersion_ExtensionV1 = '#', |
| 12167 | kUpb_EncodedVersion_MapV1 = '%', |
| 12168 | kUpb_EncodedVersion_MessageV1 = '$', |
| 12169 | kUpb_EncodedVersion_MessageSetV1 = '&', |
| 12170 | }; |
| 12171 | |
| 12172 | |
| 12173 | #endif // UPB_MINI_DESCRIPTOR_INTERNAL_WIRE_CONSTANTS_H_ |
| 12174 | |
| 12175 | #ifndef UPB_MINI_DESCRIPTOR_INTERNAL_MODIFIERS_H_ |
| 12176 | #define UPB_MINI_DESCRIPTOR_INTERNAL_MODIFIERS_H_ |
| 12177 | |
| 12178 | // Must be last. |
| 12179 | |
| 12180 | typedef enum { |
| 12181 | kUpb_FieldModifier_IsRepeated = 1 << 0, |
| 12182 | kUpb_FieldModifier_IsPacked = 1 << 1, |
| 12183 | kUpb_FieldModifier_IsClosedEnum = 1 << 2, |
| 12184 | kUpb_FieldModifier_IsProto3Singular = 1 << 3, |
| 12185 | kUpb_FieldModifier_IsRequired = 1 << 4, |
| 12186 | } kUpb_FieldModifier; |
| 12187 | |
| 12188 | typedef enum { |
| 12189 | kUpb_MessageModifier_ValidateUtf8 = 1 << 0, |
| 12190 | kUpb_MessageModifier_DefaultIsPacked = 1 << 1, |
| 12191 | kUpb_MessageModifier_IsExtendable = 1 << 2, |
| 12192 | } kUpb_MessageModifier; |
| 12193 | |
| 12194 | |
| 12195 | #endif // UPB_MINI_DESCRIPTOR_INTERNAL_MODIFIERS_H_ |
| 12196 | |
| 12197 | #ifndef UPB_MINI_DESCRIPTOR_INTERNAL_ENCODE_H_ |
| 12198 | #define UPB_MINI_DESCRIPTOR_INTERNAL_ENCODE_H_ |
| 12199 | |
Adam Cozzette | 7d5592e | 2023-08-23 12:15:26 -0700 | [diff] [blame] | 12200 | #include <stdint.h> |
| 12201 | |
Adam Cozzette | 8059da2 | 2023-08-16 07:57:14 -0700 | [diff] [blame] | 12202 | |
| 12203 | // Must be last. |
| 12204 | |
| 12205 | // If the input buffer has at least this many bytes available, the encoder call |
| 12206 | // is guaranteed to succeed (as long as field number order is maintained). |
| 12207 | #define kUpb_MtDataEncoder_MinSize 16 |
| 12208 | |
| 12209 | typedef struct { |
| 12210 | char* end; // Limit of the buffer passed as a parameter. |
| 12211 | // Aliased to internal-only members in .cc. |
| 12212 | char internal[32]; |
| 12213 | } upb_MtDataEncoder; |
| 12214 | |
| 12215 | #ifdef __cplusplus |
| 12216 | extern "C" { |
| 12217 | #endif |
| 12218 | |
| 12219 | // Encodes field/oneof information for a given message. The sequence of calls |
| 12220 | // should look like: |
| 12221 | // |
| 12222 | // upb_MtDataEncoder e; |
| 12223 | // char buf[256]; |
| 12224 | // char* ptr = buf; |
| 12225 | // e.end = ptr + sizeof(buf); |
| 12226 | // unit64_t msg_mod = ...; // bitwise & of kUpb_MessageModifiers or zero |
| 12227 | // ptr = upb_MtDataEncoder_StartMessage(&e, ptr, msg_mod); |
| 12228 | // // Fields *must* be in field number order. |
| 12229 | // ptr = upb_MtDataEncoder_PutField(&e, ptr, ...); |
| 12230 | // ptr = upb_MtDataEncoder_PutField(&e, ptr, ...); |
| 12231 | // ptr = upb_MtDataEncoder_PutField(&e, ptr, ...); |
| 12232 | // |
| 12233 | // // If oneofs are present. Oneofs must be encoded after regular fields. |
| 12234 | // ptr = upb_MiniTable_StartOneof(&e, ptr) |
| 12235 | // ptr = upb_MiniTable_PutOneofField(&e, ptr, ...); |
| 12236 | // ptr = upb_MiniTable_PutOneofField(&e, ptr, ...); |
| 12237 | // |
| 12238 | // ptr = upb_MiniTable_StartOneof(&e, ptr); |
| 12239 | // ptr = upb_MiniTable_PutOneofField(&e, ptr, ...); |
| 12240 | // ptr = upb_MiniTable_PutOneofField(&e, ptr, ...); |
| 12241 | // |
| 12242 | // Oneofs must be encoded after all regular fields. |
| 12243 | char* upb_MtDataEncoder_StartMessage(upb_MtDataEncoder* e, char* ptr, |
| 12244 | uint64_t msg_mod); |
| 12245 | char* upb_MtDataEncoder_PutField(upb_MtDataEncoder* e, char* ptr, |
| 12246 | upb_FieldType type, uint32_t field_num, |
| 12247 | uint64_t field_mod); |
| 12248 | char* upb_MtDataEncoder_StartOneof(upb_MtDataEncoder* e, char* ptr); |
| 12249 | char* upb_MtDataEncoder_PutOneofField(upb_MtDataEncoder* e, char* ptr, |
| 12250 | uint32_t field_num); |
| 12251 | |
| 12252 | // Encodes the set of values for a given enum. The values must be given in |
| 12253 | // order (after casting to uint32_t), and repeats are not allowed. |
| 12254 | char* upb_MtDataEncoder_StartEnum(upb_MtDataEncoder* e, char* ptr); |
| 12255 | char* upb_MtDataEncoder_PutEnumValue(upb_MtDataEncoder* e, char* ptr, |
| 12256 | uint32_t val); |
| 12257 | char* upb_MtDataEncoder_EndEnum(upb_MtDataEncoder* e, char* ptr); |
| 12258 | |
| 12259 | // Encodes an entire mini descriptor for an extension. |
| 12260 | char* upb_MtDataEncoder_EncodeExtension(upb_MtDataEncoder* e, char* ptr, |
| 12261 | upb_FieldType type, uint32_t field_num, |
| 12262 | uint64_t field_mod); |
| 12263 | |
| 12264 | // Encodes an entire mini descriptor for a map. |
| 12265 | char* upb_MtDataEncoder_EncodeMap(upb_MtDataEncoder* e, char* ptr, |
| 12266 | upb_FieldType key_type, |
| 12267 | upb_FieldType value_type, uint64_t key_mod, |
| 12268 | uint64_t value_mod); |
| 12269 | |
| 12270 | // Encodes an entire mini descriptor for a message set. |
| 12271 | char* upb_MtDataEncoder_EncodeMessageSet(upb_MtDataEncoder* e, char* ptr); |
| 12272 | |
| 12273 | #ifdef __cplusplus |
| 12274 | } /* extern "C" */ |
| 12275 | #endif |
| 12276 | |
| 12277 | |
| 12278 | #endif /* UPB_MINI_DESCRIPTOR_INTERNAL_ENCODE_H_ */ |
| 12279 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12280 | #ifndef UPB_REFLECTION_DEF_BUILDER_INTERNAL_H_ |
| 12281 | #define UPB_REFLECTION_DEF_BUILDER_INTERNAL_H_ |
| 12282 | |
| 12283 | |
| 12284 | #ifndef UPB_REFLECTION_DEF_POOL_INTERNAL_H_ |
| 12285 | #define UPB_REFLECTION_DEF_POOL_INTERNAL_H_ |
| 12286 | |
| 12287 | |
| 12288 | // Must be last. |
| 12289 | |
| 12290 | #ifdef __cplusplus |
| 12291 | extern "C" { |
| 12292 | #endif |
| 12293 | |
| 12294 | upb_Arena* _upb_DefPool_Arena(const upb_DefPool* s); |
| 12295 | size_t _upb_DefPool_BytesLoaded(const upb_DefPool* s); |
| 12296 | upb_ExtensionRegistry* _upb_DefPool_ExtReg(const upb_DefPool* s); |
| 12297 | |
| 12298 | bool _upb_DefPool_InsertExt(upb_DefPool* s, const upb_MiniTableExtension* ext, |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 12299 | const upb_FieldDef* f); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12300 | bool _upb_DefPool_InsertSym(upb_DefPool* s, upb_StringView sym, upb_value v, |
| 12301 | upb_Status* status); |
| 12302 | bool _upb_DefPool_LookupSym(const upb_DefPool* s, const char* sym, size_t size, |
| 12303 | upb_value* v); |
| 12304 | |
| 12305 | void** _upb_DefPool_ScratchData(const upb_DefPool* s); |
| 12306 | size_t* _upb_DefPool_ScratchSize(const upb_DefPool* s); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 12307 | void _upb_DefPool_SetPlatform(upb_DefPool* s, upb_MiniTablePlatform platform); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12308 | |
| 12309 | // For generated code only: loads a generated descriptor. |
| 12310 | typedef struct _upb_DefPool_Init { |
| 12311 | struct _upb_DefPool_Init** deps; // Dependencies of this file. |
| 12312 | const upb_MiniTableFile* layout; |
| 12313 | const char* filename; |
| 12314 | upb_StringView descriptor; // Serialized descriptor. |
| 12315 | } _upb_DefPool_Init; |
| 12316 | |
| 12317 | bool _upb_DefPool_LoadDefInit(upb_DefPool* s, const _upb_DefPool_Init* init); |
| 12318 | |
| 12319 | // Should only be directly called by tests. This variant lets us suppress |
| 12320 | // the use of compiled-in tables, forcing a rebuild of the tables at runtime. |
| 12321 | bool _upb_DefPool_LoadDefInitEx(upb_DefPool* s, const _upb_DefPool_Init* init, |
| 12322 | bool rebuild_minitable); |
| 12323 | |
| 12324 | #ifdef __cplusplus |
| 12325 | } /* extern "C" */ |
| 12326 | #endif |
| 12327 | |
| 12328 | |
| 12329 | #endif /* UPB_REFLECTION_DEF_POOL_INTERNAL_H_ */ |
| 12330 | |
| 12331 | // Must be last. |
| 12332 | |
| 12333 | // We want to copy the options verbatim into the destination options proto. |
| 12334 | // We use serialize+parse as our deep copy. |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 12335 | #define UPB_DEF_SET_OPTIONS(target, desc_type, options_type, proto) \ |
| 12336 | if (UPB_DESC(desc_type##_has_options)(proto)) { \ |
| 12337 | size_t size; \ |
| 12338 | char* pb = UPB_DESC(options_type##_serialize)( \ |
| 12339 | UPB_DESC(desc_type##_options)(proto), ctx->tmp_arena, &size); \ |
| 12340 | if (!pb) _upb_DefBuilder_OomErr(ctx); \ |
| 12341 | target = \ |
| 12342 | UPB_DESC(options_type##_parse)(pb, size, _upb_DefBuilder_Arena(ctx)); \ |
| 12343 | if (!target) _upb_DefBuilder_OomErr(ctx); \ |
| 12344 | } else { \ |
| 12345 | target = (const UPB_DESC(options_type)*)kUpbDefOptDefault; \ |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12346 | } |
| 12347 | |
| 12348 | #ifdef __cplusplus |
| 12349 | extern "C" { |
| 12350 | #endif |
| 12351 | |
| 12352 | struct upb_DefBuilder { |
| 12353 | upb_DefPool* symtab; |
| 12354 | upb_FileDef* file; // File we are building. |
| 12355 | upb_Arena* arena; // Allocate defs here. |
| 12356 | upb_Arena* tmp_arena; // For temporary allocations. |
| 12357 | upb_Status* status; // Record errors here. |
| 12358 | const upb_MiniTableFile* layout; // NULL if we should build layouts. |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 12359 | upb_MiniTablePlatform platform; // Platform we are targeting. |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12360 | int enum_count; // Count of enums built so far. |
| 12361 | int msg_count; // Count of messages built so far. |
| 12362 | int ext_count; // Count of extensions built so far. |
| 12363 | jmp_buf err; // longjmp() on error. |
| 12364 | }; |
| 12365 | |
| 12366 | extern const char* kUpbDefOptDefault; |
| 12367 | |
| 12368 | // ctx->status has already been set elsewhere so just fail/longjmp() |
| 12369 | UPB_NORETURN void _upb_DefBuilder_FailJmp(upb_DefBuilder* ctx); |
| 12370 | |
| 12371 | UPB_NORETURN void _upb_DefBuilder_Errf(upb_DefBuilder* ctx, const char* fmt, |
| 12372 | ...) UPB_PRINTF(2, 3); |
| 12373 | UPB_NORETURN void _upb_DefBuilder_OomErr(upb_DefBuilder* ctx); |
| 12374 | |
| 12375 | const char* _upb_DefBuilder_MakeFullName(upb_DefBuilder* ctx, |
| 12376 | const char* prefix, |
| 12377 | upb_StringView name); |
| 12378 | |
| 12379 | // Given a symbol and the base symbol inside which it is defined, |
| 12380 | // find the symbol's definition. |
| 12381 | const void* _upb_DefBuilder_ResolveAny(upb_DefBuilder* ctx, |
| 12382 | const char* from_name_dbg, |
| 12383 | const char* base, upb_StringView sym, |
| 12384 | upb_deftype_t* type); |
| 12385 | |
| 12386 | const void* _upb_DefBuilder_Resolve(upb_DefBuilder* ctx, |
| 12387 | const char* from_name_dbg, const char* base, |
| 12388 | upb_StringView sym, upb_deftype_t type); |
| 12389 | |
| 12390 | char _upb_DefBuilder_ParseEscape(upb_DefBuilder* ctx, const upb_FieldDef* f, |
| 12391 | const char** src, const char* end); |
| 12392 | |
| 12393 | const char* _upb_DefBuilder_FullToShort(const char* fullname); |
| 12394 | |
| 12395 | UPB_INLINE void* _upb_DefBuilder_Alloc(upb_DefBuilder* ctx, size_t bytes) { |
| 12396 | if (bytes == 0) return NULL; |
| 12397 | void* ret = upb_Arena_Malloc(ctx->arena, bytes); |
| 12398 | if (!ret) _upb_DefBuilder_OomErr(ctx); |
| 12399 | return ret; |
| 12400 | } |
| 12401 | |
| 12402 | // Adds a symbol |v| to the symtab, which must be a def pointer previously |
| 12403 | // packed with pack_def(). The def's pointer to upb_FileDef* must be set before |
| 12404 | // adding, so we know which entries to remove if building this file fails. |
| 12405 | UPB_INLINE void _upb_DefBuilder_Add(upb_DefBuilder* ctx, const char* name, |
| 12406 | upb_value v) { |
| 12407 | upb_StringView sym = {.data = name, .size = strlen(name)}; |
| 12408 | bool ok = _upb_DefPool_InsertSym(ctx->symtab, sym, v, ctx->status); |
| 12409 | if (!ok) _upb_DefBuilder_FailJmp(ctx); |
| 12410 | } |
| 12411 | |
| 12412 | UPB_INLINE upb_Arena* _upb_DefBuilder_Arena(const upb_DefBuilder* ctx) { |
| 12413 | return ctx->arena; |
| 12414 | } |
| 12415 | |
| 12416 | UPB_INLINE upb_FileDef* _upb_DefBuilder_File(const upb_DefBuilder* ctx) { |
| 12417 | return ctx->file; |
| 12418 | } |
| 12419 | |
| 12420 | // This version of CheckIdent() is only called by other, faster versions after |
| 12421 | // they detect a parsing error. |
| 12422 | void _upb_DefBuilder_CheckIdentSlow(upb_DefBuilder* ctx, upb_StringView name, |
| 12423 | bool full); |
| 12424 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12425 | // Verify a full identifier string. This is slightly more complicated than |
| 12426 | // verifying a relative identifier string because we must track '.' chars. |
| 12427 | UPB_INLINE void _upb_DefBuilder_CheckIdentFull(upb_DefBuilder* ctx, |
| 12428 | upb_StringView name) { |
| 12429 | bool good = name.size > 0; |
| 12430 | bool start = true; |
| 12431 | |
| 12432 | for (size_t i = 0; i < name.size; i++) { |
| 12433 | const char c = name.data[i]; |
| 12434 | const char d = c | 0x20; // force lowercase |
| 12435 | const bool is_alpha = (('a' <= d) & (d <= 'z')) | (c == '_'); |
| 12436 | const bool is_numer = ('0' <= c) & (c <= '9') & !start; |
| 12437 | const bool is_dot = (c == '.') & !start; |
| 12438 | |
| 12439 | good &= is_alpha | is_numer | is_dot; |
| 12440 | start = is_dot; |
| 12441 | } |
| 12442 | |
| 12443 | if (!good) _upb_DefBuilder_CheckIdentSlow(ctx, name, true); |
| 12444 | } |
| 12445 | |
| 12446 | #ifdef __cplusplus |
| 12447 | } /* extern "C" */ |
| 12448 | #endif |
| 12449 | |
| 12450 | |
| 12451 | #endif /* UPB_REFLECTION_DEF_BUILDER_INTERNAL_H_ */ |
| 12452 | |
| 12453 | #ifndef UPB_REFLECTION_ENUM_DEF_INTERNAL_H_ |
| 12454 | #define UPB_REFLECTION_ENUM_DEF_INTERNAL_H_ |
| 12455 | |
| 12456 | |
| 12457 | // Must be last. |
| 12458 | |
| 12459 | #ifdef __cplusplus |
| 12460 | extern "C" { |
| 12461 | #endif |
| 12462 | |
| 12463 | upb_EnumDef* _upb_EnumDef_At(const upb_EnumDef* e, int i); |
| 12464 | bool _upb_EnumDef_Insert(upb_EnumDef* e, upb_EnumValueDef* v, upb_Arena* a); |
| 12465 | const upb_MiniTableEnum* _upb_EnumDef_MiniTable(const upb_EnumDef* e); |
| 12466 | |
| 12467 | // Allocate and initialize an array of |n| enum defs. |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 12468 | upb_EnumDef* _upb_EnumDefs_New( |
| 12469 | upb_DefBuilder* ctx, int n, |
| 12470 | const UPB_DESC(EnumDescriptorProto) * const* protos, |
| 12471 | const upb_MessageDef* containing_type); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12472 | |
| 12473 | #ifdef __cplusplus |
| 12474 | } /* extern "C" */ |
| 12475 | #endif |
| 12476 | |
| 12477 | |
| 12478 | #endif /* UPB_REFLECTION_ENUM_DEF_INTERNAL_H_ */ |
| 12479 | |
| 12480 | #ifndef UPB_REFLECTION_ENUM_VALUE_DEF_INTERNAL_H_ |
| 12481 | #define UPB_REFLECTION_ENUM_VALUE_DEF_INTERNAL_H_ |
| 12482 | |
| 12483 | |
| 12484 | // Must be last. |
| 12485 | |
| 12486 | #ifdef __cplusplus |
| 12487 | extern "C" { |
| 12488 | #endif |
| 12489 | |
| 12490 | upb_EnumValueDef* _upb_EnumValueDef_At(const upb_EnumValueDef* v, int i); |
| 12491 | |
| 12492 | // Allocate and initialize an array of |n| enum value defs owned by |e|. |
| 12493 | upb_EnumValueDef* _upb_EnumValueDefs_New( |
| 12494 | upb_DefBuilder* ctx, const char* prefix, int n, |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 12495 | const UPB_DESC(EnumValueDescriptorProto) * const* protos, upb_EnumDef* e, |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12496 | bool* is_sorted); |
| 12497 | |
| 12498 | const upb_EnumValueDef** _upb_EnumValueDefs_Sorted(const upb_EnumValueDef* v, |
| 12499 | int n, upb_Arena* a); |
| 12500 | |
| 12501 | #ifdef __cplusplus |
| 12502 | } /* extern "C" */ |
| 12503 | #endif |
| 12504 | |
| 12505 | |
| 12506 | #endif /* UPB_REFLECTION_ENUM_VALUE_DEF_INTERNAL_H_ */ |
| 12507 | |
| 12508 | #ifndef UPB_REFLECTION_FIELD_DEF_INTERNAL_H_ |
| 12509 | #define UPB_REFLECTION_FIELD_DEF_INTERNAL_H_ |
| 12510 | |
| 12511 | |
| 12512 | // Must be last. |
| 12513 | |
| 12514 | #ifdef __cplusplus |
| 12515 | extern "C" { |
| 12516 | #endif |
| 12517 | |
| 12518 | upb_FieldDef* _upb_FieldDef_At(const upb_FieldDef* f, int i); |
| 12519 | |
| 12520 | const upb_MiniTableExtension* _upb_FieldDef_ExtensionMiniTable( |
| 12521 | const upb_FieldDef* f); |
| 12522 | bool _upb_FieldDef_IsClosedEnum(const upb_FieldDef* f); |
| 12523 | bool _upb_FieldDef_IsProto3Optional(const upb_FieldDef* f); |
| 12524 | int _upb_FieldDef_LayoutIndex(const upb_FieldDef* f); |
| 12525 | uint64_t _upb_FieldDef_Modifiers(const upb_FieldDef* f); |
| 12526 | void _upb_FieldDef_Resolve(upb_DefBuilder* ctx, const char* prefix, |
| 12527 | upb_FieldDef* f); |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 12528 | void _upb_FieldDef_BuildMiniTableExtension(upb_DefBuilder* ctx, |
| 12529 | const upb_FieldDef* f); |
| 12530 | |
| 12531 | // Allocate and initialize an array of |n| extensions (field defs). |
| 12532 | upb_FieldDef* _upb_Extensions_New( |
| 12533 | upb_DefBuilder* ctx, int n, |
| 12534 | const UPB_DESC(FieldDescriptorProto) * const* protos, const char* prefix, |
| 12535 | upb_MessageDef* m); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12536 | |
| 12537 | // Allocate and initialize an array of |n| field defs. |
| 12538 | upb_FieldDef* _upb_FieldDefs_New( |
| 12539 | upb_DefBuilder* ctx, int n, |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 12540 | const UPB_DESC(FieldDescriptorProto) * const* protos, const char* prefix, |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12541 | upb_MessageDef* m, bool* is_sorted); |
| 12542 | |
| 12543 | // Allocate and return a list of pointers to the |n| field defs in |ff|, |
| 12544 | // sorted by field number. |
| 12545 | const upb_FieldDef** _upb_FieldDefs_Sorted(const upb_FieldDef* f, int n, |
| 12546 | upb_Arena* a); |
| 12547 | |
| 12548 | #ifdef __cplusplus |
| 12549 | } /* extern "C" */ |
| 12550 | #endif |
| 12551 | |
| 12552 | |
| 12553 | #endif /* UPB_REFLECTION_FIELD_DEF_INTERNAL_H_ */ |
| 12554 | |
| 12555 | #ifndef UPB_REFLECTION_FILE_DEF_INTERNAL_H_ |
| 12556 | #define UPB_REFLECTION_FILE_DEF_INTERNAL_H_ |
| 12557 | |
| 12558 | |
| 12559 | // Must be last. |
| 12560 | |
| 12561 | #ifdef __cplusplus |
| 12562 | extern "C" { |
| 12563 | #endif |
| 12564 | |
| 12565 | const upb_MiniTableExtension* _upb_FileDef_ExtensionMiniTable( |
| 12566 | const upb_FileDef* f, int i); |
| 12567 | const int32_t* _upb_FileDef_PublicDependencyIndexes(const upb_FileDef* f); |
| 12568 | const int32_t* _upb_FileDef_WeakDependencyIndexes(const upb_FileDef* f); |
| 12569 | |
| 12570 | // upb_FileDef_Package() returns "" if f->package is NULL, this does not. |
| 12571 | const char* _upb_FileDef_RawPackage(const upb_FileDef* f); |
| 12572 | |
| 12573 | void _upb_FileDef_Create(upb_DefBuilder* ctx, |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 12574 | const UPB_DESC(FileDescriptorProto) * file_proto); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12575 | |
| 12576 | #ifdef __cplusplus |
| 12577 | } /* extern "C" */ |
| 12578 | #endif |
| 12579 | |
| 12580 | |
| 12581 | #endif /* UPB_REFLECTION_FILE_DEF_INTERNAL_H_ */ |
| 12582 | |
| 12583 | #ifndef UPB_REFLECTION_MESSAGE_DEF_INTERNAL_H_ |
| 12584 | #define UPB_REFLECTION_MESSAGE_DEF_INTERNAL_H_ |
| 12585 | |
| 12586 | |
| 12587 | // Must be last. |
| 12588 | |
| 12589 | #ifdef __cplusplus |
| 12590 | extern "C" { |
| 12591 | #endif |
| 12592 | |
| 12593 | upb_MessageDef* _upb_MessageDef_At(const upb_MessageDef* m, int i); |
| 12594 | bool _upb_MessageDef_InMessageSet(const upb_MessageDef* m); |
| 12595 | bool _upb_MessageDef_Insert(upb_MessageDef* m, const char* name, size_t size, |
| 12596 | upb_value v, upb_Arena* a); |
| 12597 | void _upb_MessageDef_InsertField(upb_DefBuilder* ctx, upb_MessageDef* m, |
| 12598 | const upb_FieldDef* f); |
| 12599 | bool _upb_MessageDef_IsValidExtensionNumber(const upb_MessageDef* m, int n); |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 12600 | void _upb_MessageDef_CreateMiniTable(upb_DefBuilder* ctx, upb_MessageDef* m); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12601 | void _upb_MessageDef_LinkMiniTable(upb_DefBuilder* ctx, |
| 12602 | const upb_MessageDef* m); |
| 12603 | void _upb_MessageDef_Resolve(upb_DefBuilder* ctx, upb_MessageDef* m); |
| 12604 | |
| 12605 | // Allocate and initialize an array of |n| message defs. |
| 12606 | upb_MessageDef* _upb_MessageDefs_New( |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 12607 | upb_DefBuilder* ctx, int n, const UPB_DESC(DescriptorProto) * const* protos, |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12608 | const upb_MessageDef* containing_type); |
| 12609 | |
| 12610 | #ifdef __cplusplus |
| 12611 | } /* extern "C" */ |
| 12612 | #endif |
| 12613 | |
| 12614 | |
| 12615 | #endif /* UPB_REFLECTION_MESSAGE_DEF_INTERNAL_H_ */ |
| 12616 | |
| 12617 | #ifndef UPB_REFLECTION_SERVICE_DEF_INTERNAL_H_ |
| 12618 | #define UPB_REFLECTION_SERVICE_DEF_INTERNAL_H_ |
| 12619 | |
| 12620 | |
| 12621 | // Must be last. |
| 12622 | |
| 12623 | #ifdef __cplusplus |
| 12624 | extern "C" { |
| 12625 | #endif |
| 12626 | |
| 12627 | upb_ServiceDef* _upb_ServiceDef_At(const upb_ServiceDef* s, int i); |
| 12628 | |
| 12629 | // Allocate and initialize an array of |n| service defs. |
| 12630 | upb_ServiceDef* _upb_ServiceDefs_New( |
| 12631 | upb_DefBuilder* ctx, int n, |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 12632 | const UPB_DESC(ServiceDescriptorProto) * const* protos); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12633 | |
| 12634 | #ifdef __cplusplus |
| 12635 | } /* extern "C" */ |
| 12636 | #endif |
| 12637 | |
| 12638 | |
| 12639 | #endif /* UPB_REFLECTION_SERVICE_DEF_INTERNAL_H_ */ |
| 12640 | |
| 12641 | #ifndef UPB_REFLECTION_DESC_STATE_INTERNAL_H_ |
| 12642 | #define UPB_REFLECTION_DESC_STATE_INTERNAL_H_ |
| 12643 | |
| 12644 | |
| 12645 | // Must be last. |
| 12646 | |
| 12647 | // Manages the storage for mini descriptor strings as they are being encoded. |
| 12648 | // TODO(b/234740652): Move some of this state directly into the encoder, maybe. |
| 12649 | typedef struct { |
| 12650 | upb_MtDataEncoder e; |
| 12651 | size_t bufsize; |
| 12652 | char* buf; |
| 12653 | char* ptr; |
| 12654 | } upb_DescState; |
| 12655 | |
| 12656 | #ifdef __cplusplus |
| 12657 | extern "C" { |
| 12658 | #endif |
| 12659 | |
| 12660 | UPB_INLINE void _upb_DescState_Init(upb_DescState* d) { |
| 12661 | d->bufsize = kUpb_MtDataEncoder_MinSize * 2; |
| 12662 | d->buf = NULL; |
| 12663 | d->ptr = NULL; |
| 12664 | } |
| 12665 | |
| 12666 | bool _upb_DescState_Grow(upb_DescState* d, upb_Arena* a); |
| 12667 | |
| 12668 | #ifdef __cplusplus |
| 12669 | } /* extern "C" */ |
| 12670 | #endif |
| 12671 | |
| 12672 | |
| 12673 | #endif /* UPB_REFLECTION_DESC_STATE_INTERNAL_H_ */ |
| 12674 | |
| 12675 | #ifndef UPB_REFLECTION_ENUM_RESERVED_RANGE_INTERNAL_H_ |
| 12676 | #define UPB_REFLECTION_ENUM_RESERVED_RANGE_INTERNAL_H_ |
| 12677 | |
| 12678 | |
| 12679 | // IWYU pragma: private, include "upb/reflection/def.h" |
| 12680 | |
| 12681 | #ifndef UPB_REFLECTION_ENUM_RESERVED_RANGE_H_ |
| 12682 | #define UPB_REFLECTION_ENUM_RESERVED_RANGE_H_ |
| 12683 | |
| 12684 | |
| 12685 | // Must be last. |
| 12686 | |
| 12687 | #ifdef __cplusplus |
| 12688 | extern "C" { |
| 12689 | #endif |
| 12690 | |
| 12691 | int32_t upb_EnumReservedRange_Start(const upb_EnumReservedRange* r); |
| 12692 | int32_t upb_EnumReservedRange_End(const upb_EnumReservedRange* r); |
| 12693 | |
| 12694 | #ifdef __cplusplus |
| 12695 | } /* extern "C" */ |
| 12696 | #endif |
| 12697 | |
| 12698 | |
| 12699 | #endif /* UPB_REFLECTION_ENUM_RESERVED_RANGE_H_ */ |
| 12700 | |
| 12701 | // Must be last. |
| 12702 | |
| 12703 | #ifdef __cplusplus |
| 12704 | extern "C" { |
| 12705 | #endif |
| 12706 | |
| 12707 | upb_EnumReservedRange* _upb_EnumReservedRange_At(const upb_EnumReservedRange* r, |
| 12708 | int i); |
| 12709 | |
| 12710 | // Allocate and initialize an array of |n| reserved ranges owned by |e|. |
| 12711 | upb_EnumReservedRange* _upb_EnumReservedRanges_New( |
| 12712 | upb_DefBuilder* ctx, int n, |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 12713 | const UPB_DESC(EnumDescriptorProto_EnumReservedRange) * const* protos, |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12714 | const upb_EnumDef* e); |
| 12715 | |
| 12716 | #ifdef __cplusplus |
| 12717 | } /* extern "C" */ |
| 12718 | #endif |
| 12719 | |
| 12720 | |
| 12721 | #endif /* UPB_REFLECTION_ENUM_RESERVED_RANGE_INTERNAL_H_ */ |
| 12722 | |
| 12723 | #ifndef UPB_REFLECTION_EXTENSION_RANGE_INTERNAL_H_ |
| 12724 | #define UPB_REFLECTION_EXTENSION_RANGE_INTERNAL_H_ |
| 12725 | |
| 12726 | |
| 12727 | // Must be last. |
| 12728 | |
| 12729 | #ifdef __cplusplus |
| 12730 | extern "C" { |
| 12731 | #endif |
| 12732 | |
| 12733 | upb_ExtensionRange* _upb_ExtensionRange_At(const upb_ExtensionRange* r, int i); |
| 12734 | |
| 12735 | // Allocate and initialize an array of |n| extension ranges owned by |m|. |
| 12736 | upb_ExtensionRange* _upb_ExtensionRanges_New( |
| 12737 | upb_DefBuilder* ctx, int n, |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 12738 | const UPB_DESC(DescriptorProto_ExtensionRange) * const* protos, |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12739 | const upb_MessageDef* m); |
| 12740 | |
| 12741 | #ifdef __cplusplus |
| 12742 | } /* extern "C" */ |
| 12743 | #endif |
| 12744 | |
| 12745 | |
| 12746 | #endif /* UPB_REFLECTION_EXTENSION_RANGE_INTERNAL_H_ */ |
| 12747 | |
| 12748 | #ifndef UPB_REFLECTION_ONEOF_DEF_INTERNAL_H_ |
| 12749 | #define UPB_REFLECTION_ONEOF_DEF_INTERNAL_H_ |
| 12750 | |
| 12751 | |
| 12752 | // Must be last. |
| 12753 | |
| 12754 | #ifdef __cplusplus |
| 12755 | extern "C" { |
| 12756 | #endif |
| 12757 | |
| 12758 | upb_OneofDef* _upb_OneofDef_At(const upb_OneofDef* o, int i); |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 12759 | void _upb_OneofDef_Insert(upb_DefBuilder* ctx, upb_OneofDef* o, |
| 12760 | const upb_FieldDef* f, const char* name, size_t size); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12761 | |
| 12762 | // Allocate and initialize an array of |n| oneof defs owned by |m|. |
| 12763 | upb_OneofDef* _upb_OneofDefs_New( |
| 12764 | upb_DefBuilder* ctx, int n, |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 12765 | const UPB_DESC(OneofDescriptorProto) * const* protos, upb_MessageDef* m); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12766 | |
| 12767 | size_t _upb_OneofDefs_Finalize(upb_DefBuilder* ctx, upb_MessageDef* m); |
| 12768 | |
| 12769 | #ifdef __cplusplus |
| 12770 | } /* extern "C" */ |
| 12771 | #endif |
| 12772 | |
| 12773 | |
| 12774 | #endif /* UPB_REFLECTION_ONEOF_DEF_INTERNAL_H_ */ |
| 12775 | |
| 12776 | #ifndef UPB_REFLECTION_MESSAGE_RESERVED_RANGE_INTERNAL_H_ |
| 12777 | #define UPB_REFLECTION_MESSAGE_RESERVED_RANGE_INTERNAL_H_ |
| 12778 | |
| 12779 | |
| 12780 | // IWYU pragma: private, include "upb/reflection/def.h" |
| 12781 | |
| 12782 | #ifndef UPB_REFLECTION_MESSAGE_RESERVED_RANGE_H_ |
| 12783 | #define UPB_REFLECTION_MESSAGE_RESERVED_RANGE_H_ |
| 12784 | |
| 12785 | |
| 12786 | // Must be last. |
| 12787 | |
| 12788 | #ifdef __cplusplus |
| 12789 | extern "C" { |
| 12790 | #endif |
| 12791 | |
| 12792 | int32_t upb_MessageReservedRange_Start(const upb_MessageReservedRange* r); |
| 12793 | int32_t upb_MessageReservedRange_End(const upb_MessageReservedRange* r); |
| 12794 | |
| 12795 | #ifdef __cplusplus |
| 12796 | } /* extern "C" */ |
| 12797 | #endif |
| 12798 | |
| 12799 | |
| 12800 | #endif /* UPB_REFLECTION_MESSAGE_RESERVED_RANGE_H_ */ |
| 12801 | |
| 12802 | // Must be last. |
| 12803 | |
| 12804 | #ifdef __cplusplus |
| 12805 | extern "C" { |
| 12806 | #endif |
| 12807 | |
| 12808 | upb_MessageReservedRange* _upb_MessageReservedRange_At( |
| 12809 | const upb_MessageReservedRange* r, int i); |
| 12810 | |
| 12811 | // Allocate and initialize an array of |n| reserved ranges owned by |m|. |
| 12812 | upb_MessageReservedRange* _upb_MessageReservedRanges_New( |
| 12813 | upb_DefBuilder* ctx, int n, |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 12814 | const UPB_DESC(DescriptorProto_ReservedRange) * const* protos, |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12815 | const upb_MessageDef* m); |
| 12816 | |
| 12817 | #ifdef __cplusplus |
| 12818 | } /* extern "C" */ |
| 12819 | #endif |
| 12820 | |
| 12821 | |
| 12822 | #endif /* UPB_REFLECTION_MESSAGE_RESERVED_RANGE_INTERNAL_H_ */ |
| 12823 | |
| 12824 | #ifndef UPB_REFLECTION_METHOD_DEF_INTERNAL_H_ |
| 12825 | #define UPB_REFLECTION_METHOD_DEF_INTERNAL_H_ |
| 12826 | |
| 12827 | |
| 12828 | // Must be last. |
| 12829 | |
| 12830 | #ifdef __cplusplus |
| 12831 | extern "C" { |
| 12832 | #endif |
| 12833 | |
| 12834 | upb_MethodDef* _upb_MethodDef_At(const upb_MethodDef* m, int i); |
| 12835 | |
| 12836 | // Allocate and initialize an array of |n| method defs owned by |s|. |
| 12837 | upb_MethodDef* _upb_MethodDefs_New( |
| 12838 | upb_DefBuilder* ctx, int n, |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 12839 | const UPB_DESC(MethodDescriptorProto) * const* protos, upb_ServiceDef* s); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12840 | |
| 12841 | #ifdef __cplusplus |
| 12842 | } /* extern "C" */ |
| 12843 | #endif |
| 12844 | |
| 12845 | |
| 12846 | #endif /* UPB_REFLECTION_METHOD_DEF_INTERNAL_H_ */ |
| 12847 | |
Sandy Zhang | e3b0943 | 2023-08-07 09:30:02 -0700 | [diff] [blame] | 12848 | #ifndef UPB_WIRE_INTERNAL_COMMON_H_ |
| 12849 | #define UPB_WIRE_INTERNAL_COMMON_H_ |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12850 | |
| 12851 | // Must be last. |
| 12852 | |
| 12853 | // MessageSet wire format is: |
| 12854 | // message MessageSet { |
| 12855 | // repeated group Item = 1 { |
| 12856 | // required int32 type_id = 2; |
| 12857 | // required bytes message = 3; |
| 12858 | // } |
| 12859 | // } |
| 12860 | |
| 12861 | enum { |
| 12862 | kUpb_MsgSet_Item = 1, |
| 12863 | kUpb_MsgSet_TypeId = 2, |
| 12864 | kUpb_MsgSet_Message = 3, |
| 12865 | }; |
| 12866 | |
| 12867 | |
Sandy Zhang | e3b0943 | 2023-08-07 09:30:02 -0700 | [diff] [blame] | 12868 | #endif /* UPB_WIRE_INTERNAL_COMMON_H_ */ |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12869 | |
| 12870 | /* |
| 12871 | * Internal implementation details of the decoder that are shared between |
| 12872 | * decode.c and decode_fast.c. |
| 12873 | */ |
| 12874 | |
Sandy Zhang | e3b0943 | 2023-08-07 09:30:02 -0700 | [diff] [blame] | 12875 | #ifndef UPB_WIRE_INTERNAL_DECODE_H_ |
| 12876 | #define UPB_WIRE_INTERNAL_DECODE_H_ |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12877 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 12878 | #include "utf8_range.h" |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 12879 | |
| 12880 | // Must be last. |
| 12881 | |
| 12882 | #define DECODE_NOGROUP (uint32_t) - 1 |
| 12883 | |
| 12884 | typedef struct upb_Decoder { |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 12885 | upb_EpsCopyInputStream input; |
| 12886 | const upb_ExtensionRegistry* extreg; |
| 12887 | const char* unknown; // Start of unknown data, preserve at buffer flip |
| 12888 | upb_Message* unknown_msg; // Pointer to preserve data to |
| 12889 | int depth; // Tracks recursion depth to bound stack usage. |
| 12890 | 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] | 12891 | uint16_t options; |
| 12892 | bool missing_required; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 12893 | upb_Arena arena; |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 12894 | upb_DecodeStatus status; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 12895 | jmp_buf err; |
| 12896 | |
| 12897 | #ifndef NDEBUG |
| 12898 | const char* debug_tagstart; |
| 12899 | const char* debug_valstart; |
| 12900 | #endif |
| 12901 | } upb_Decoder; |
| 12902 | |
| 12903 | /* Error function that will abort decoding with longjmp(). We can't declare this |
| 12904 | * UPB_NORETURN, even though it is appropriate, because if we do then compilers |
| 12905 | * will "helpfully" refuse to tailcall to it |
| 12906 | * (see: https://stackoverflow.com/a/55657013), which will defeat a major goal |
| 12907 | * of our optimizations. That is also why we must declare it in a separate file, |
| 12908 | * otherwise the compiler will see that it calls longjmp() and deduce that it is |
| 12909 | * noreturn. */ |
| 12910 | const char* _upb_FastDecoder_ErrorJmp(upb_Decoder* d, int status); |
| 12911 | |
| 12912 | extern const uint8_t upb_utf8_offsets[]; |
| 12913 | |
| 12914 | UPB_INLINE |
| 12915 | bool _upb_Decoder_VerifyUtf8Inline(const char* ptr, int len) { |
| 12916 | const char* end = ptr + len; |
| 12917 | |
| 12918 | // Check 8 bytes at a time for any non-ASCII char. |
| 12919 | while (end - ptr >= 8) { |
| 12920 | uint64_t data; |
| 12921 | memcpy(&data, ptr, 8); |
| 12922 | if (data & 0x8080808080808080) goto non_ascii; |
| 12923 | ptr += 8; |
| 12924 | } |
| 12925 | |
| 12926 | // Check one byte at a time for non-ASCII. |
| 12927 | while (ptr < end) { |
| 12928 | if (*ptr & 0x80) goto non_ascii; |
| 12929 | ptr++; |
| 12930 | } |
| 12931 | |
| 12932 | return true; |
| 12933 | |
| 12934 | non_ascii: |
| 12935 | return utf8_range2((const unsigned char*)ptr, end - ptr) == 0; |
| 12936 | } |
| 12937 | |
| 12938 | const char* _upb_Decoder_CheckRequired(upb_Decoder* d, const char* ptr, |
| 12939 | const upb_Message* msg, |
| 12940 | const upb_MiniTable* l); |
| 12941 | |
| 12942 | /* x86-64 pointers always have the high 16 bits matching. So we can shift |
| 12943 | * left 8 and right 8 without loss of information. */ |
| 12944 | UPB_INLINE intptr_t decode_totable(const upb_MiniTable* tablep) { |
| 12945 | return ((intptr_t)tablep << 8) | tablep->table_mask; |
| 12946 | } |
| 12947 | |
| 12948 | UPB_INLINE const upb_MiniTable* decode_totablep(intptr_t table) { |
| 12949 | return (const upb_MiniTable*)(table >> 8); |
| 12950 | } |
| 12951 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 12952 | const char* _upb_Decoder_IsDoneFallback(upb_EpsCopyInputStream* e, |
| 12953 | const char* ptr, int overrun); |
| 12954 | |
| 12955 | UPB_INLINE bool _upb_Decoder_IsDone(upb_Decoder* d, const char** ptr) { |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 12956 | return upb_EpsCopyInputStream_IsDoneWithCallback( |
| 12957 | &d->input, ptr, &_upb_Decoder_IsDoneFallback); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 12958 | } |
| 12959 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 12960 | UPB_INLINE const char* _upb_Decoder_BufferFlipCallback( |
| 12961 | upb_EpsCopyInputStream* e, const char* old_end, const char* new_start) { |
| 12962 | upb_Decoder* d = (upb_Decoder*)e; |
| 12963 | if (!old_end) _upb_FastDecoder_ErrorJmp(d, kUpb_DecodeStatus_Malformed); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 12964 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 12965 | if (d->unknown) { |
| 12966 | if (!_upb_Message_AddUnknown(d->unknown_msg, d->unknown, |
| 12967 | old_end - d->unknown, &d->arena)) { |
| 12968 | _upb_FastDecoder_ErrorJmp(d, kUpb_DecodeStatus_OutOfMemory); |
| 12969 | } |
| 12970 | d->unknown = new_start; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 12971 | } |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 12972 | return new_start; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 12973 | } |
| 12974 | |
| 12975 | #if UPB_FASTTABLE |
| 12976 | UPB_INLINE |
| 12977 | const char* _upb_FastDecoder_TagDispatch(upb_Decoder* d, const char* ptr, |
| 12978 | upb_Message* msg, intptr_t table, |
| 12979 | uint64_t hasbits, uint64_t tag) { |
| 12980 | const upb_MiniTable* table_p = decode_totablep(table); |
| 12981 | uint8_t mask = table; |
| 12982 | uint64_t data; |
| 12983 | size_t idx = tag & mask; |
| 12984 | UPB_ASSUME((idx & 7) == 0); |
| 12985 | idx >>= 3; |
| 12986 | data = table_p->fasttable[idx].field_data ^ tag; |
| 12987 | UPB_MUSTTAIL return table_p->fasttable[idx].field_parser(d, ptr, msg, table, |
| 12988 | hasbits, data); |
| 12989 | } |
| 12990 | #endif |
| 12991 | |
| 12992 | UPB_INLINE uint32_t _upb_FastDecoder_LoadTag(const char* ptr) { |
| 12993 | uint16_t tag; |
| 12994 | memcpy(&tag, ptr, 2); |
| 12995 | return tag; |
| 12996 | } |
| 12997 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 12998 | |
Sandy Zhang | e3b0943 | 2023-08-07 09:30:02 -0700 | [diff] [blame] | 12999 | #endif /* UPB_WIRE_INTERNAL_DECODE_H_ */ |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 13000 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 13001 | // This should #undef all macros #defined in def.inc |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 13002 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 13003 | #undef UPB_SIZE |
| 13004 | #undef UPB_PTR_AT |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 13005 | #undef UPB_MAPTYPE_STRING |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 13006 | #undef UPB_EXPORT |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 13007 | #undef UPB_INLINE |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 13008 | #undef UPB_API |
| 13009 | #undef UPB_API_INLINE |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 13010 | #undef UPB_ALIGN_UP |
| 13011 | #undef UPB_ALIGN_DOWN |
| 13012 | #undef UPB_ALIGN_MALLOC |
| 13013 | #undef UPB_ALIGN_OF |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 13014 | #undef UPB_MALLOC_ALIGN |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 13015 | #undef UPB_LIKELY |
| 13016 | #undef UPB_UNLIKELY |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 13017 | #undef UPB_FORCEINLINE |
| 13018 | #undef UPB_NOINLINE |
| 13019 | #undef UPB_NORETURN |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 13020 | #undef UPB_PRINTF |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 13021 | #undef UPB_MAX |
| 13022 | #undef UPB_MIN |
| 13023 | #undef UPB_UNUSED |
| 13024 | #undef UPB_ASSUME |
| 13025 | #undef UPB_ASSERT |
| 13026 | #undef UPB_UNREACHABLE |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 13027 | #undef UPB_SETJMP |
| 13028 | #undef UPB_LONGJMP |
| 13029 | #undef UPB_PTRADD |
| 13030 | #undef UPB_MUSTTAIL |
| 13031 | #undef UPB_FASTTABLE_SUPPORTED |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 13032 | #undef UPB_FASTTABLE_MASK |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 13033 | #undef UPB_FASTTABLE |
| 13034 | #undef UPB_FASTTABLE_INIT |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 13035 | #undef UPB_POISON_MEMORY_REGION |
| 13036 | #undef UPB_UNPOISON_MEMORY_REGION |
| 13037 | #undef UPB_ASAN |
Sandy Zhang | e3b0943 | 2023-08-07 09:30:02 -0700 | [diff] [blame] | 13038 | #undef UPB_ASAN_GUARD_SIZE |
| 13039 | #undef UPB_CLANG_ASAN |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 13040 | #undef UPB_TREAT_PROTO2_ENUMS_LIKE_PROTO3 |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 13041 | #undef UPB_DEPRECATED |
| 13042 | #undef UPB_GNUC_MIN |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 13043 | #undef UPB_DESCRIPTOR_UPB_H_FILENAME |
| 13044 | #undef UPB_DESC |
| 13045 | #undef UPB_IS_GOOGLE3 |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 13046 | #undef UPB_ATOMIC |
| 13047 | #undef UPB_USE_C11_ATOMICS |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 13048 | #undef UPB_PRIVATE |