Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 1 | // Ruby is still using proto3 enum semantics for proto2 |
| 2 | #define UPB_DISABLE_PROTO2_ENUM_CHECKING |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3 | /* Amalgamated source file */ |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 4 | |
| 5 | /* |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6 | * This is where we define internal portability macros used across upb. |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 7 | * |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8 | * All of these macros are undef'd in undef.inc to avoid leaking them to users. |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 9 | * |
| 10 | * The correct usage is: |
| 11 | * |
Protobuf Team Bot | 0631035 | 2023-09-26 21:54:58 +0000 | [diff] [blame] | 12 | * #include "upb/foobar.h" |
| 13 | * #include "upb/baz.h" |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 14 | * |
| 15 | * // MUST be last included header. |
Protobuf Team Bot | 0631035 | 2023-09-26 21:54:58 +0000 | [diff] [blame] | 16 | * #include "upb/port/def.inc" |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 17 | * |
| 18 | * // Code for this file. |
| 19 | * // <...> |
| 20 | * |
| 21 | * // Can be omitted for .c files, required for .h. |
Protobuf Team Bot | 0631035 | 2023-09-26 21:54:58 +0000 | [diff] [blame] | 22 | * #include "upb/port/undef.inc" |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 23 | * |
| 24 | * This file is private and must not be included by users! |
| 25 | */ |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 26 | |
| 27 | #if !((defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \ |
Mike Kruskal | fd0b1a5 | 2022-10-14 16:27:22 -0700 | [diff] [blame] | 28 | (defined(__cplusplus) && __cplusplus >= 201402L) || \ |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 29 | (defined(_MSC_VER) && _MSC_VER >= 1900)) |
Mike Kruskal | fd0b1a5 | 2022-10-14 16:27:22 -0700 | [diff] [blame] | 30 | #error upb requires C99 or C++14 or MSVC >= 2015. |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 31 | #endif |
| 32 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 33 | // Portable check for GCC minimum version: |
| 34 | // https://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html |
| 35 | #if defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__GNUC_PATCHLEVEL__) |
| 36 | #define UPB_GNUC_MIN(x, y) \ |
| 37 | (__GNUC__ > (x) || __GNUC__ == (x) && __GNUC_MINOR__ >= (y)) |
| 38 | #else |
| 39 | #define UPB_GNUC_MIN(x, y) 0 |
| 40 | #endif |
| 41 | |
| 42 | #include <assert.h> |
| 43 | #include <setjmp.h> |
| 44 | #include <stdbool.h> |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 45 | #include <stdint.h> |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 46 | #include <stdio.h> |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 47 | |
Adam Cozzette | 7d5592e | 2023-08-23 12:15:26 -0700 | [diff] [blame] | 48 | #ifndef UINTPTR_MAX |
| 49 | Error, UINTPTR_MAX is undefined |
| 50 | #endif |
| 51 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 52 | #if UINTPTR_MAX == 0xffffffff |
| 53 | #define UPB_SIZE(size32, size64) size32 |
| 54 | #else |
| 55 | #define UPB_SIZE(size32, size64) size64 |
| 56 | #endif |
| 57 | |
| 58 | /* If we always read/write as a consistent type to each address, this shouldn't |
| 59 | * violate aliasing. |
| 60 | */ |
| 61 | #define UPB_PTR_AT(msg, ofs, type) ((type*)((char*)(msg) + (ofs))) |
| 62 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 63 | #define UPB_MAPTYPE_STRING 0 |
| 64 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 65 | // UPB_EXPORT: always generate a public symbol. |
| 66 | #if defined(__GNUC__) || defined(__clang__) |
| 67 | #define UPB_EXPORT __attribute__((visibility("default"))) __attribute__((used)) |
| 68 | #else |
| 69 | #define UPB_EXPORT |
| 70 | #endif |
| 71 | |
| 72 | // UPB_INLINE: inline if possible, emit standalone code if required. |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 73 | #ifdef __cplusplus |
| 74 | #define UPB_INLINE inline |
| 75 | #elif defined (__GNUC__) || defined(__clang__) |
| 76 | #define UPB_INLINE static __inline__ |
| 77 | #else |
| 78 | #define UPB_INLINE static |
| 79 | #endif |
| 80 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 81 | #ifdef UPB_BUILD_API |
| 82 | #define UPB_API UPB_EXPORT |
| 83 | #define UPB_API_INLINE UPB_EXPORT |
| 84 | #else |
| 85 | #define UPB_API |
| 86 | #define UPB_API_INLINE UPB_INLINE |
| 87 | #endif |
| 88 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 89 | #define UPB_MALLOC_ALIGN 8 |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 90 | #define UPB_ALIGN_UP(size, align) (((size) + (align) - 1) / (align) * (align)) |
| 91 | #define UPB_ALIGN_DOWN(size, align) ((size) / (align) * (align)) |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 92 | #define UPB_ALIGN_MALLOC(size) UPB_ALIGN_UP(size, UPB_MALLOC_ALIGN) |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 93 | #ifdef __clang__ |
| 94 | #define UPB_ALIGN_OF(type) _Alignof(type) |
| 95 | #else |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 96 | #define UPB_ALIGN_OF(type) offsetof (struct { char c; type member; }, member) |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 97 | #endif |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 98 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 99 | // Hints to the compiler about likely/unlikely branches. |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 100 | #if defined (__GNUC__) || defined(__clang__) |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 101 | #define UPB_LIKELY(x) __builtin_expect((bool)(x), 1) |
| 102 | #define UPB_UNLIKELY(x) __builtin_expect((bool)(x), 0) |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 103 | #else |
| 104 | #define UPB_LIKELY(x) (x) |
| 105 | #define UPB_UNLIKELY(x) (x) |
| 106 | #endif |
| 107 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 108 | // Macros for function attributes on compilers that support them. |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 109 | #ifdef __GNUC__ |
| 110 | #define UPB_FORCEINLINE __inline__ __attribute__((always_inline)) |
| 111 | #define UPB_NOINLINE __attribute__((noinline)) |
| 112 | #define UPB_NORETURN __attribute__((__noreturn__)) |
| 113 | #define UPB_PRINTF(str, first_vararg) __attribute__((format (printf, str, first_vararg))) |
| 114 | #elif defined(_MSC_VER) |
| 115 | #define UPB_NOINLINE |
| 116 | #define UPB_FORCEINLINE |
| 117 | #define UPB_NORETURN __declspec(noreturn) |
| 118 | #define UPB_PRINTF(str, first_vararg) |
| 119 | #else /* !defined(__GNUC__) */ |
| 120 | #define UPB_FORCEINLINE |
| 121 | #define UPB_NOINLINE |
| 122 | #define UPB_NORETURN |
| 123 | #define UPB_PRINTF(str, first_vararg) |
| 124 | #endif |
| 125 | |
| 126 | #define UPB_MAX(x, y) ((x) > (y) ? (x) : (y)) |
| 127 | #define UPB_MIN(x, y) ((x) < (y) ? (x) : (y)) |
| 128 | |
| 129 | #define UPB_UNUSED(var) (void)var |
| 130 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 131 | // UPB_ASSUME(): in release mode, we tell the compiler to assume this is true. |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 132 | #ifdef NDEBUG |
| 133 | #ifdef __GNUC__ |
| 134 | #define UPB_ASSUME(expr) if (!(expr)) __builtin_unreachable() |
| 135 | #elif defined _MSC_VER |
| 136 | #define UPB_ASSUME(expr) if (!(expr)) __assume(0) |
| 137 | #else |
| 138 | #define UPB_ASSUME(expr) do {} while (false && (expr)) |
| 139 | #endif |
| 140 | #else |
| 141 | #define UPB_ASSUME(expr) assert(expr) |
| 142 | #endif |
| 143 | |
| 144 | /* UPB_ASSERT(): in release mode, we use the expression without letting it be |
| 145 | * evaluated. This prevents "unused variable" warnings. */ |
| 146 | #ifdef NDEBUG |
| 147 | #define UPB_ASSERT(expr) do {} while (false && (expr)) |
| 148 | #else |
| 149 | #define UPB_ASSERT(expr) assert(expr) |
| 150 | #endif |
| 151 | |
| 152 | #if defined(__GNUC__) || defined(__clang__) |
| 153 | #define UPB_UNREACHABLE() do { assert(0); __builtin_unreachable(); } while(0) |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 154 | #elif defined(_MSC_VER) |
| 155 | #define UPB_UNREACHABLE() \ |
| 156 | do { \ |
| 157 | assert(0); \ |
| 158 | __assume(0); \ |
| 159 | } while (0) |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 160 | #else |
| 161 | #define UPB_UNREACHABLE() do { assert(0); } while(0) |
| 162 | #endif |
| 163 | |
| 164 | /* UPB_SETJMP() / UPB_LONGJMP(): avoid setting/restoring signal mask. */ |
| 165 | #ifdef __APPLE__ |
| 166 | #define UPB_SETJMP(buf) _setjmp(buf) |
| 167 | #define UPB_LONGJMP(buf, val) _longjmp(buf, val) |
| 168 | #else |
| 169 | #define UPB_SETJMP(buf) setjmp(buf) |
| 170 | #define UPB_LONGJMP(buf, val) longjmp(buf, val) |
| 171 | #endif |
| 172 | |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 173 | #ifdef __GNUC__ |
| 174 | #define UPB_USE_C11_ATOMICS |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 175 | #define UPB_ATOMIC(T) _Atomic(T) |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 176 | #else |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 177 | #define UPB_ATOMIC(T) T |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 178 | #endif |
| 179 | |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 180 | /* UPB_PTRADD(ptr, ofs): add pointer while avoiding "NULL + 0" UB */ |
| 181 | #define UPB_PTRADD(ptr, ofs) ((ofs) ? (ptr) + (ofs) : (ptr)) |
| 182 | |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 183 | #define UPB_PRIVATE(x) x##_dont_copy_me__upb_internal_use_only |
| 184 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 185 | /* Configure whether fasttable is switched on or not. *************************/ |
| 186 | |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 187 | #ifdef __has_attribute |
| 188 | #define UPB_HAS_ATTRIBUTE(x) __has_attribute(x) |
| 189 | #else |
| 190 | #define UPB_HAS_ATTRIBUTE(x) 0 |
| 191 | #endif |
| 192 | |
| 193 | #if UPB_HAS_ATTRIBUTE(musttail) |
| 194 | #define UPB_MUSTTAIL __attribute__((musttail)) |
| 195 | #else |
| 196 | #define UPB_MUSTTAIL |
| 197 | #endif |
| 198 | |
| 199 | #undef UPB_HAS_ATTRIBUTE |
| 200 | |
| 201 | /* This check is not fully robust: it does not require that we have "musttail" |
| 202 | * support available. We need tail calls to avoid consuming arbitrary amounts |
| 203 | * of stack space. |
| 204 | * |
| 205 | * GCC/Clang can mostly be trusted to generate tail calls as long as |
| 206 | * optimization is enabled, but, debug builds will not generate tail calls |
| 207 | * unless "musttail" is available. |
| 208 | * |
| 209 | * We should probably either: |
| 210 | * 1. require that the compiler supports musttail. |
| 211 | * 2. add some fallback code for when musttail isn't available (ie. return |
| 212 | * instead of tail calling). This is safe and portable, but this comes at |
| 213 | * a CPU cost. |
| 214 | */ |
| 215 | #if (defined(__x86_64__) || defined(__aarch64__)) && defined(__GNUC__) |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 216 | #define UPB_FASTTABLE_SUPPORTED 1 |
| 217 | #else |
| 218 | #define UPB_FASTTABLE_SUPPORTED 0 |
| 219 | #endif |
| 220 | |
| 221 | /* define UPB_ENABLE_FASTTABLE to force fast table support. |
| 222 | * This is useful when we want to ensure we are really getting fasttable, |
| 223 | * for example for testing or benchmarking. */ |
| 224 | #if defined(UPB_ENABLE_FASTTABLE) |
| 225 | #if !UPB_FASTTABLE_SUPPORTED |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 226 | #error fasttable is x86-64/ARM64 only and requires GCC or Clang. |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 227 | #endif |
| 228 | #define UPB_FASTTABLE 1 |
| 229 | /* Define UPB_TRY_ENABLE_FASTTABLE to use fasttable if possible. |
| 230 | * This is useful for releasing code that might be used on multiple platforms, |
| 231 | * for example the PHP or Ruby C extensions. */ |
| 232 | #elif defined(UPB_TRY_ENABLE_FASTTABLE) |
| 233 | #define UPB_FASTTABLE UPB_FASTTABLE_SUPPORTED |
| 234 | #else |
| 235 | #define UPB_FASTTABLE 0 |
| 236 | #endif |
| 237 | |
| 238 | /* UPB_FASTTABLE_INIT() allows protos compiled for fasttable to gracefully |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 239 | * degrade to non-fasttable if the runtime or platform do not support it. */ |
| 240 | #if !UPB_FASTTABLE |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 241 | #define UPB_FASTTABLE_INIT(...) |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 242 | #define UPB_FASTTABLE_MASK(mask) -1 |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 243 | #else |
| 244 | #define UPB_FASTTABLE_INIT(...) __VA_ARGS__ |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 245 | #define UPB_FASTTABLE_MASK(mask) mask |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 246 | #endif |
| 247 | |
| 248 | #undef UPB_FASTTABLE_SUPPORTED |
| 249 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 250 | /* ASAN poisoning (for arena). |
| 251 | * If using UPB from an interpreted language like Ruby, a build of the |
Joshua Haberman | 488b8b9 | 2022-09-30 18:07:16 -0700 | [diff] [blame] | 252 | * interpreter compiled with ASAN enabled must be used in order to get sane and |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 253 | * expected behavior. |
| 254 | */ |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 255 | |
Sandy Zhang | e3b0943 | 2023-08-07 09:30:02 -0700 | [diff] [blame] | 256 | /* Due to preprocessor limitations, the conditional logic for setting |
| 257 | * UPN_CLANG_ASAN below cannot be consolidated into a portable one-liner. |
| 258 | * See https://gcc.gnu.org/onlinedocs/cpp/_005f_005fhas_005fattribute.html. |
| 259 | */ |
| 260 | #if defined(__has_feature) |
| 261 | #if __has_feature(address_sanitizer) |
| 262 | #define UPB_CLANG_ASAN 1 |
| 263 | #else |
| 264 | #define UPB_CLANG_ASAN 0 |
| 265 | #endif |
| 266 | #else |
| 267 | #define UPB_CLANG_ASAN 0 |
| 268 | #endif |
| 269 | |
| 270 | #if defined(__SANITIZE_ADDRESS__) || UPB_CLANG_ASAN |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 271 | #define UPB_ASAN 1 |
Sandy Zhang | e3b0943 | 2023-08-07 09:30:02 -0700 | [diff] [blame] | 272 | #define UPB_ASAN_GUARD_SIZE 32 |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 273 | #ifdef __cplusplus |
Adam Cozzette | 7d5592e | 2023-08-23 12:15:26 -0700 | [diff] [blame] | 274 | extern "C" { |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 275 | #endif |
| 276 | void __asan_poison_memory_region(void const volatile *addr, size_t size); |
| 277 | void __asan_unpoison_memory_region(void const volatile *addr, size_t size); |
| 278 | #ifdef __cplusplus |
| 279 | } /* extern "C" */ |
| 280 | #endif |
| 281 | #define UPB_POISON_MEMORY_REGION(addr, size) \ |
| 282 | __asan_poison_memory_region((addr), (size)) |
| 283 | #define UPB_UNPOISON_MEMORY_REGION(addr, size) \ |
| 284 | __asan_unpoison_memory_region((addr), (size)) |
| 285 | #else |
| 286 | #define UPB_ASAN 0 |
Sandy Zhang | e3b0943 | 2023-08-07 09:30:02 -0700 | [diff] [blame] | 287 | #define UPB_ASAN_GUARD_SIZE 0 |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 288 | #define UPB_POISON_MEMORY_REGION(addr, size) \ |
| 289 | ((void)(addr), (void)(size)) |
| 290 | #define UPB_UNPOISON_MEMORY_REGION(addr, size) \ |
| 291 | ((void)(addr), (void)(size)) |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 292 | #endif |
| 293 | |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 294 | /* Disable proto2 arena behavior (TEMPORARY) **********************************/ |
| 295 | |
| 296 | #ifdef UPB_DISABLE_PROTO2_ENUM_CHECKING |
| 297 | #define UPB_TREAT_PROTO2_ENUMS_LIKE_PROTO3 1 |
| 298 | #else |
| 299 | #define UPB_TREAT_PROTO2_ENUMS_LIKE_PROTO3 0 |
| 300 | #endif |
| 301 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 302 | #if defined(__cplusplus) |
| 303 | #if defined(__clang__) || UPB_GNUC_MIN(6, 0) |
| 304 | // https://gcc.gnu.org/gcc-6/changes.html |
| 305 | #if __cplusplus >= 201402L |
| 306 | #define UPB_DEPRECATED [[deprecated]] |
| 307 | #else |
| 308 | #define UPB_DEPRECATED __attribute__((deprecated)) |
| 309 | #endif |
| 310 | #else |
| 311 | #define UPB_DEPRECATED |
| 312 | #endif |
| 313 | #else |
| 314 | #define UPB_DEPRECATED |
| 315 | #endif |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 316 | |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 317 | // begin:google_only |
| 318 | // #define UPB_IS_GOOGLE3 |
| 319 | // end:google_only |
| 320 | |
| 321 | #if defined(UPB_IS_GOOGLE3) && !defined(UPB_BOOTSTRAP_STAGE0) |
| 322 | #define UPB_DESC(sym) proto2_##sym |
| 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 | |
Protobuf Team Bot | 376ba2f | 2023-09-29 22:17:43 +0000 | [diff] [blame] | 365 | #ifndef UPB_GENERATED_CODE_SUPPORT_H_ |
| 366 | #define UPB_GENERATED_CODE_SUPPORT_H_ |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 367 | |
Protobuf Team Bot | 376ba2f | 2023-09-29 22:17:43 +0000 | [diff] [blame] | 368 | // IWYU pragma: begin_exports |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 369 | |
Protobuf Team Bot | 376ba2f | 2023-09-29 22:17:43 +0000 | [diff] [blame] | 370 | #ifndef UPB_MESSAGE_ACCESSORS_H_ |
| 371 | #define UPB_MESSAGE_ACCESSORS_H_ |
Protobuf Team Bot | 473d20d | 2023-09-15 22:27:16 +0000 | [diff] [blame] | 372 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 373 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 374 | #ifndef UPB_BASE_DESCRIPTOR_CONSTANTS_H_ |
| 375 | #define UPB_BASE_DESCRIPTOR_CONSTANTS_H_ |
| 376 | |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 377 | // Must be last. |
| 378 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 379 | // The types a field can have. Note that this list is not identical to the |
| 380 | // types defined in descriptor.proto, which gives INT32 and SINT32 separate |
| 381 | // types (we distinguish the two with the "integer encoding" enum below). |
| 382 | // This enum is an internal convenience only and has no meaning outside of upb. |
| 383 | typedef enum { |
| 384 | kUpb_CType_Bool = 1, |
| 385 | kUpb_CType_Float = 2, |
| 386 | kUpb_CType_Int32 = 3, |
| 387 | kUpb_CType_UInt32 = 4, |
Protobuf Team Bot | 986cbb6 | 2023-09-19 15:03:51 +0000 | [diff] [blame] | 388 | kUpb_CType_Enum = 5, // Enum values are int32. TODO: rename |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 389 | kUpb_CType_Message = 6, |
| 390 | kUpb_CType_Double = 7, |
| 391 | kUpb_CType_Int64 = 8, |
| 392 | kUpb_CType_UInt64 = 9, |
| 393 | kUpb_CType_String = 10, |
| 394 | kUpb_CType_Bytes = 11 |
| 395 | } upb_CType; |
| 396 | |
| 397 | // The repeated-ness of each field; this matches descriptor.proto. |
| 398 | typedef enum { |
| 399 | kUpb_Label_Optional = 1, |
| 400 | kUpb_Label_Required = 2, |
| 401 | kUpb_Label_Repeated = 3 |
| 402 | } upb_Label; |
| 403 | |
| 404 | // Descriptor types, as defined in descriptor.proto. |
| 405 | typedef enum { |
| 406 | kUpb_FieldType_Double = 1, |
| 407 | kUpb_FieldType_Float = 2, |
| 408 | kUpb_FieldType_Int64 = 3, |
| 409 | kUpb_FieldType_UInt64 = 4, |
| 410 | kUpb_FieldType_Int32 = 5, |
| 411 | kUpb_FieldType_Fixed64 = 6, |
| 412 | kUpb_FieldType_Fixed32 = 7, |
| 413 | kUpb_FieldType_Bool = 8, |
| 414 | kUpb_FieldType_String = 9, |
| 415 | kUpb_FieldType_Group = 10, |
| 416 | kUpb_FieldType_Message = 11, |
| 417 | kUpb_FieldType_Bytes = 12, |
| 418 | kUpb_FieldType_UInt32 = 13, |
| 419 | kUpb_FieldType_Enum = 14, |
| 420 | kUpb_FieldType_SFixed32 = 15, |
| 421 | kUpb_FieldType_SFixed64 = 16, |
| 422 | kUpb_FieldType_SInt32 = 17, |
| 423 | kUpb_FieldType_SInt64 = 18, |
| 424 | } upb_FieldType; |
| 425 | |
| 426 | #define kUpb_FieldType_SizeOf 19 |
| 427 | |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 428 | #ifdef __cplusplus |
| 429 | extern "C" { |
| 430 | #endif |
| 431 | |
| 432 | UPB_INLINE bool upb_FieldType_IsPackable(upb_FieldType type) { |
| 433 | // clang-format off |
| 434 | const unsigned kUnpackableTypes = |
| 435 | (1 << kUpb_FieldType_String) | |
| 436 | (1 << kUpb_FieldType_Bytes) | |
| 437 | (1 << kUpb_FieldType_Message) | |
| 438 | (1 << kUpb_FieldType_Group); |
| 439 | // clang-format on |
| 440 | return (1 << type) & ~kUnpackableTypes; |
| 441 | } |
| 442 | |
| 443 | #ifdef __cplusplus |
| 444 | } /* extern "C" */ |
| 445 | #endif |
| 446 | |
| 447 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 448 | #endif /* UPB_BASE_DESCRIPTOR_CONSTANTS_H_ */ |
| 449 | |
Protobuf Team Bot | 376ba2f | 2023-09-29 22:17:43 +0000 | [diff] [blame] | 450 | #ifndef UPB_MESSAGE_ARRAY_H_ |
| 451 | #define UPB_MESSAGE_ARRAY_H_ |
| 452 | |
| 453 | #include <stddef.h> |
| 454 | |
| 455 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 456 | /* upb_Arena is a specific allocator implementation that uses arena allocation. |
| 457 | * The user provides an allocator that will be used to allocate the underlying |
| 458 | * arena blocks. Arenas by nature do not require the individual allocations |
| 459 | * to be freed. However the Arena does allow users to register cleanup |
| 460 | * functions that will run when the arena is destroyed. |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 461 | * |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 462 | * A upb_Arena is *not* thread-safe. |
| 463 | * |
| 464 | * You could write a thread-safe arena allocator that satisfies the |
| 465 | * upb_alloc interface, but it would not be as efficient for the |
| 466 | * single-threaded case. */ |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 467 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 468 | #ifndef UPB_MEM_ARENA_H_ |
| 469 | #define UPB_MEM_ARENA_H_ |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 470 | |
Adam Cozzette | 7d5592e | 2023-08-23 12:15:26 -0700 | [diff] [blame] | 471 | #include <stddef.h> |
| 472 | #include <stdint.h> |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 473 | #include <string.h> |
| 474 | |
| 475 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 476 | #ifndef UPB_MEM_ALLOC_H_ |
| 477 | #define UPB_MEM_ALLOC_H_ |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 478 | |
| 479 | // Must be last. |
| 480 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 481 | #ifdef __cplusplus |
| 482 | extern "C" { |
| 483 | #endif |
| 484 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 485 | typedef struct upb_alloc upb_alloc; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 486 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 487 | /* A combined `malloc()`/`free()` function. |
| 488 | * If `size` is 0 then the function acts like `free()`, otherwise it acts like |
| 489 | * `realloc()`. Only `oldsize` bytes from a previous allocation are |
| 490 | * preserved. */ |
| 491 | typedef void* upb_alloc_func(upb_alloc* alloc, void* ptr, size_t oldsize, |
| 492 | size_t size); |
| 493 | |
| 494 | /* A upb_alloc is a possibly-stateful allocator object. |
| 495 | * |
| 496 | * It could either be an arena allocator (which doesn't require individual |
| 497 | * `free()` calls) or a regular `malloc()` (which does). The client must |
| 498 | * therefore free memory unless it knows that the allocator is an arena |
| 499 | * allocator. */ |
| 500 | struct upb_alloc { |
| 501 | upb_alloc_func* func; |
| 502 | }; |
| 503 | |
| 504 | UPB_INLINE void* upb_malloc(upb_alloc* alloc, size_t size) { |
| 505 | UPB_ASSERT(alloc); |
| 506 | return alloc->func(alloc, NULL, 0, size); |
| 507 | } |
| 508 | |
| 509 | UPB_INLINE void* upb_realloc(upb_alloc* alloc, void* ptr, size_t oldsize, |
| 510 | size_t size) { |
| 511 | UPB_ASSERT(alloc); |
| 512 | return alloc->func(alloc, ptr, oldsize, size); |
| 513 | } |
| 514 | |
| 515 | UPB_INLINE void upb_free(upb_alloc* alloc, void* ptr) { |
| 516 | UPB_ASSERT(alloc); |
| 517 | alloc->func(alloc, ptr, 0, 0); |
| 518 | } |
| 519 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 520 | // The global allocator used by upb. Uses the standard malloc()/free(). |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 521 | |
| 522 | extern upb_alloc upb_alloc_global; |
| 523 | |
| 524 | /* Functions that hard-code the global malloc. |
| 525 | * |
| 526 | * We still get benefit because we can put custom logic into our global |
| 527 | * allocator, like injecting out-of-memory faults in debug/testing builds. */ |
| 528 | |
| 529 | UPB_INLINE void* upb_gmalloc(size_t size) { |
| 530 | return upb_malloc(&upb_alloc_global, size); |
| 531 | } |
| 532 | |
| 533 | UPB_INLINE void* upb_grealloc(void* ptr, size_t oldsize, size_t size) { |
| 534 | return upb_realloc(&upb_alloc_global, ptr, oldsize, size); |
| 535 | } |
| 536 | |
| 537 | UPB_INLINE void upb_gfree(void* ptr) { upb_free(&upb_alloc_global, ptr); } |
| 538 | |
| 539 | #ifdef __cplusplus |
| 540 | } /* extern "C" */ |
| 541 | #endif |
| 542 | |
| 543 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 544 | #endif /* UPB_MEM_ALLOC_H_ */ |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 545 | |
| 546 | // Must be last. |
| 547 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 548 | typedef struct upb_Arena upb_Arena; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 549 | |
| 550 | typedef struct { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 551 | char *ptr, *end; |
| 552 | } _upb_ArenaHead; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 553 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 554 | #ifdef __cplusplus |
| 555 | extern "C" { |
| 556 | #endif |
| 557 | |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 558 | // Creates an arena from the given initial block (if any -- n may be 0). |
| 559 | // Additional blocks will be allocated from |alloc|. If |alloc| is NULL, this |
| 560 | // is a fixed-size arena and cannot grow. |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 561 | 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] | 562 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 563 | UPB_API void upb_Arena_Free(upb_Arena* a); |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 564 | UPB_API bool upb_Arena_Fuse(upb_Arena* a, upb_Arena* b); |
| 565 | |
Protobuf Team Bot | 777d6a9 | 2023-10-06 23:52:49 +0000 | [diff] [blame] | 566 | void upb_Arena_IncRefFor(upb_Arena* arena, const void* owner); |
| 567 | void upb_Arena_DecRefFor(upb_Arena* arena, const void* owner); |
| 568 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 569 | void* _upb_Arena_SlowMalloc(upb_Arena* a, size_t size); |
| 570 | size_t upb_Arena_SpaceAllocated(upb_Arena* arena); |
| 571 | uint32_t upb_Arena_DebugRefCount(upb_Arena* arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 572 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 573 | UPB_INLINE size_t _upb_ArenaHas(upb_Arena* a) { |
| 574 | _upb_ArenaHead* h = (_upb_ArenaHead*)a; |
| 575 | return (size_t)(h->end - h->ptr); |
| 576 | } |
| 577 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 578 | 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] | 579 | size = UPB_ALIGN_MALLOC(size); |
Sandy Zhang | e3b0943 | 2023-08-07 09:30:02 -0700 | [diff] [blame] | 580 | size_t span = size + UPB_ASAN_GUARD_SIZE; |
| 581 | if (UPB_UNLIKELY(_upb_ArenaHas(a) < span)) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 582 | return _upb_Arena_SlowMalloc(a, size); |
| 583 | } |
| 584 | |
| 585 | // We have enough space to do a fast malloc. |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 586 | _upb_ArenaHead* h = (_upb_ArenaHead*)a; |
| 587 | void* ret = h->ptr; |
| 588 | UPB_ASSERT(UPB_ALIGN_MALLOC((uintptr_t)ret) == (uintptr_t)ret); |
| 589 | UPB_ASSERT(UPB_ALIGN_MALLOC(size) == size); |
| 590 | UPB_UNPOISON_MEMORY_REGION(ret, size); |
| 591 | |
Sandy Zhang | e3b0943 | 2023-08-07 09:30:02 -0700 | [diff] [blame] | 592 | h->ptr += span; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 593 | |
| 594 | return ret; |
| 595 | } |
| 596 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 597 | // Shrinks the last alloc from arena. |
| 598 | // REQUIRES: (ptr, oldsize) was the last malloc/realloc from this arena. |
| 599 | // We could also add a upb_Arena_TryShrinkLast() which is simply a no-op if |
| 600 | // this was not the last alloc. |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 601 | UPB_API_INLINE void upb_Arena_ShrinkLast(upb_Arena* a, void* ptr, |
| 602 | size_t oldsize, size_t size) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 603 | _upb_ArenaHead* h = (_upb_ArenaHead*)a; |
| 604 | oldsize = UPB_ALIGN_MALLOC(oldsize); |
| 605 | size = UPB_ALIGN_MALLOC(size); |
Sandy Zhang | e3b0943 | 2023-08-07 09:30:02 -0700 | [diff] [blame] | 606 | // Must be the last alloc. |
| 607 | UPB_ASSERT((char*)ptr + oldsize == h->ptr - UPB_ASAN_GUARD_SIZE); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 608 | UPB_ASSERT(size <= oldsize); |
| 609 | h->ptr = (char*)ptr + size; |
| 610 | } |
| 611 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 612 | UPB_API_INLINE void* upb_Arena_Realloc(upb_Arena* a, void* ptr, size_t oldsize, |
| 613 | size_t size) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 614 | _upb_ArenaHead* h = (_upb_ArenaHead*)a; |
| 615 | oldsize = UPB_ALIGN_MALLOC(oldsize); |
| 616 | size = UPB_ALIGN_MALLOC(size); |
| 617 | bool is_most_recent_alloc = (uintptr_t)ptr + oldsize == (uintptr_t)h->ptr; |
| 618 | |
| 619 | if (is_most_recent_alloc) { |
| 620 | ptrdiff_t diff = size - oldsize; |
| 621 | if ((ptrdiff_t)_upb_ArenaHas(a) >= diff) { |
| 622 | h->ptr += diff; |
| 623 | return ptr; |
| 624 | } |
| 625 | } else if (size <= oldsize) { |
| 626 | return ptr; |
| 627 | } |
| 628 | |
| 629 | void* ret = upb_Arena_Malloc(a, size); |
| 630 | |
| 631 | if (ret && oldsize > 0) { |
| 632 | memcpy(ret, ptr, UPB_MIN(oldsize, size)); |
| 633 | } |
| 634 | |
| 635 | return ret; |
| 636 | } |
| 637 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 638 | UPB_API_INLINE upb_Arena* upb_Arena_New(void) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 639 | return upb_Arena_Init(NULL, 0, &upb_alloc_global); |
| 640 | } |
| 641 | |
| 642 | #ifdef __cplusplus |
| 643 | } /* extern "C" */ |
| 644 | #endif |
| 645 | |
| 646 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 647 | #endif /* UPB_MEM_ARENA_H_ */ |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 648 | |
Protobuf Team Bot | 473d20d | 2023-09-15 22:27:16 +0000 | [diff] [blame] | 649 | // Users should include array.h or map.h instead. |
Protobuf Team Bot | 376ba2f | 2023-09-29 22:17:43 +0000 | [diff] [blame] | 650 | // IWYU pragma: private, include "upb/message/array.h" |
Protobuf Team Bot | 473d20d | 2023-09-15 22:27:16 +0000 | [diff] [blame] | 651 | |
| 652 | #ifndef UPB_MESSAGE_VALUE_H_ |
| 653 | #define UPB_MESSAGE_VALUE_H_ |
| 654 | |
| 655 | #include <stdint.h> |
| 656 | |
| 657 | #ifndef UPB_BASE_STRING_VIEW_H_ |
| 658 | #define UPB_BASE_STRING_VIEW_H_ |
| 659 | |
| 660 | #include <string.h> |
| 661 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 662 | // Must be last. |
| 663 | |
Protobuf Team Bot | 473d20d | 2023-09-15 22:27:16 +0000 | [diff] [blame] | 664 | #define UPB_STRINGVIEW_INIT(ptr, len) \ |
| 665 | { ptr, len } |
| 666 | |
| 667 | #define UPB_STRINGVIEW_FORMAT "%.*s" |
| 668 | #define UPB_STRINGVIEW_ARGS(view) (int)(view).size, (view).data |
| 669 | |
| 670 | // LINT.IfChange(struct_definition) |
| 671 | typedef struct { |
| 672 | const char* data; |
| 673 | size_t size; |
| 674 | } upb_StringView; |
| 675 | // LINT.ThenChange( |
| 676 | // GoogleInternalName0, |
| 677 | // //depot/google3/third_party/upb/bits/golang/accessor.go:map_go_string |
| 678 | // ) |
| 679 | |
| 680 | #ifdef __cplusplus |
| 681 | extern "C" { |
| 682 | #endif |
| 683 | |
| 684 | UPB_API_INLINE upb_StringView upb_StringView_FromDataAndSize(const char* data, |
| 685 | size_t size) { |
| 686 | upb_StringView ret; |
| 687 | ret.data = data; |
| 688 | ret.size = size; |
| 689 | return ret; |
| 690 | } |
| 691 | |
| 692 | UPB_INLINE upb_StringView upb_StringView_FromString(const char* data) { |
| 693 | return upb_StringView_FromDataAndSize(data, strlen(data)); |
| 694 | } |
| 695 | |
| 696 | UPB_INLINE bool upb_StringView_IsEqual(upb_StringView a, upb_StringView b) { |
| 697 | return a.size == b.size && memcmp(a.data, b.data, a.size) == 0; |
| 698 | } |
| 699 | |
| 700 | #ifdef __cplusplus |
| 701 | } /* extern "C" */ |
| 702 | #endif |
| 703 | |
| 704 | |
| 705 | #endif /* UPB_BASE_STRING_VIEW_H_ */ |
| 706 | |
| 707 | #ifndef UPB_MINI_TABLE_TYPES_H_ |
| 708 | #define UPB_MINI_TABLE_TYPES_H_ |
| 709 | |
| 710 | #include <stdint.h> |
| 711 | |
| 712 | |
| 713 | #ifndef UPB_MESSAGE_TYPES_H_ |
| 714 | #define UPB_MESSAGE_TYPES_H_ |
| 715 | |
| 716 | // This typedef is in a leaf header to resolve a circular dependency between |
| 717 | // messages and mini tables. |
| 718 | typedef void upb_Message; |
| 719 | |
| 720 | #endif /* UPB_MESSAGE_TYPES_H_ */ |
| 721 | |
| 722 | // Must be last. |
| 723 | |
| 724 | #ifdef __cplusplus |
| 725 | extern "C" { |
| 726 | #endif |
| 727 | |
| 728 | // When a upb_Message* is stored in a message, array, or map, it is stored in a |
| 729 | // tagged form. If the tag bit is set, the referenced upb_Message is of type |
| 730 | // _kUpb_MiniTable_Empty (a sentinel message type with no fields) instead of |
| 731 | // that field's true message type. This forms the basis of what we call |
| 732 | // "dynamic tree shaking." |
| 733 | // |
| 734 | // See the documentation for kUpb_DecodeOption_ExperimentalAllowUnlinked for |
| 735 | // more information. |
| 736 | typedef uintptr_t upb_TaggedMessagePtr; |
| 737 | |
| 738 | // Internal-only because empty messages cannot be created by the user. |
| 739 | UPB_INLINE upb_TaggedMessagePtr _upb_TaggedMessagePtr_Pack(upb_Message* ptr, |
| 740 | bool empty) { |
| 741 | UPB_ASSERT(((uintptr_t)ptr & 1) == 0); |
| 742 | return (uintptr_t)ptr | (empty ? 1 : 0); |
| 743 | } |
| 744 | |
| 745 | // Users who enable unlinked sub-messages must use this to test whether a |
| 746 | // message is empty before accessing it. If a message is empty, it must be |
| 747 | // first promoted using the interfaces in message/promote.h. |
| 748 | UPB_INLINE bool upb_TaggedMessagePtr_IsEmpty(upb_TaggedMessagePtr ptr) { |
| 749 | return ptr & 1; |
| 750 | } |
| 751 | |
| 752 | UPB_INLINE upb_Message* _upb_TaggedMessagePtr_GetMessage( |
| 753 | upb_TaggedMessagePtr ptr) { |
| 754 | return (upb_Message*)(ptr & ~(uintptr_t)1); |
| 755 | } |
| 756 | |
| 757 | UPB_INLINE upb_Message* upb_TaggedMessagePtr_GetNonEmptyMessage( |
| 758 | upb_TaggedMessagePtr ptr) { |
| 759 | UPB_ASSERT(!upb_TaggedMessagePtr_IsEmpty(ptr)); |
| 760 | return _upb_TaggedMessagePtr_GetMessage(ptr); |
| 761 | } |
| 762 | |
| 763 | UPB_INLINE upb_Message* _upb_TaggedMessagePtr_GetEmptyMessage( |
| 764 | upb_TaggedMessagePtr ptr) { |
| 765 | UPB_ASSERT(upb_TaggedMessagePtr_IsEmpty(ptr)); |
| 766 | return _upb_TaggedMessagePtr_GetMessage(ptr); |
| 767 | } |
| 768 | |
| 769 | #ifdef __cplusplus |
| 770 | } /* extern "C" */ |
| 771 | #endif |
| 772 | |
| 773 | |
| 774 | #endif /* UPB_MINI_TABLE_TYPES_H_ */ |
| 775 | |
| 776 | typedef union { |
| 777 | bool bool_val; |
| 778 | float float_val; |
| 779 | double double_val; |
| 780 | int32_t int32_val; |
| 781 | int64_t int64_val; |
| 782 | uint32_t uint32_val; |
| 783 | uint64_t uint64_val; |
| 784 | const struct upb_Array* array_val; |
| 785 | const struct upb_Map* map_val; |
| 786 | const upb_Message* msg_val; |
| 787 | upb_StringView str_val; |
| 788 | |
| 789 | // EXPERIMENTAL: A tagged upb_Message*. Users must use this instead of |
| 790 | // msg_val if unlinked sub-messages may possibly be in use. See the |
| 791 | // documentation in kUpb_DecodeOption_ExperimentalAllowUnlinked for more |
| 792 | // information. |
| 793 | upb_TaggedMessagePtr tagged_msg_val; |
| 794 | } upb_MessageValue; |
| 795 | |
| 796 | typedef union { |
| 797 | struct upb_Array* array; |
| 798 | struct upb_Map* map; |
| 799 | upb_Message* msg; |
| 800 | } upb_MutableMessageValue; |
| 801 | |
| 802 | #endif /* UPB_MESSAGE_VALUE_H_ */ |
| 803 | |
| 804 | // Must be last. |
| 805 | |
| 806 | typedef struct upb_Array upb_Array; |
| 807 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 808 | #ifdef __cplusplus |
| 809 | extern "C" { |
| 810 | #endif |
| 811 | |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 812 | // Creates a new array on the given arena that holds elements of this type. |
| 813 | 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] | 814 | |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 815 | // Returns the number of elements in the array. |
| 816 | UPB_API size_t upb_Array_Size(const upb_Array* arr); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 817 | |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 818 | // Returns the given element, which must be within the array's current size. |
| 819 | 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] | 820 | |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 821 | // Sets the given element, which must be within the array's current size. |
| 822 | 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] | 823 | |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 824 | // Appends an element to the array. Returns false on allocation failure. |
| 825 | UPB_API bool upb_Array_Append(upb_Array* array, upb_MessageValue val, |
| 826 | upb_Arena* arena); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 827 | |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 828 | // Moves elements within the array using memmove(). |
| 829 | // Like memmove(), the source and destination elements may be overlapping. |
| 830 | UPB_API void upb_Array_Move(upb_Array* array, size_t dst_idx, size_t src_idx, |
| 831 | size_t count); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 832 | |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 833 | // Inserts one or more empty elements into the array. |
| 834 | // Existing elements are shifted right. |
| 835 | // The new elements have undefined state and must be set with `upb_Array_Set()`. |
| 836 | // REQUIRES: `i <= upb_Array_Size(arr)` |
| 837 | UPB_API bool upb_Array_Insert(upb_Array* array, size_t i, size_t count, |
| 838 | upb_Arena* arena); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 839 | |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 840 | // Deletes one or more elements from the array. |
| 841 | // Existing elements are shifted left. |
| 842 | // REQUIRES: `i + count <= upb_Array_Size(arr)` |
| 843 | 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] | 844 | |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 845 | // Changes the size of a vector. New elements are initialized to NULL/0. |
| 846 | // Returns false on allocation failure. |
| 847 | 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] | 848 | |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 849 | // Returns pointer to array data. |
| 850 | UPB_API const void* upb_Array_DataPtr(const upb_Array* arr); |
| 851 | |
| 852 | // Returns mutable pointer to array data. |
| 853 | UPB_API void* upb_Array_MutableDataPtr(upb_Array* arr); |
| 854 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 855 | #ifdef __cplusplus |
| 856 | } /* extern "C" */ |
| 857 | #endif |
| 858 | |
| 859 | |
Protobuf Team Bot | 376ba2f | 2023-09-29 22:17:43 +0000 | [diff] [blame] | 860 | #endif /* UPB_MESSAGE_ARRAY_H_ */ |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 861 | |
Protobuf Team Bot | 376ba2f | 2023-09-29 22:17:43 +0000 | [diff] [blame] | 862 | #ifndef UPB_MESSAGE_INTERNAL_ACCESSORS_H_ |
| 863 | #define UPB_MESSAGE_INTERNAL_ACCESSORS_H_ |
Protobuf Team Bot | dcc1f61 | 2023-09-05 21:56:25 +0000 | [diff] [blame] | 864 | |
Protobuf Team Bot | dcc1f61 | 2023-09-05 21:56:25 +0000 | [diff] [blame] | 865 | |
Adam Cozzette | 8059da2 | 2023-08-16 07:57:14 -0700 | [diff] [blame] | 866 | #ifndef UPB_MESSAGE_INTERNAL_EXTENSION_H_ |
| 867 | #define UPB_MESSAGE_INTERNAL_EXTENSION_H_ |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 868 | |
| 869 | |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 870 | // Public APIs for message operations that do not depend on the schema. |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 871 | // |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 872 | // MiniTable-based accessors live in accessors.h. |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 873 | |
| 874 | #ifndef UPB_MESSAGE_MESSAGE_H_ |
| 875 | #define UPB_MESSAGE_MESSAGE_H_ |
| 876 | |
Protobuf Team Bot | 75af7f9 | 2023-09-06 18:07:53 +0000 | [diff] [blame] | 877 | #include <stddef.h> |
| 878 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 879 | |
Protobuf Team Bot | 473d20d | 2023-09-15 22:27:16 +0000 | [diff] [blame] | 880 | #ifndef UPB_MINI_TABLE_MESSAGE_H_ |
| 881 | #define UPB_MINI_TABLE_MESSAGE_H_ |
| 882 | |
| 883 | |
| 884 | #ifndef UPB_MINI_TABLE_ENUM_H_ |
| 885 | #define UPB_MINI_TABLE_ENUM_H_ |
| 886 | |
| 887 | |
| 888 | #ifndef UPB_MINI_TABLE_INTERNAL_ENUM_H_ |
| 889 | #define UPB_MINI_TABLE_INTERNAL_ENUM_H_ |
| 890 | |
| 891 | #include <stdint.h> |
| 892 | |
| 893 | // Must be last. |
| 894 | |
| 895 | struct upb_MiniTableEnum { |
| 896 | uint32_t mask_limit; // Limit enum value that can be tested with mask. |
| 897 | uint32_t value_count; // Number of values after the bitfield. |
| 898 | uint32_t data[]; // Bitmask + enumerated values follow. |
| 899 | }; |
| 900 | |
| 901 | typedef enum { |
| 902 | _kUpb_FastEnumCheck_ValueIsInEnum = 0, |
| 903 | _kUpb_FastEnumCheck_ValueIsNotInEnum = 1, |
| 904 | _kUpb_FastEnumCheck_CannotCheckFast = 2, |
| 905 | } _kUpb_FastEnumCheck_Status; |
| 906 | |
| 907 | #ifdef __cplusplus |
| 908 | extern "C" { |
| 909 | #endif |
| 910 | |
| 911 | UPB_INLINE _kUpb_FastEnumCheck_Status _upb_MiniTable_CheckEnumValueFast( |
| 912 | const struct upb_MiniTableEnum* e, uint32_t val) { |
| 913 | if (UPB_UNLIKELY(val >= 64)) return _kUpb_FastEnumCheck_CannotCheckFast; |
| 914 | uint64_t mask = e->data[0] | ((uint64_t)e->data[1] << 32); |
| 915 | return (mask & (1ULL << val)) ? _kUpb_FastEnumCheck_ValueIsInEnum |
| 916 | : _kUpb_FastEnumCheck_ValueIsNotInEnum; |
| 917 | } |
| 918 | |
| 919 | UPB_INLINE bool _upb_MiniTable_CheckEnumValueSlow( |
| 920 | const struct upb_MiniTableEnum* e, uint32_t val) { |
| 921 | if (val < e->mask_limit) return e->data[val / 32] & (1ULL << (val % 32)); |
| 922 | // OPT: binary search long lists? |
| 923 | const uint32_t* start = &e->data[e->mask_limit / 32]; |
| 924 | const uint32_t* limit = &e->data[(e->mask_limit / 32) + e->value_count]; |
| 925 | for (const uint32_t* p = start; p < limit; p++) { |
| 926 | if (*p == val) return true; |
| 927 | } |
| 928 | return false; |
| 929 | } |
| 930 | |
| 931 | #ifdef __cplusplus |
| 932 | } /* extern "C" */ |
| 933 | #endif |
| 934 | |
| 935 | |
| 936 | #endif /* UPB_MINI_TABLE_INTERNAL_ENUM_H_ */ |
| 937 | |
| 938 | // Must be last |
| 939 | |
| 940 | typedef struct upb_MiniTableEnum upb_MiniTableEnum; |
| 941 | |
Protobuf Team Bot | 450e065 | 2023-09-21 17:36:36 +0000 | [diff] [blame] | 942 | #ifdef __cplusplus |
| 943 | extern "C" { |
| 944 | #endif |
| 945 | |
Protobuf Team Bot | 473d20d | 2023-09-15 22:27:16 +0000 | [diff] [blame] | 946 | // Validates enum value against range defined by enum mini table. |
| 947 | UPB_INLINE bool upb_MiniTableEnum_CheckValue(const struct upb_MiniTableEnum* e, |
| 948 | uint32_t val) { |
| 949 | _kUpb_FastEnumCheck_Status status = _upb_MiniTable_CheckEnumValueFast(e, val); |
| 950 | if (UPB_UNLIKELY(status == _kUpb_FastEnumCheck_CannotCheckFast)) { |
| 951 | return _upb_MiniTable_CheckEnumValueSlow(e, val); |
| 952 | } |
| 953 | return status == _kUpb_FastEnumCheck_ValueIsInEnum ? true : false; |
| 954 | } |
| 955 | |
Protobuf Team Bot | 450e065 | 2023-09-21 17:36:36 +0000 | [diff] [blame] | 956 | #ifdef __cplusplus |
| 957 | } /* extern "C" */ |
| 958 | #endif |
| 959 | |
Protobuf Team Bot | 473d20d | 2023-09-15 22:27:16 +0000 | [diff] [blame] | 960 | |
| 961 | #endif /* UPB_MINI_TABLE_ENUM_H_ */ |
| 962 | |
| 963 | #ifndef UPB_MINI_TABLE_FIELD_H_ |
| 964 | #define UPB_MINI_TABLE_FIELD_H_ |
| 965 | |
| 966 | |
| 967 | #ifndef UPB_MINI_TABLE_INTERNAL_FIELD_H_ |
| 968 | #define UPB_MINI_TABLE_INTERNAL_FIELD_H_ |
| 969 | |
| 970 | #include <stdint.h> |
| 971 | |
| 972 | |
| 973 | // Must be last. |
| 974 | |
| 975 | struct upb_MiniTableField { |
| 976 | uint32_t number; |
| 977 | uint16_t offset; |
| 978 | int16_t presence; // If >0, hasbit_index. If <0, ~oneof_index |
| 979 | |
| 980 | // Indexes into `upb_MiniTable.subs` |
| 981 | // Will be set to `kUpb_NoSub` if `descriptortype` != MESSAGE/GROUP/ENUM |
| 982 | uint16_t UPB_PRIVATE(submsg_index); |
| 983 | |
| 984 | uint8_t UPB_PRIVATE(descriptortype); |
| 985 | |
| 986 | // upb_FieldMode | upb_LabelFlags | (upb_FieldRep << kUpb_FieldRep_Shift) |
| 987 | uint8_t mode; |
| 988 | }; |
| 989 | |
| 990 | #define kUpb_NoSub ((uint16_t)-1) |
| 991 | |
| 992 | typedef enum { |
| 993 | kUpb_FieldMode_Map = 0, |
| 994 | kUpb_FieldMode_Array = 1, |
| 995 | kUpb_FieldMode_Scalar = 2, |
| 996 | } upb_FieldMode; |
| 997 | |
| 998 | // Mask to isolate the upb_FieldMode from field.mode. |
| 999 | #define kUpb_FieldMode_Mask 3 |
| 1000 | |
| 1001 | // Extra flags on the mode field. |
| 1002 | typedef enum { |
| 1003 | kUpb_LabelFlags_IsPacked = 4, |
| 1004 | kUpb_LabelFlags_IsExtension = 8, |
| 1005 | // Indicates that this descriptor type is an "alternate type": |
| 1006 | // - for Int32, this indicates that the actual type is Enum (but was |
| 1007 | // rewritten to Int32 because it is an open enum that requires no check). |
| 1008 | // - for Bytes, this indicates that the actual type is String (but does |
| 1009 | // not require any UTF-8 check). |
| 1010 | kUpb_LabelFlags_IsAlternate = 16, |
| 1011 | } upb_LabelFlags; |
| 1012 | |
| 1013 | // Note: we sort by this number when calculating layout order. |
| 1014 | typedef enum { |
| 1015 | kUpb_FieldRep_1Byte = 0, |
| 1016 | kUpb_FieldRep_4Byte = 1, |
| 1017 | kUpb_FieldRep_StringView = 2, |
| 1018 | kUpb_FieldRep_8Byte = 3, |
| 1019 | |
| 1020 | kUpb_FieldRep_NativePointer = |
| 1021 | UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte), |
| 1022 | kUpb_FieldRep_Max = kUpb_FieldRep_8Byte, |
| 1023 | } upb_FieldRep; |
| 1024 | |
| 1025 | #define kUpb_FieldRep_Shift 6 |
| 1026 | |
| 1027 | UPB_INLINE upb_FieldRep |
| 1028 | _upb_MiniTableField_GetRep(const struct upb_MiniTableField* field) { |
| 1029 | return (upb_FieldRep)(field->mode >> kUpb_FieldRep_Shift); |
| 1030 | } |
| 1031 | |
| 1032 | #ifdef __cplusplus |
| 1033 | extern "C" { |
| 1034 | #endif |
| 1035 | |
| 1036 | UPB_INLINE upb_FieldMode |
| 1037 | upb_FieldMode_Get(const struct upb_MiniTableField* field) { |
| 1038 | return (upb_FieldMode)(field->mode & 3); |
| 1039 | } |
| 1040 | |
| 1041 | UPB_INLINE void _upb_MiniTableField_CheckIsArray( |
| 1042 | const struct upb_MiniTableField* field) { |
| 1043 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_NativePointer); |
| 1044 | UPB_ASSUME(upb_FieldMode_Get(field) == kUpb_FieldMode_Array); |
| 1045 | UPB_ASSUME(field->presence == 0); |
| 1046 | } |
| 1047 | |
| 1048 | UPB_INLINE void _upb_MiniTableField_CheckIsMap( |
| 1049 | const struct upb_MiniTableField* field) { |
| 1050 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_NativePointer); |
| 1051 | UPB_ASSUME(upb_FieldMode_Get(field) == kUpb_FieldMode_Map); |
| 1052 | UPB_ASSUME(field->presence == 0); |
| 1053 | } |
| 1054 | |
| 1055 | UPB_INLINE bool upb_IsRepeatedOrMap(const struct upb_MiniTableField* field) { |
| 1056 | // This works because upb_FieldMode has no value 3. |
| 1057 | return !(field->mode & kUpb_FieldMode_Scalar); |
| 1058 | } |
| 1059 | |
| 1060 | UPB_INLINE bool upb_IsSubMessage(const struct upb_MiniTableField* field) { |
| 1061 | return field->UPB_PRIVATE(descriptortype) == kUpb_FieldType_Message || |
| 1062 | field->UPB_PRIVATE(descriptortype) == kUpb_FieldType_Group; |
| 1063 | } |
| 1064 | |
| 1065 | #ifdef __cplusplus |
| 1066 | } /* extern "C" */ |
| 1067 | #endif |
| 1068 | |
| 1069 | |
| 1070 | #endif /* UPB_MINI_TABLE_INTERNAL_FIELD_H_ */ |
| 1071 | |
| 1072 | #ifndef UPB_MINI_TABLE_INTERNAL_MESSAGE_H_ |
| 1073 | #define UPB_MINI_TABLE_INTERNAL_MESSAGE_H_ |
| 1074 | |
| 1075 | |
| 1076 | // Must be last. |
| 1077 | |
| 1078 | struct upb_Decoder; |
| 1079 | typedef const char* _upb_FieldParser(struct upb_Decoder* d, const char* ptr, |
| 1080 | upb_Message* msg, intptr_t table, |
| 1081 | uint64_t hasbits, uint64_t data); |
| 1082 | typedef struct { |
| 1083 | uint64_t field_data; |
| 1084 | _upb_FieldParser* field_parser; |
| 1085 | } _upb_FastTable_Entry; |
| 1086 | |
| 1087 | typedef enum { |
| 1088 | kUpb_ExtMode_NonExtendable = 0, // Non-extendable message. |
| 1089 | kUpb_ExtMode_Extendable = 1, // Normal extendable message. |
| 1090 | kUpb_ExtMode_IsMessageSet = 2, // MessageSet message. |
| 1091 | kUpb_ExtMode_IsMessageSet_ITEM = |
| 1092 | 3, // MessageSet item (temporary only, see decode.c) |
| 1093 | |
| 1094 | // During table building we steal a bit to indicate that the message is a map |
| 1095 | // entry. *Only* used during table building! |
| 1096 | kUpb_ExtMode_IsMapEntry = 4, |
| 1097 | } upb_ExtMode; |
| 1098 | |
| 1099 | union upb_MiniTableSub; |
| 1100 | |
| 1101 | // upb_MiniTable represents the memory layout of a given upb_MessageDef. |
| 1102 | // The members are public so generated code can initialize them, |
| 1103 | // but users MUST NOT directly read or write any of its members. |
| 1104 | struct upb_MiniTable { |
| 1105 | const union upb_MiniTableSub* subs; |
| 1106 | const struct upb_MiniTableField* fields; |
| 1107 | |
| 1108 | // Must be aligned to sizeof(void*). Doesn't include internal members like |
| 1109 | // unknown fields, extension dict, pointer to msglayout, etc. |
| 1110 | uint16_t size; |
| 1111 | |
| 1112 | uint16_t field_count; |
| 1113 | uint8_t ext; // upb_ExtMode, declared as uint8_t so sizeof(ext) == 1 |
| 1114 | uint8_t dense_below; |
| 1115 | uint8_t table_mask; |
| 1116 | uint8_t required_count; // Required fields have the lowest hasbits. |
| 1117 | |
| 1118 | // To statically initialize the tables of variable length, we need a flexible |
| 1119 | // array member, and we need to compile in gnu99 mode (constant initialization |
| 1120 | // of flexible array members is a GNU extension, not in C99 unfortunately. |
| 1121 | _upb_FastTable_Entry fasttable[]; |
| 1122 | }; |
| 1123 | |
| 1124 | #ifdef __cplusplus |
| 1125 | extern "C" { |
| 1126 | #endif |
| 1127 | |
| 1128 | // A MiniTable for an empty message, used for unlinked sub-messages. |
| 1129 | extern const struct upb_MiniTable _kUpb_MiniTable_Empty; |
| 1130 | |
| 1131 | // Computes a bitmask in which the |l->required_count| lowest bits are set, |
| 1132 | // except that we skip the lowest bit (because upb never uses hasbit 0). |
| 1133 | // |
| 1134 | // Sample output: |
| 1135 | // requiredmask(1) => 0b10 (0x2) |
| 1136 | // requiredmask(5) => 0b111110 (0x3e) |
| 1137 | UPB_INLINE uint64_t upb_MiniTable_requiredmask(const struct upb_MiniTable* l) { |
| 1138 | int n = l->required_count; |
| 1139 | assert(0 < n && n <= 63); |
| 1140 | return ((1ULL << n) - 1) << 1; |
| 1141 | } |
| 1142 | |
| 1143 | #ifdef __cplusplus |
| 1144 | } /* extern "C" */ |
| 1145 | #endif |
| 1146 | |
| 1147 | |
| 1148 | #endif /* UPB_MINI_TABLE_INTERNAL_MESSAGE_H_ */ |
Protobuf Team Bot | 473d20d | 2023-09-15 22:27:16 +0000 | [diff] [blame] | 1149 | #ifndef UPB_MINI_TABLE_INTERNAL_SUB_H_ |
| 1150 | #define UPB_MINI_TABLE_INTERNAL_SUB_H_ |
| 1151 | |
| 1152 | |
| 1153 | union upb_MiniTableSub { |
| 1154 | const struct upb_MiniTable* submsg; |
| 1155 | const struct upb_MiniTableEnum* subenum; |
| 1156 | }; |
| 1157 | |
| 1158 | #endif /* UPB_MINI_TABLE_INTERNAL_SUB_H_ */ |
| 1159 | |
| 1160 | // Must be last. |
| 1161 | |
| 1162 | #ifdef __cplusplus |
| 1163 | extern "C" { |
| 1164 | #endif |
| 1165 | |
| 1166 | typedef struct upb_MiniTableField upb_MiniTableField; |
| 1167 | |
| 1168 | UPB_API_INLINE upb_FieldType |
| 1169 | upb_MiniTableField_Type(const upb_MiniTableField* field) { |
| 1170 | if (field->mode & kUpb_LabelFlags_IsAlternate) { |
| 1171 | if (field->UPB_PRIVATE(descriptortype) == kUpb_FieldType_Int32) { |
| 1172 | return kUpb_FieldType_Enum; |
| 1173 | } else if (field->UPB_PRIVATE(descriptortype) == kUpb_FieldType_Bytes) { |
| 1174 | return kUpb_FieldType_String; |
| 1175 | } else { |
| 1176 | UPB_ASSERT(false); |
| 1177 | } |
| 1178 | } |
| 1179 | return (upb_FieldType)field->UPB_PRIVATE(descriptortype); |
| 1180 | } |
| 1181 | |
| 1182 | UPB_API_INLINE upb_CType upb_MiniTableField_CType(const upb_MiniTableField* f) { |
| 1183 | switch (upb_MiniTableField_Type(f)) { |
| 1184 | case kUpb_FieldType_Double: |
| 1185 | return kUpb_CType_Double; |
| 1186 | case kUpb_FieldType_Float: |
| 1187 | return kUpb_CType_Float; |
| 1188 | case kUpb_FieldType_Int64: |
| 1189 | case kUpb_FieldType_SInt64: |
| 1190 | case kUpb_FieldType_SFixed64: |
| 1191 | return kUpb_CType_Int64; |
| 1192 | case kUpb_FieldType_Int32: |
| 1193 | case kUpb_FieldType_SFixed32: |
| 1194 | case kUpb_FieldType_SInt32: |
| 1195 | return kUpb_CType_Int32; |
| 1196 | case kUpb_FieldType_UInt64: |
| 1197 | case kUpb_FieldType_Fixed64: |
| 1198 | return kUpb_CType_UInt64; |
| 1199 | case kUpb_FieldType_UInt32: |
| 1200 | case kUpb_FieldType_Fixed32: |
| 1201 | return kUpb_CType_UInt32; |
| 1202 | case kUpb_FieldType_Enum: |
| 1203 | return kUpb_CType_Enum; |
| 1204 | case kUpb_FieldType_Bool: |
| 1205 | return kUpb_CType_Bool; |
| 1206 | case kUpb_FieldType_String: |
| 1207 | return kUpb_CType_String; |
| 1208 | case kUpb_FieldType_Bytes: |
| 1209 | return kUpb_CType_Bytes; |
| 1210 | case kUpb_FieldType_Group: |
| 1211 | case kUpb_FieldType_Message: |
| 1212 | return kUpb_CType_Message; |
| 1213 | } |
| 1214 | UPB_UNREACHABLE(); |
| 1215 | } |
| 1216 | |
| 1217 | UPB_API_INLINE bool upb_MiniTableField_IsExtension( |
| 1218 | const upb_MiniTableField* field) { |
| 1219 | return field->mode & kUpb_LabelFlags_IsExtension; |
| 1220 | } |
| 1221 | |
| 1222 | UPB_API_INLINE bool upb_MiniTableField_IsClosedEnum( |
| 1223 | const upb_MiniTableField* field) { |
| 1224 | return field->UPB_PRIVATE(descriptortype) == kUpb_FieldType_Enum; |
| 1225 | } |
| 1226 | |
| 1227 | UPB_API_INLINE bool upb_MiniTableField_HasPresence( |
| 1228 | const upb_MiniTableField* field) { |
| 1229 | if (upb_MiniTableField_IsExtension(field)) { |
| 1230 | return !upb_IsRepeatedOrMap(field); |
| 1231 | } else { |
| 1232 | return field->presence != 0; |
| 1233 | } |
| 1234 | } |
| 1235 | |
| 1236 | #ifdef __cplusplus |
| 1237 | } /* extern "C" */ |
| 1238 | #endif |
| 1239 | |
| 1240 | |
| 1241 | #endif /* UPB_MINI_TABLE_FIELD_H_ */ |
| 1242 | |
| 1243 | // Must be last. |
| 1244 | |
| 1245 | #ifdef __cplusplus |
| 1246 | extern "C" { |
| 1247 | #endif |
| 1248 | |
| 1249 | typedef struct upb_MiniTable upb_MiniTable; |
| 1250 | |
| 1251 | UPB_API const upb_MiniTableField* upb_MiniTable_FindFieldByNumber( |
| 1252 | const upb_MiniTable* table, uint32_t number); |
| 1253 | |
| 1254 | UPB_API_INLINE const upb_MiniTableField* upb_MiniTable_GetFieldByIndex( |
| 1255 | const upb_MiniTable* t, uint32_t index) { |
| 1256 | return &t->fields[index]; |
| 1257 | } |
| 1258 | |
| 1259 | // Returns the MiniTable for this message field. If the field is unlinked, |
| 1260 | // returns NULL. |
| 1261 | UPB_API_INLINE const upb_MiniTable* upb_MiniTable_GetSubMessageTable( |
| 1262 | const upb_MiniTable* mini_table, const upb_MiniTableField* field) { |
| 1263 | UPB_ASSERT(upb_MiniTableField_CType(field) == kUpb_CType_Message); |
| 1264 | const upb_MiniTable* ret = |
| 1265 | mini_table->subs[field->UPB_PRIVATE(submsg_index)].submsg; |
| 1266 | UPB_ASSUME(ret); |
| 1267 | return ret == &_kUpb_MiniTable_Empty ? NULL : ret; |
| 1268 | } |
| 1269 | |
| 1270 | // Returns the MiniTableEnum for this enum field. If the field is unlinked, |
| 1271 | // returns NULL. |
| 1272 | UPB_API_INLINE const upb_MiniTableEnum* upb_MiniTable_GetSubEnumTable( |
| 1273 | const upb_MiniTable* mini_table, const upb_MiniTableField* field) { |
| 1274 | UPB_ASSERT(upb_MiniTableField_CType(field) == kUpb_CType_Enum); |
| 1275 | return mini_table->subs[field->UPB_PRIVATE(submsg_index)].subenum; |
| 1276 | } |
| 1277 | |
| 1278 | // Returns true if this MiniTable field is linked to a MiniTable for the |
| 1279 | // sub-message. |
| 1280 | UPB_API_INLINE bool upb_MiniTable_MessageFieldIsLinked( |
| 1281 | const upb_MiniTable* mini_table, const upb_MiniTableField* field) { |
| 1282 | return upb_MiniTable_GetSubMessageTable(mini_table, field) != NULL; |
| 1283 | } |
| 1284 | |
| 1285 | // If this field is in a oneof, returns the first field in the oneof. |
| 1286 | // |
| 1287 | // Otherwise returns NULL. |
| 1288 | // |
| 1289 | // Usage: |
| 1290 | // const upb_MiniTableField* field = upb_MiniTable_GetOneof(m, f); |
| 1291 | // do { |
| 1292 | // .. |
| 1293 | // } while (upb_MiniTable_NextOneofField(m, &field); |
| 1294 | // |
| 1295 | const upb_MiniTableField* upb_MiniTable_GetOneof(const upb_MiniTable* m, |
| 1296 | const upb_MiniTableField* f); |
| 1297 | |
| 1298 | // Iterates to the next field in the oneof. If this is the last field in the |
| 1299 | // oneof, returns false. The ordering of fields in the oneof is not |
| 1300 | // guaranteed. |
| 1301 | // REQUIRES: |f| is the field initialized by upb_MiniTable_GetOneof and updated |
| 1302 | // by prior upb_MiniTable_NextOneofField calls. |
| 1303 | bool upb_MiniTable_NextOneofField(const upb_MiniTable* m, |
| 1304 | const upb_MiniTableField** f); |
| 1305 | |
| 1306 | #ifdef __cplusplus |
| 1307 | } /* extern "C" */ |
| 1308 | #endif |
| 1309 | |
| 1310 | |
| 1311 | #endif /* UPB_MINI_TABLE_MESSAGE_H_ */ |
| 1312 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1313 | // Must be last. |
| 1314 | |
| 1315 | #ifdef __cplusplus |
| 1316 | extern "C" { |
| 1317 | #endif |
| 1318 | |
| 1319 | // 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] | 1320 | UPB_API upb_Message* upb_Message_New(const upb_MiniTable* mini_table, |
| 1321 | upb_Arena* arena); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1322 | |
| 1323 | // Adds unknown data (serialized protobuf data) to the given message. |
| 1324 | // The data is copied into the message instance. |
| 1325 | void upb_Message_AddUnknown(upb_Message* msg, const char* data, size_t len, |
| 1326 | upb_Arena* arena); |
| 1327 | |
| 1328 | // Returns a reference to the message's unknown data. |
| 1329 | const char* upb_Message_GetUnknown(const upb_Message* msg, size_t* len); |
| 1330 | |
| 1331 | // Removes partial unknown data from message. |
| 1332 | void upb_Message_DeleteUnknown(upb_Message* msg, const char* data, size_t len); |
| 1333 | |
| 1334 | // Returns the number of extensions present in this message. |
| 1335 | size_t upb_Message_ExtensionCount(const upb_Message* msg); |
| 1336 | |
| 1337 | #ifdef __cplusplus |
| 1338 | } /* extern "C" */ |
| 1339 | #endif |
| 1340 | |
| 1341 | |
| 1342 | #endif /* UPB_MESSAGE_MESSAGE_H_ */ |
| 1343 | |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 1344 | #ifndef UPB_MINI_TABLE_EXTENSION_H_ |
| 1345 | #define UPB_MINI_TABLE_EXTENSION_H_ |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1346 | |
| 1347 | |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 1348 | #ifndef UPB_MINI_TABLE_INTERNAL_EXTENSION_H_ |
| 1349 | #define UPB_MINI_TABLE_INTERNAL_EXTENSION_H_ |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1350 | |
| 1351 | |
| 1352 | // Must be last. |
| 1353 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1354 | struct upb_MiniTableExtension { |
Deanna Garcia | 59cfc2f | 2023-01-31 13:19:28 -0800 | [diff] [blame] | 1355 | // 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] | 1356 | struct upb_MiniTableField field; |
Deanna Garcia | 59cfc2f | 2023-01-31 13:19:28 -0800 | [diff] [blame] | 1357 | |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 1358 | const struct upb_MiniTable* extendee; |
| 1359 | union upb_MiniTableSub sub; // NULL unless submessage or proto2 enum |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1360 | }; |
| 1361 | |
| 1362 | |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 1363 | #endif /* UPB_MINI_TABLE_INTERNAL_EXTENSION_H_ */ |
| 1364 | |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 1365 | typedef struct upb_MiniTableExtension upb_MiniTableExtension; |
| 1366 | |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 1367 | #endif /* UPB_MINI_TABLE_EXTENSION_H_ */ |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1368 | |
| 1369 | // Must be last. |
| 1370 | |
| 1371 | // The internal representation of an extension is self-describing: it contains |
| 1372 | // enough information that we can serialize it to binary format without needing |
| 1373 | // to look it up in a upb_ExtensionRegistry. |
| 1374 | // |
| 1375 | // This representation allocates 16 bytes to data on 64-bit platforms. |
| 1376 | // This is rather wasteful for scalars (in the extreme case of bool, |
| 1377 | // it wastes 15 bytes). We accept this because we expect messages to be |
| 1378 | // the most common extension type. |
| 1379 | typedef struct { |
| 1380 | const upb_MiniTableExtension* ext; |
| 1381 | union { |
| 1382 | upb_StringView str; |
| 1383 | void* ptr; |
| 1384 | char scalar_data[8]; |
| 1385 | } data; |
| 1386 | } upb_Message_Extension; |
| 1387 | |
| 1388 | #ifdef __cplusplus |
| 1389 | extern "C" { |
| 1390 | #endif |
| 1391 | |
| 1392 | // Adds the given extension data to the given message. |
| 1393 | // |ext| is copied into the message instance. |
| 1394 | // This logically replaces any previously-added extension with this number. |
| 1395 | upb_Message_Extension* _upb_Message_GetOrCreateExtension( |
| 1396 | upb_Message* msg, const upb_MiniTableExtension* ext, upb_Arena* arena); |
| 1397 | |
| 1398 | // Returns an array of extensions for this message. |
| 1399 | // Note: the array is ordered in reverse relative to the order of creation. |
| 1400 | const upb_Message_Extension* _upb_Message_Getexts(const upb_Message* msg, |
| 1401 | size_t* count); |
| 1402 | |
| 1403 | // Returns an extension for the given field number, or NULL if no extension |
| 1404 | // exists for this field number. |
| 1405 | const upb_Message_Extension* _upb_Message_Getext( |
| 1406 | const upb_Message* msg, const upb_MiniTableExtension* ext); |
| 1407 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1408 | #ifdef __cplusplus |
| 1409 | } /* extern "C" */ |
| 1410 | #endif |
| 1411 | |
| 1412 | |
Adam Cozzette | 8059da2 | 2023-08-16 07:57:14 -0700 | [diff] [blame] | 1413 | #endif /* UPB_MESSAGE_INTERNAL_EXTENSION_H_ */ |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1414 | |
Protobuf Team Bot | 376ba2f | 2023-09-29 22:17:43 +0000 | [diff] [blame] | 1415 | // EVERYTHING BELOW THIS LINE IS INTERNAL - DO NOT USE ///////////////////////// |
| 1416 | |
| 1417 | #ifndef UPB_COLLECTIONS_INTERNAL_MAP_H_ |
| 1418 | #define UPB_COLLECTIONS_INTERNAL_MAP_H_ |
| 1419 | |
| 1420 | |
| 1421 | #ifndef UPB_HASH_STR_TABLE_H_ |
| 1422 | #define UPB_HASH_STR_TABLE_H_ |
| 1423 | |
| 1424 | |
| 1425 | /* |
| 1426 | * upb_table |
| 1427 | * |
| 1428 | * This header is INTERNAL-ONLY! Its interfaces are not public or stable! |
| 1429 | * This file defines very fast int->upb_value (inttable) and string->upb_value |
| 1430 | * (strtable) hash tables. |
| 1431 | * |
| 1432 | * The table uses chained scatter with Brent's variation (inspired by the Lua |
| 1433 | * implementation of hash tables). The hash function for strings is Austin |
| 1434 | * Appleby's "MurmurHash." |
| 1435 | * |
| 1436 | * The inttable uses uintptr_t as its key, which guarantees it can be used to |
| 1437 | * store pointers or integers of at least 32 bits (upb isn't really useful on |
| 1438 | * systems where sizeof(void*) < 4). |
| 1439 | * |
| 1440 | * The table must be homogeneous (all values of the same type). In debug |
| 1441 | * mode, we check this on insert and lookup. |
| 1442 | */ |
| 1443 | |
| 1444 | #ifndef UPB_HASH_COMMON_H_ |
| 1445 | #define UPB_HASH_COMMON_H_ |
| 1446 | |
| 1447 | #include <string.h> |
| 1448 | |
| 1449 | |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 1450 | // Must be last. |
| 1451 | |
| 1452 | #ifdef __cplusplus |
| 1453 | extern "C" { |
| 1454 | #endif |
| 1455 | |
Protobuf Team Bot | 376ba2f | 2023-09-29 22:17:43 +0000 | [diff] [blame] | 1456 | /* upb_value ******************************************************************/ |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 1457 | |
| 1458 | typedef struct { |
Protobuf Team Bot | 376ba2f | 2023-09-29 22:17:43 +0000 | [diff] [blame] | 1459 | uint64_t val; |
| 1460 | } upb_value; |
| 1461 | |
| 1462 | UPB_INLINE void _upb_value_setval(upb_value* v, uint64_t val) { v->val = val; } |
| 1463 | |
| 1464 | /* For each value ctype, define the following set of functions: |
| 1465 | * |
| 1466 | * // Get/set an int32 from a upb_value. |
| 1467 | * int32_t upb_value_getint32(upb_value val); |
| 1468 | * void upb_value_setint32(upb_value *val, int32_t cval); |
| 1469 | * |
| 1470 | * // Construct a new upb_value from an int32. |
| 1471 | * upb_value upb_value_int32(int32_t val); */ |
| 1472 | #define FUNCS(name, membername, type_t, converter) \ |
| 1473 | UPB_INLINE void upb_value_set##name(upb_value* val, type_t cval) { \ |
| 1474 | val->val = (converter)cval; \ |
| 1475 | } \ |
| 1476 | UPB_INLINE upb_value upb_value_##name(type_t val) { \ |
| 1477 | upb_value ret; \ |
| 1478 | upb_value_set##name(&ret, val); \ |
| 1479 | return ret; \ |
| 1480 | } \ |
| 1481 | UPB_INLINE type_t upb_value_get##name(upb_value val) { \ |
| 1482 | return (type_t)(converter)val.val; \ |
| 1483 | } |
| 1484 | |
| 1485 | FUNCS(int32, int32, int32_t, int32_t) |
| 1486 | FUNCS(int64, int64, int64_t, int64_t) |
| 1487 | FUNCS(uint32, uint32, uint32_t, uint32_t) |
| 1488 | FUNCS(uint64, uint64, uint64_t, uint64_t) |
| 1489 | FUNCS(bool, _bool, bool, bool) |
| 1490 | FUNCS(cstr, cstr, char*, uintptr_t) |
| 1491 | FUNCS(uintptr, uptr, uintptr_t, uintptr_t) |
| 1492 | FUNCS(ptr, ptr, void*, uintptr_t) |
| 1493 | FUNCS(constptr, constptr, const void*, uintptr_t) |
| 1494 | |
| 1495 | #undef FUNCS |
| 1496 | |
| 1497 | UPB_INLINE void upb_value_setfloat(upb_value* val, float cval) { |
| 1498 | memcpy(&val->val, &cval, sizeof(cval)); |
| 1499 | } |
| 1500 | |
| 1501 | UPB_INLINE void upb_value_setdouble(upb_value* val, double cval) { |
| 1502 | memcpy(&val->val, &cval, sizeof(cval)); |
| 1503 | } |
| 1504 | |
| 1505 | UPB_INLINE upb_value upb_value_float(float cval) { |
| 1506 | upb_value ret; |
| 1507 | upb_value_setfloat(&ret, cval); |
| 1508 | return ret; |
| 1509 | } |
| 1510 | |
| 1511 | UPB_INLINE upb_value upb_value_double(double cval) { |
| 1512 | upb_value ret; |
| 1513 | upb_value_setdouble(&ret, cval); |
| 1514 | return ret; |
| 1515 | } |
| 1516 | |
| 1517 | /* upb_tabkey *****************************************************************/ |
| 1518 | |
| 1519 | /* Either: |
| 1520 | * 1. an actual integer key, or |
| 1521 | * 2. a pointer to a string prefixed by its uint32_t length, owned by us. |
| 1522 | * |
| 1523 | * ...depending on whether this is a string table or an int table. We would |
| 1524 | * make this a union of those two types, but C89 doesn't support statically |
| 1525 | * initializing a non-first union member. */ |
| 1526 | typedef uintptr_t upb_tabkey; |
| 1527 | |
| 1528 | UPB_INLINE char* upb_tabstr(upb_tabkey key, uint32_t* len) { |
| 1529 | char* mem = (char*)key; |
| 1530 | if (len) memcpy(len, mem, sizeof(*len)); |
| 1531 | return mem + sizeof(*len); |
| 1532 | } |
| 1533 | |
| 1534 | UPB_INLINE upb_StringView upb_tabstrview(upb_tabkey key) { |
| 1535 | upb_StringView ret; |
| 1536 | uint32_t len; |
| 1537 | ret.data = upb_tabstr(key, &len); |
| 1538 | ret.size = len; |
| 1539 | return ret; |
| 1540 | } |
| 1541 | |
| 1542 | /* upb_tabval *****************************************************************/ |
| 1543 | |
| 1544 | typedef struct upb_tabval { |
| 1545 | uint64_t val; |
| 1546 | } upb_tabval; |
| 1547 | |
| 1548 | #define UPB_TABVALUE_EMPTY_INIT \ |
| 1549 | { -1 } |
| 1550 | |
| 1551 | /* upb_table ******************************************************************/ |
| 1552 | |
| 1553 | typedef struct _upb_tabent { |
| 1554 | upb_tabkey key; |
| 1555 | upb_tabval val; |
| 1556 | |
| 1557 | /* Internal chaining. This is const so we can create static initializers for |
| 1558 | * tables. We cast away const sometimes, but *only* when the containing |
| 1559 | * upb_table is known to be non-const. This requires a bit of care, but |
| 1560 | * the subtlety is confined to table.c. */ |
| 1561 | const struct _upb_tabent* next; |
| 1562 | } upb_tabent; |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 1563 | |
| 1564 | typedef struct { |
Protobuf Team Bot | 376ba2f | 2023-09-29 22:17:43 +0000 | [diff] [blame] | 1565 | size_t count; /* Number of entries in the hash part. */ |
| 1566 | uint32_t mask; /* Mask to turn hash value -> bucket. */ |
| 1567 | uint32_t max_count; /* Max count before we hit our load limit. */ |
| 1568 | uint8_t size_lg2; /* Size of the hashtable part is 2^size_lg2 entries. */ |
| 1569 | upb_tabent* entries; |
| 1570 | } upb_table; |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 1571 | |
Protobuf Team Bot | 376ba2f | 2023-09-29 22:17:43 +0000 | [diff] [blame] | 1572 | UPB_INLINE size_t upb_table_size(const upb_table* t) { |
| 1573 | return t->size_lg2 ? 1 << t->size_lg2 : 0; |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 1574 | } |
| 1575 | |
Protobuf Team Bot | 376ba2f | 2023-09-29 22:17:43 +0000 | [diff] [blame] | 1576 | // Internal-only functions, in .h file only out of necessity. |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 1577 | |
Protobuf Team Bot | 376ba2f | 2023-09-29 22:17:43 +0000 | [diff] [blame] | 1578 | UPB_INLINE bool upb_tabent_isempty(const upb_tabent* e) { return e->key == 0; } |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 1579 | |
Protobuf Team Bot | 376ba2f | 2023-09-29 22:17:43 +0000 | [diff] [blame] | 1580 | uint32_t _upb_Hash(const void* p, size_t n, uint64_t seed); |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 1581 | |
| 1582 | #ifdef __cplusplus |
| 1583 | } /* extern "C" */ |
| 1584 | #endif |
| 1585 | |
| 1586 | |
Protobuf Team Bot | 376ba2f | 2023-09-29 22:17:43 +0000 | [diff] [blame] | 1587 | #endif /* UPB_HASH_COMMON_H_ */ |
Adam Cozzette | 8059da2 | 2023-08-16 07:57:14 -0700 | [diff] [blame] | 1588 | |
| 1589 | // Must be last. |
| 1590 | |
Protobuf Team Bot | 376ba2f | 2023-09-29 22:17:43 +0000 | [diff] [blame] | 1591 | typedef struct { |
| 1592 | upb_table t; |
| 1593 | } upb_strtable; |
| 1594 | |
Adam Cozzette | 8059da2 | 2023-08-16 07:57:14 -0700 | [diff] [blame] | 1595 | #ifdef __cplusplus |
| 1596 | extern "C" { |
| 1597 | #endif |
| 1598 | |
Protobuf Team Bot | 376ba2f | 2023-09-29 22:17:43 +0000 | [diff] [blame] | 1599 | // Initialize a table. If memory allocation failed, false is returned and |
| 1600 | // the table is uninitialized. |
| 1601 | bool upb_strtable_init(upb_strtable* table, size_t expected_size, upb_Arena* a); |
| 1602 | |
| 1603 | // Returns the number of values in the table. |
| 1604 | UPB_INLINE size_t upb_strtable_count(const upb_strtable* t) { |
| 1605 | return t->t.count; |
Adam Cozzette | 8059da2 | 2023-08-16 07:57:14 -0700 | [diff] [blame] | 1606 | } |
| 1607 | |
Protobuf Team Bot | 376ba2f | 2023-09-29 22:17:43 +0000 | [diff] [blame] | 1608 | void upb_strtable_clear(upb_strtable* t); |
| 1609 | |
| 1610 | // Inserts the given key into the hashtable with the given value. |
| 1611 | // The key must not already exist in the hash table. The key is not required |
| 1612 | // to be NULL-terminated, and the table will make an internal copy of the key. |
| 1613 | // |
| 1614 | // If a table resize was required but memory allocation failed, false is |
| 1615 | // returned and the table is unchanged. */ |
| 1616 | bool upb_strtable_insert(upb_strtable* t, const char* key, size_t len, |
| 1617 | upb_value val, upb_Arena* a); |
| 1618 | |
| 1619 | // Looks up key in this table, returning "true" if the key was found. |
| 1620 | // If v is non-NULL, copies the value for this key into *v. |
| 1621 | bool upb_strtable_lookup2(const upb_strtable* t, const char* key, size_t len, |
| 1622 | upb_value* v); |
| 1623 | |
| 1624 | // For NULL-terminated strings. |
| 1625 | UPB_INLINE bool upb_strtable_lookup(const upb_strtable* t, const char* key, |
| 1626 | upb_value* v) { |
| 1627 | return upb_strtable_lookup2(t, key, strlen(key), v); |
| 1628 | } |
| 1629 | |
| 1630 | // Removes an item from the table. Returns true if the remove was successful, |
| 1631 | // and stores the removed item in *val if non-NULL. |
| 1632 | bool upb_strtable_remove2(upb_strtable* t, const char* key, size_t len, |
| 1633 | upb_value* val); |
| 1634 | |
| 1635 | UPB_INLINE bool upb_strtable_remove(upb_strtable* t, const char* key, |
| 1636 | upb_value* v) { |
| 1637 | return upb_strtable_remove2(t, key, strlen(key), v); |
| 1638 | } |
| 1639 | |
| 1640 | // Exposed for testing only. |
| 1641 | bool upb_strtable_resize(upb_strtable* t, size_t size_lg2, upb_Arena* a); |
| 1642 | |
| 1643 | /* Iteration over strtable: |
| 1644 | * |
| 1645 | * intptr_t iter = UPB_STRTABLE_BEGIN; |
| 1646 | * upb_StringView key; |
| 1647 | * upb_value val; |
| 1648 | * while (upb_strtable_next2(t, &key, &val, &iter)) { |
| 1649 | * // ... |
| 1650 | * } |
| 1651 | */ |
| 1652 | |
| 1653 | #define UPB_STRTABLE_BEGIN -1 |
| 1654 | |
| 1655 | bool upb_strtable_next2(const upb_strtable* t, upb_StringView* key, |
| 1656 | upb_value* val, intptr_t* iter); |
| 1657 | void upb_strtable_removeiter(upb_strtable* t, intptr_t* iter); |
| 1658 | void upb_strtable_setentryvalue(upb_strtable* t, intptr_t iter, upb_value v); |
| 1659 | |
| 1660 | /* DEPRECATED iterators, slated for removal. |
| 1661 | * |
| 1662 | * Iterators for string tables. We are subject to some kind of unusual |
| 1663 | * design constraints: |
| 1664 | * |
| 1665 | * For high-level languages: |
| 1666 | * - we must be able to guarantee that we don't crash or corrupt memory even if |
| 1667 | * the program accesses an invalidated iterator. |
| 1668 | * |
| 1669 | * For C++11 range-based for: |
| 1670 | * - iterators must be copyable |
| 1671 | * - iterators must be comparable |
| 1672 | * - it must be possible to construct an "end" value. |
| 1673 | * |
| 1674 | * Iteration order is undefined. |
| 1675 | * |
| 1676 | * Modifying the table invalidates iterators. upb_{str,int}table_done() is |
| 1677 | * guaranteed to work even on an invalidated iterator, as long as the table it |
| 1678 | * is iterating over has not been freed. Calling next() or accessing data from |
| 1679 | * an invalidated iterator yields unspecified elements from the table, but it is |
| 1680 | * guaranteed not to crash and to return real table elements (except when done() |
| 1681 | * is true). */ |
| 1682 | /* upb_strtable_iter **********************************************************/ |
| 1683 | |
| 1684 | /* upb_strtable_iter i; |
| 1685 | * upb_strtable_begin(&i, t); |
| 1686 | * for(; !upb_strtable_done(&i); upb_strtable_next(&i)) { |
| 1687 | * const char *key = upb_strtable_iter_key(&i); |
| 1688 | * const upb_value val = upb_strtable_iter_value(&i); |
| 1689 | * // ... |
| 1690 | * } |
| 1691 | */ |
| 1692 | |
| 1693 | typedef struct { |
| 1694 | const upb_strtable* t; |
| 1695 | size_t index; |
| 1696 | } upb_strtable_iter; |
| 1697 | |
| 1698 | UPB_INLINE const upb_tabent* str_tabent(const upb_strtable_iter* i) { |
| 1699 | return &i->t->t.entries[i->index]; |
| 1700 | } |
| 1701 | |
| 1702 | void upb_strtable_begin(upb_strtable_iter* i, const upb_strtable* t); |
| 1703 | void upb_strtable_next(upb_strtable_iter* i); |
| 1704 | bool upb_strtable_done(const upb_strtable_iter* i); |
| 1705 | upb_StringView upb_strtable_iter_key(const upb_strtable_iter* i); |
| 1706 | upb_value upb_strtable_iter_value(const upb_strtable_iter* i); |
| 1707 | void upb_strtable_iter_setdone(upb_strtable_iter* i); |
| 1708 | bool upb_strtable_iter_isequal(const upb_strtable_iter* i1, |
| 1709 | const upb_strtable_iter* i2); |
Adam Cozzette | 8059da2 | 2023-08-16 07:57:14 -0700 | [diff] [blame] | 1710 | |
| 1711 | #ifdef __cplusplus |
| 1712 | } /* extern "C" */ |
| 1713 | #endif |
| 1714 | |
| 1715 | |
Protobuf Team Bot | 376ba2f | 2023-09-29 22:17:43 +0000 | [diff] [blame] | 1716 | #endif /* UPB_HASH_STR_TABLE_H_ */ |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 1717 | |
Protobuf Team Bot | 376ba2f | 2023-09-29 22:17:43 +0000 | [diff] [blame] | 1718 | #ifndef UPB_MESSAGE_MAP_H_ |
| 1719 | #define UPB_MESSAGE_MAP_H_ |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 1720 | |
Protobuf Team Bot | 376ba2f | 2023-09-29 22:17:43 +0000 | [diff] [blame] | 1721 | #include <stddef.h> |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 1722 | |
| 1723 | |
| 1724 | // Must be last. |
| 1725 | |
Protobuf Team Bot | 376ba2f | 2023-09-29 22:17:43 +0000 | [diff] [blame] | 1726 | typedef struct upb_Map upb_Map; |
| 1727 | |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 1728 | #ifdef __cplusplus |
| 1729 | extern "C" { |
| 1730 | #endif |
| 1731 | |
Protobuf Team Bot | 376ba2f | 2023-09-29 22:17:43 +0000 | [diff] [blame] | 1732 | // Creates a new map on the given arena with the given key/value size. |
| 1733 | UPB_API upb_Map* upb_Map_New(upb_Arena* a, upb_CType key_type, |
| 1734 | upb_CType value_type); |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 1735 | |
Protobuf Team Bot | 376ba2f | 2023-09-29 22:17:43 +0000 | [diff] [blame] | 1736 | // Returns the number of entries in the map. |
| 1737 | UPB_API size_t upb_Map_Size(const upb_Map* map); |
| 1738 | |
| 1739 | // Stores a value for the given key into |*val| (or the zero value if the key is |
| 1740 | // not present). Returns whether the key was present. The |val| pointer may be |
| 1741 | // NULL, in which case the function tests whether the given key is present. |
| 1742 | UPB_API bool upb_Map_Get(const upb_Map* map, upb_MessageValue key, |
| 1743 | upb_MessageValue* val); |
| 1744 | |
| 1745 | // Removes all entries in the map. |
| 1746 | UPB_API void upb_Map_Clear(upb_Map* map); |
| 1747 | |
| 1748 | typedef enum { |
| 1749 | kUpb_MapInsertStatus_Inserted = 0, |
| 1750 | kUpb_MapInsertStatus_Replaced = 1, |
| 1751 | kUpb_MapInsertStatus_OutOfMemory = 2, |
| 1752 | } upb_MapInsertStatus; |
| 1753 | |
| 1754 | // Sets the given key to the given value, returning whether the key was inserted |
| 1755 | // or replaced. If the key was inserted, then any existing iterators will be |
| 1756 | // invalidated. |
| 1757 | UPB_API upb_MapInsertStatus upb_Map_Insert(upb_Map* map, upb_MessageValue key, |
| 1758 | upb_MessageValue val, |
| 1759 | upb_Arena* arena); |
| 1760 | |
| 1761 | // Sets the given key to the given value. Returns false if memory allocation |
| 1762 | // failed. If the key is newly inserted, then any existing iterators will be |
| 1763 | // invalidated. |
| 1764 | UPB_API_INLINE bool upb_Map_Set(upb_Map* map, upb_MessageValue key, |
| 1765 | upb_MessageValue val, upb_Arena* arena) { |
| 1766 | return upb_Map_Insert(map, key, val, arena) != |
| 1767 | kUpb_MapInsertStatus_OutOfMemory; |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 1768 | } |
| 1769 | |
Protobuf Team Bot | 376ba2f | 2023-09-29 22:17:43 +0000 | [diff] [blame] | 1770 | // Deletes this key from the table. Returns true if the key was present. |
| 1771 | // If present and |val| is non-NULL, stores the deleted value. |
| 1772 | UPB_API bool upb_Map_Delete(upb_Map* map, upb_MessageValue key, |
| 1773 | upb_MessageValue* val); |
| 1774 | |
| 1775 | // (DEPRECATED and going away soon. Do not use.) |
| 1776 | UPB_INLINE bool upb_Map_Delete2(upb_Map* map, upb_MessageValue key, |
| 1777 | upb_MessageValue* val) { |
| 1778 | return upb_Map_Delete(map, key, val); |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 1779 | } |
| 1780 | |
Protobuf Team Bot | 376ba2f | 2023-09-29 22:17:43 +0000 | [diff] [blame] | 1781 | // Map iteration: |
| 1782 | // |
| 1783 | // size_t iter = kUpb_Map_Begin; |
| 1784 | // upb_MessageValue key, val; |
| 1785 | // while (upb_Map_Next(map, &key, &val, &iter)) { |
| 1786 | // ... |
| 1787 | // } |
| 1788 | |
| 1789 | #define kUpb_Map_Begin ((size_t)-1) |
| 1790 | |
| 1791 | // Advances to the next entry. Returns false if no more entries are present. |
| 1792 | // Otherwise returns true and populates both *key and *value. |
| 1793 | UPB_API bool upb_Map_Next(const upb_Map* map, upb_MessageValue* key, |
| 1794 | upb_MessageValue* val, size_t* iter); |
| 1795 | |
| 1796 | // Sets the value for the entry pointed to by iter. |
| 1797 | // WARNING: this does not currently work for string values! |
| 1798 | UPB_API void upb_Map_SetEntryValue(upb_Map* map, size_t iter, |
| 1799 | upb_MessageValue val); |
| 1800 | |
| 1801 | // DEPRECATED iterator, slated for removal. |
| 1802 | |
| 1803 | /* Map iteration: |
| 1804 | * |
| 1805 | * size_t iter = kUpb_Map_Begin; |
| 1806 | * while (upb_MapIterator_Next(map, &iter)) { |
| 1807 | * upb_MessageValue key = upb_MapIterator_Key(map, iter); |
| 1808 | * upb_MessageValue val = upb_MapIterator_Value(map, iter); |
| 1809 | * } |
| 1810 | */ |
| 1811 | |
| 1812 | // Advances to the next entry. Returns false if no more entries are present. |
| 1813 | UPB_API bool upb_MapIterator_Next(const upb_Map* map, size_t* iter); |
| 1814 | |
| 1815 | // Returns true if the iterator still points to a valid entry, or false if the |
| 1816 | // iterator is past the last element. It is an error to call this function with |
| 1817 | // kUpb_Map_Begin (you must call next() at least once first). |
| 1818 | UPB_API bool upb_MapIterator_Done(const upb_Map* map, size_t iter); |
| 1819 | |
| 1820 | // Returns the key and value for this entry of the map. |
| 1821 | UPB_API upb_MessageValue upb_MapIterator_Key(const upb_Map* map, size_t iter); |
| 1822 | UPB_API upb_MessageValue upb_MapIterator_Value(const upb_Map* map, size_t iter); |
| 1823 | |
| 1824 | #ifdef __cplusplus |
| 1825 | } /* extern "C" */ |
| 1826 | #endif |
| 1827 | |
| 1828 | |
| 1829 | #endif /* UPB_MESSAGE_MAP_H_ */ |
| 1830 | |
| 1831 | // Must be last. |
| 1832 | |
| 1833 | struct upb_Map { |
| 1834 | // Size of key and val, based on the map type. |
| 1835 | // Strings are represented as '0' because they must be handled specially. |
| 1836 | char key_size; |
| 1837 | char val_size; |
| 1838 | |
| 1839 | upb_strtable table; |
| 1840 | }; |
| 1841 | |
| 1842 | #ifdef __cplusplus |
| 1843 | extern "C" { |
| 1844 | #endif |
| 1845 | |
| 1846 | // Converting between internal table representation and user values. |
| 1847 | // |
| 1848 | // _upb_map_tokey() and _upb_map_fromkey() are inverses. |
| 1849 | // _upb_map_tovalue() and _upb_map_fromvalue() are inverses. |
| 1850 | // |
| 1851 | // These functions account for the fact that strings are treated differently |
| 1852 | // from other types when stored in a map. |
| 1853 | |
| 1854 | UPB_INLINE upb_StringView _upb_map_tokey(const void* key, size_t size) { |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 1855 | if (size == UPB_MAPTYPE_STRING) { |
Protobuf Team Bot | 376ba2f | 2023-09-29 22:17:43 +0000 | [diff] [blame] | 1856 | return *(upb_StringView*)key; |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 1857 | } else { |
Protobuf Team Bot | 376ba2f | 2023-09-29 22:17:43 +0000 | [diff] [blame] | 1858 | return upb_StringView_FromDataAndSize((const char*)key, size); |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 1859 | } |
| 1860 | } |
| 1861 | |
Protobuf Team Bot | 376ba2f | 2023-09-29 22:17:43 +0000 | [diff] [blame] | 1862 | UPB_INLINE void _upb_map_fromkey(upb_StringView key, void* out, size_t size) { |
| 1863 | if (size == UPB_MAPTYPE_STRING) { |
| 1864 | memcpy(out, &key, sizeof(key)); |
| 1865 | } else { |
| 1866 | memcpy(out, key.data, size); |
| 1867 | } |
| 1868 | } |
| 1869 | |
| 1870 | UPB_INLINE bool _upb_map_tovalue(const void* val, size_t size, |
| 1871 | upb_value* msgval, upb_Arena* a) { |
| 1872 | if (size == UPB_MAPTYPE_STRING) { |
| 1873 | upb_StringView* strp = (upb_StringView*)upb_Arena_Malloc(a, sizeof(*strp)); |
| 1874 | if (!strp) return false; |
| 1875 | *strp = *(upb_StringView*)val; |
| 1876 | *msgval = upb_value_ptr(strp); |
| 1877 | } else { |
| 1878 | memcpy(msgval, val, size); |
| 1879 | } |
| 1880 | return true; |
| 1881 | } |
| 1882 | |
| 1883 | UPB_INLINE void _upb_map_fromvalue(upb_value val, void* out, size_t size) { |
| 1884 | if (size == UPB_MAPTYPE_STRING) { |
| 1885 | const upb_StringView* strp = (const upb_StringView*)upb_value_getptr(val); |
| 1886 | memcpy(out, strp, sizeof(upb_StringView)); |
| 1887 | } else { |
| 1888 | memcpy(out, &val, size); |
| 1889 | } |
| 1890 | } |
| 1891 | |
| 1892 | UPB_INLINE void* _upb_map_next(const upb_Map* map, size_t* iter) { |
| 1893 | upb_strtable_iter it; |
| 1894 | it.t = &map->table; |
| 1895 | it.index = *iter; |
| 1896 | upb_strtable_next(&it); |
| 1897 | *iter = it.index; |
| 1898 | if (upb_strtable_done(&it)) return NULL; |
| 1899 | return (void*)str_tabent(&it); |
| 1900 | } |
| 1901 | |
| 1902 | UPB_INLINE void _upb_Map_Clear(upb_Map* map) { |
| 1903 | upb_strtable_clear(&map->table); |
| 1904 | } |
| 1905 | |
| 1906 | UPB_INLINE bool _upb_Map_Delete(upb_Map* map, const void* key, size_t key_size, |
| 1907 | upb_value* val) { |
| 1908 | upb_StringView k = _upb_map_tokey(key, key_size); |
| 1909 | return upb_strtable_remove2(&map->table, k.data, k.size, val); |
| 1910 | } |
| 1911 | |
| 1912 | UPB_INLINE bool _upb_Map_Get(const upb_Map* map, const void* key, |
| 1913 | size_t key_size, void* val, size_t val_size) { |
| 1914 | upb_value tabval; |
| 1915 | upb_StringView k = _upb_map_tokey(key, key_size); |
| 1916 | bool ret = upb_strtable_lookup2(&map->table, k.data, k.size, &tabval); |
| 1917 | if (ret && val) { |
| 1918 | _upb_map_fromvalue(tabval, val, val_size); |
| 1919 | } |
| 1920 | return ret; |
| 1921 | } |
| 1922 | |
| 1923 | UPB_INLINE upb_MapInsertStatus _upb_Map_Insert(upb_Map* map, const void* key, |
| 1924 | size_t key_size, void* val, |
| 1925 | size_t val_size, upb_Arena* a) { |
| 1926 | upb_StringView strkey = _upb_map_tokey(key, key_size); |
| 1927 | upb_value tabval = {0}; |
| 1928 | if (!_upb_map_tovalue(val, val_size, &tabval, a)) { |
| 1929 | return kUpb_MapInsertStatus_OutOfMemory; |
| 1930 | } |
| 1931 | |
| 1932 | // TODO: add overwrite operation to minimize number of lookups. |
| 1933 | bool removed = |
| 1934 | upb_strtable_remove2(&map->table, strkey.data, strkey.size, NULL); |
| 1935 | if (!upb_strtable_insert(&map->table, strkey.data, strkey.size, tabval, a)) { |
| 1936 | return kUpb_MapInsertStatus_OutOfMemory; |
| 1937 | } |
| 1938 | return removed ? kUpb_MapInsertStatus_Replaced |
| 1939 | : kUpb_MapInsertStatus_Inserted; |
| 1940 | } |
| 1941 | |
| 1942 | UPB_INLINE size_t _upb_Map_Size(const upb_Map* map) { |
| 1943 | return map->table.t.count; |
| 1944 | } |
| 1945 | |
| 1946 | // Strings/bytes are special-cased in maps. |
| 1947 | extern char _upb_Map_CTypeSizeTable[12]; |
| 1948 | |
| 1949 | UPB_INLINE size_t _upb_Map_CTypeSize(upb_CType ctype) { |
| 1950 | return _upb_Map_CTypeSizeTable[ctype]; |
| 1951 | } |
| 1952 | |
| 1953 | // Creates a new map on the given arena with this key/value type. |
| 1954 | upb_Map* _upb_Map_New(upb_Arena* a, size_t key_size, size_t value_size); |
| 1955 | |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 1956 | #ifdef __cplusplus |
| 1957 | } /* extern "C" */ |
| 1958 | #endif |
| 1959 | |
| 1960 | |
Protobuf Team Bot | 376ba2f | 2023-09-29 22:17:43 +0000 | [diff] [blame] | 1961 | #endif /* UPB_COLLECTIONS_INTERNAL_MAP_H_ */ |
Adam Cozzette | 8059da2 | 2023-08-16 07:57:14 -0700 | [diff] [blame] | 1962 | |
Sandy Zhang | e3b0943 | 2023-08-07 09:30:02 -0700 | [diff] [blame] | 1963 | /* |
| 1964 | ** Our memory representation for parsing tables and messages themselves. |
| 1965 | ** Functions in this file are used by generated code and possibly reflection. |
| 1966 | ** |
| 1967 | ** The definitions in this file are internal to upb. |
| 1968 | **/ |
| 1969 | |
| 1970 | #ifndef UPB_MESSAGE_INTERNAL_H_ |
| 1971 | #define UPB_MESSAGE_INTERNAL_H_ |
| 1972 | |
| 1973 | #include <stdlib.h> |
| 1974 | #include <string.h> |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 1975 | |
| 1976 | |
Protobuf Team Bot | 376ba2f | 2023-09-29 22:17:43 +0000 | [diff] [blame] | 1977 | #ifndef UPB_MINI_TABLE_INTERNAL_TYPES_H_ |
| 1978 | #define UPB_MINI_TABLE_INTERNAL_TYPES_H_ |
| 1979 | |
| 1980 | typedef struct upb_Message_InternalData upb_Message_InternalData; |
| 1981 | |
| 1982 | typedef struct { |
| 1983 | union { |
| 1984 | upb_Message_InternalData* internal; |
| 1985 | |
| 1986 | // Force 8-byte alignment, since the data members may contain members that |
| 1987 | // require 8-byte alignment. |
| 1988 | double d; |
| 1989 | }; |
| 1990 | } upb_Message_Internal; |
| 1991 | |
| 1992 | #endif // UPB_MINI_TABLE_INTERNAL_TYPES_H_ |
| 1993 | |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 1994 | #ifndef UPB_MINI_TABLE_EXTENSION_REGISTRY_H_ |
| 1995 | #define UPB_MINI_TABLE_EXTENSION_REGISTRY_H_ |
| 1996 | |
| 1997 | |
| 1998 | // Must be last. |
| 1999 | |
| 2000 | #ifdef __cplusplus |
| 2001 | extern "C" { |
| 2002 | #endif |
| 2003 | |
| 2004 | /* Extension registry: a dynamic data structure that stores a map of: |
| 2005 | * (upb_MiniTable, number) -> extension info |
| 2006 | * |
| 2007 | * upb_decode() uses upb_ExtensionRegistry to look up extensions while parsing |
| 2008 | * binary format. |
| 2009 | * |
| 2010 | * upb_ExtensionRegistry is part of the mini-table (msglayout) family of |
| 2011 | * objects. Like all mini-table objects, it is suitable for reflection-less |
| 2012 | * builds that do not want to expose names into the binary. |
| 2013 | * |
| 2014 | * Unlike most mini-table types, upb_ExtensionRegistry requires dynamic memory |
| 2015 | * allocation and dynamic initialization: |
| 2016 | * * If reflection is being used, then upb_DefPool will construct an appropriate |
| 2017 | * upb_ExtensionRegistry automatically. |
| 2018 | * * For a mini-table only build, the user must manually construct the |
| 2019 | * upb_ExtensionRegistry and populate it with all of the extensions the user |
| 2020 | * cares about. |
| 2021 | * * A third alternative is to manually unpack relevant extensions after the |
| 2022 | * main parse is complete, similar to how Any works. This is perhaps the |
| 2023 | * nicest solution from the perspective of reducing dependencies, avoiding |
| 2024 | * dynamic memory allocation, and avoiding the need to parse uninteresting |
| 2025 | * extensions. The downsides are: |
| 2026 | * (1) parse errors are not caught during the main parse |
| 2027 | * (2) the CPU hit of parsing comes during access, which could cause an |
| 2028 | * undesirable stutter in application performance. |
| 2029 | * |
| 2030 | * Users cannot directly get or put into this map. Users can only add the |
| 2031 | * extensions from a generated module and pass the extension registry to the |
| 2032 | * binary decoder. |
| 2033 | * |
| 2034 | * A upb_DefPool provides a upb_ExtensionRegistry, so any users who use |
| 2035 | * reflection do not need to populate a upb_ExtensionRegistry directly. |
| 2036 | */ |
| 2037 | |
| 2038 | typedef struct upb_ExtensionRegistry upb_ExtensionRegistry; |
| 2039 | |
| 2040 | // Creates a upb_ExtensionRegistry in the given arena. |
| 2041 | // The arena must outlive any use of the extreg. |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2042 | UPB_API upb_ExtensionRegistry* upb_ExtensionRegistry_New(upb_Arena* arena); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 2043 | |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 2044 | UPB_API bool upb_ExtensionRegistry_Add(upb_ExtensionRegistry* r, |
| 2045 | const upb_MiniTableExtension* e); |
| 2046 | |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 2047 | // Adds the given extension info for the array |e| of size |count| into the |
| 2048 | // registry. If there are any errors, the entire array is backed out. |
| 2049 | // The extensions must outlive the registry. |
| 2050 | // Possible errors include OOM or an extension number that already exists. |
Protobuf Team Bot | 986cbb6 | 2023-09-19 15:03:51 +0000 | [diff] [blame] | 2051 | // TODO: There is currently no way to know the exact reason for failure. |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 2052 | bool upb_ExtensionRegistry_AddArray(upb_ExtensionRegistry* r, |
| 2053 | const upb_MiniTableExtension** e, |
| 2054 | size_t count); |
| 2055 | |
| 2056 | // Looks up the extension (if any) defined for message type |t| and field |
| 2057 | // number |num|. Returns the extension if found, otherwise NULL. |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 2058 | UPB_API const upb_MiniTableExtension* upb_ExtensionRegistry_Lookup( |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 2059 | const upb_ExtensionRegistry* r, const upb_MiniTable* t, uint32_t num); |
| 2060 | |
| 2061 | #ifdef __cplusplus |
| 2062 | } /* extern "C" */ |
| 2063 | #endif |
| 2064 | |
| 2065 | |
| 2066 | #endif /* UPB_MINI_TABLE_EXTENSION_REGISTRY_H_ */ |
| 2067 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2068 | // Must be last. |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 2069 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2070 | #ifdef __cplusplus |
| 2071 | extern "C" { |
| 2072 | #endif |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 2073 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2074 | extern const float kUpb_FltInfinity; |
| 2075 | extern const double kUpb_Infinity; |
| 2076 | extern const double kUpb_NaN; |
| 2077 | |
| 2078 | /* Internal members of a upb_Message that track unknown fields and/or |
| 2079 | * extensions. We can change this without breaking binary compatibility. We put |
| 2080 | * these before the user's data. The user's upb_Message* points after the |
| 2081 | * upb_Message_Internal. */ |
| 2082 | |
Protobuf Team Bot | dcc1f61 | 2023-09-05 21:56:25 +0000 | [diff] [blame] | 2083 | struct upb_Message_InternalData { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2084 | /* Total size of this structure, including the data that follows. |
| 2085 | * Must be aligned to 8, which is alignof(upb_Message_Extension) */ |
| 2086 | uint32_t size; |
| 2087 | |
| 2088 | /* Offsets relative to the beginning of this structure. |
| 2089 | * |
| 2090 | * Unknown data grows forward from the beginning to unknown_end. |
| 2091 | * Extension data grows backward from size to ext_begin. |
| 2092 | * When the two meet, we're out of data and have to realloc. |
| 2093 | * |
| 2094 | * If we imagine that the final member of this struct is: |
| 2095 | * char data[size - overhead]; // overhead = |
| 2096 | * sizeof(upb_Message_InternalData) |
| 2097 | * |
| 2098 | * Then we have: |
| 2099 | * unknown data: data[0 .. (unknown_end - overhead)] |
| 2100 | * extensions data: data[(ext_begin - overhead) .. (size - overhead)] */ |
| 2101 | uint32_t unknown_end; |
| 2102 | uint32_t ext_begin; |
| 2103 | /* Data follows, as if there were an array: |
| 2104 | * char data[size - sizeof(upb_Message_InternalData)]; */ |
Protobuf Team Bot | dcc1f61 | 2023-09-05 21:56:25 +0000 | [diff] [blame] | 2105 | }; |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2106 | |
| 2107 | /* Maps upb_CType -> memory size. */ |
| 2108 | extern char _upb_CTypeo_size[12]; |
| 2109 | |
| 2110 | UPB_INLINE size_t upb_msg_sizeof(const upb_MiniTable* t) { |
| 2111 | return t->size + sizeof(upb_Message_Internal); |
| 2112 | } |
| 2113 | |
| 2114 | // Inline version upb_Message_New(), for internal use. |
| 2115 | UPB_INLINE upb_Message* _upb_Message_New(const upb_MiniTable* mini_table, |
| 2116 | upb_Arena* arena) { |
| 2117 | size_t size = upb_msg_sizeof(mini_table); |
| 2118 | void* mem = upb_Arena_Malloc(arena, size + sizeof(upb_Message_Internal)); |
| 2119 | if (UPB_UNLIKELY(!mem)) return NULL; |
| 2120 | upb_Message* msg = UPB_PTR_AT(mem, sizeof(upb_Message_Internal), upb_Message); |
| 2121 | memset(mem, 0, size); |
| 2122 | return msg; |
| 2123 | } |
| 2124 | |
| 2125 | UPB_INLINE upb_Message_Internal* upb_Message_Getinternal( |
| 2126 | const upb_Message* msg) { |
| 2127 | ptrdiff_t size = sizeof(upb_Message_Internal); |
| 2128 | return (upb_Message_Internal*)((char*)msg - size); |
| 2129 | } |
| 2130 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2131 | // Discards the unknown fields for this message only. |
| 2132 | void _upb_Message_DiscardUnknown_shallow(upb_Message* msg); |
| 2133 | |
| 2134 | // Adds unknown data (serialized protobuf data) to the given message. |
| 2135 | // The data is copied into the message instance. |
| 2136 | bool _upb_Message_AddUnknown(upb_Message* msg, const char* data, size_t len, |
| 2137 | upb_Arena* arena); |
| 2138 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2139 | #ifdef __cplusplus |
| 2140 | } /* extern "C" */ |
| 2141 | #endif |
| 2142 | |
| 2143 | |
| 2144 | #endif /* UPB_MESSAGE_INTERNAL_H_ */ |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 2145 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2146 | // Must be last. |
| 2147 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 2148 | #if defined(__GNUC__) && !defined(__clang__) |
| 2149 | // GCC raises incorrect warnings in these functions. It thinks that we are |
| 2150 | // overrunning buffers, but we carefully write the functions in this file to |
| 2151 | // guarantee that this is impossible. GCC gets this wrong due it its failure |
| 2152 | // to perform constant propagation as we expect: |
| 2153 | // - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108217 |
| 2154 | // - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108226 |
| 2155 | // |
| 2156 | // Unfortunately this also indicates that GCC is not optimizing away the |
| 2157 | // switch() in cases where it should be, compromising the performance. |
| 2158 | #pragma GCC diagnostic push |
| 2159 | #pragma GCC diagnostic ignored "-Warray-bounds" |
| 2160 | #pragma GCC diagnostic ignored "-Wstringop-overflow" |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 2161 | #if __GNUC__ >= 11 |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 2162 | #pragma GCC diagnostic ignored "-Wstringop-overread" |
| 2163 | #endif |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 2164 | #endif |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 2165 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2166 | #ifdef __cplusplus |
| 2167 | extern "C" { |
| 2168 | #endif |
| 2169 | |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 2170 | // LINT.IfChange(presence_logic) |
| 2171 | |
| 2172 | // Hasbit access /////////////////////////////////////////////////////////////// |
| 2173 | |
| 2174 | UPB_INLINE size_t _upb_hasbit_ofs(size_t idx) { return idx / 8; } |
| 2175 | |
| 2176 | UPB_INLINE char _upb_hasbit_mask(size_t idx) { return 1 << (idx % 8); } |
| 2177 | |
| 2178 | UPB_INLINE bool _upb_hasbit(const upb_Message* msg, size_t idx) { |
| 2179 | return (*UPB_PTR_AT(msg, _upb_hasbit_ofs(idx), const char) & |
| 2180 | _upb_hasbit_mask(idx)) != 0; |
| 2181 | } |
| 2182 | |
| 2183 | UPB_INLINE void _upb_sethas(const upb_Message* msg, size_t idx) { |
| 2184 | (*UPB_PTR_AT(msg, _upb_hasbit_ofs(idx), char)) |= _upb_hasbit_mask(idx); |
| 2185 | } |
| 2186 | |
| 2187 | UPB_INLINE void _upb_clearhas(const upb_Message* msg, size_t idx) { |
| 2188 | (*UPB_PTR_AT(msg, _upb_hasbit_ofs(idx), char)) &= ~_upb_hasbit_mask(idx); |
| 2189 | } |
| 2190 | |
| 2191 | UPB_INLINE size_t _upb_Message_Hasidx(const upb_MiniTableField* f) { |
| 2192 | UPB_ASSERT(f->presence > 0); |
| 2193 | return f->presence; |
| 2194 | } |
| 2195 | |
| 2196 | UPB_INLINE bool _upb_hasbit_field(const upb_Message* msg, |
| 2197 | const upb_MiniTableField* f) { |
| 2198 | return _upb_hasbit(msg, _upb_Message_Hasidx(f)); |
| 2199 | } |
| 2200 | |
| 2201 | UPB_INLINE void _upb_sethas_field(const upb_Message* msg, |
| 2202 | const upb_MiniTableField* f) { |
| 2203 | _upb_sethas(msg, _upb_Message_Hasidx(f)); |
| 2204 | } |
| 2205 | |
| 2206 | // Oneof case access /////////////////////////////////////////////////////////// |
| 2207 | |
| 2208 | UPB_INLINE size_t _upb_oneofcase_ofs(const upb_MiniTableField* f) { |
| 2209 | UPB_ASSERT(f->presence < 0); |
| 2210 | return ~(ptrdiff_t)f->presence; |
| 2211 | } |
| 2212 | |
| 2213 | UPB_INLINE uint32_t* _upb_oneofcase_field(upb_Message* msg, |
| 2214 | const upb_MiniTableField* f) { |
| 2215 | return UPB_PTR_AT(msg, _upb_oneofcase_ofs(f), uint32_t); |
| 2216 | } |
| 2217 | |
| 2218 | UPB_INLINE uint32_t _upb_getoneofcase_field(const upb_Message* msg, |
| 2219 | const upb_MiniTableField* f) { |
| 2220 | return *_upb_oneofcase_field((upb_Message*)msg, f); |
| 2221 | } |
| 2222 | |
| 2223 | // LINT.ThenChange(GoogleInternalName2) |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 2224 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2225 | UPB_INLINE bool _upb_MiniTableField_InOneOf(const upb_MiniTableField* field) { |
| 2226 | return field->presence < 0; |
| 2227 | } |
| 2228 | |
| 2229 | UPB_INLINE void* _upb_MiniTableField_GetPtr(upb_Message* msg, |
| 2230 | const upb_MiniTableField* field) { |
| 2231 | return (char*)msg + field->offset; |
| 2232 | } |
| 2233 | |
| 2234 | UPB_INLINE const void* _upb_MiniTableField_GetConstPtr( |
| 2235 | const upb_Message* msg, const upb_MiniTableField* field) { |
| 2236 | return (char*)msg + field->offset; |
| 2237 | } |
| 2238 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2239 | UPB_INLINE void _upb_Message_SetPresence(upb_Message* msg, |
| 2240 | const upb_MiniTableField* field) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2241 | if (field->presence > 0) { |
| 2242 | _upb_sethas_field(msg, field); |
| 2243 | } else if (_upb_MiniTableField_InOneOf(field)) { |
| 2244 | *_upb_oneofcase_field(msg, field) = field->number; |
| 2245 | } |
| 2246 | } |
| 2247 | |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 2248 | UPB_INLINE bool _upb_MiniTable_ValueIsNonZero(const void* default_val, |
| 2249 | const upb_MiniTableField* field) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2250 | char zero[16] = {0}; |
| 2251 | switch (_upb_MiniTableField_GetRep(field)) { |
| 2252 | case kUpb_FieldRep_1Byte: |
| 2253 | return memcmp(&zero, default_val, 1) != 0; |
| 2254 | case kUpb_FieldRep_4Byte: |
| 2255 | return memcmp(&zero, default_val, 4) != 0; |
| 2256 | case kUpb_FieldRep_8Byte: |
| 2257 | return memcmp(&zero, default_val, 8) != 0; |
| 2258 | case kUpb_FieldRep_StringView: { |
| 2259 | const upb_StringView* sv = (const upb_StringView*)default_val; |
| 2260 | return sv->size != 0; |
| 2261 | } |
| 2262 | } |
| 2263 | UPB_UNREACHABLE(); |
| 2264 | } |
| 2265 | |
| 2266 | UPB_INLINE void _upb_MiniTable_CopyFieldData(void* to, const void* from, |
| 2267 | const upb_MiniTableField* field) { |
| 2268 | switch (_upb_MiniTableField_GetRep(field)) { |
| 2269 | case kUpb_FieldRep_1Byte: |
| 2270 | memcpy(to, from, 1); |
| 2271 | return; |
| 2272 | case kUpb_FieldRep_4Byte: |
| 2273 | memcpy(to, from, 4); |
| 2274 | return; |
| 2275 | case kUpb_FieldRep_8Byte: |
| 2276 | memcpy(to, from, 8); |
| 2277 | return; |
| 2278 | case kUpb_FieldRep_StringView: { |
| 2279 | memcpy(to, from, sizeof(upb_StringView)); |
| 2280 | return; |
| 2281 | } |
| 2282 | } |
| 2283 | UPB_UNREACHABLE(); |
| 2284 | } |
| 2285 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 2286 | UPB_INLINE size_t |
| 2287 | _upb_MiniTable_ElementSizeLg2(const upb_MiniTableField* field) { |
| 2288 | const unsigned char table[] = { |
| 2289 | 0, |
| 2290 | 3, // kUpb_FieldType_Double = 1, |
| 2291 | 2, // kUpb_FieldType_Float = 2, |
| 2292 | 3, // kUpb_FieldType_Int64 = 3, |
| 2293 | 3, // kUpb_FieldType_UInt64 = 4, |
| 2294 | 2, // kUpb_FieldType_Int32 = 5, |
| 2295 | 3, // kUpb_FieldType_Fixed64 = 6, |
| 2296 | 2, // kUpb_FieldType_Fixed32 = 7, |
| 2297 | 0, // kUpb_FieldType_Bool = 8, |
| 2298 | UPB_SIZE(3, 4), // kUpb_FieldType_String = 9, |
| 2299 | UPB_SIZE(2, 3), // kUpb_FieldType_Group = 10, |
| 2300 | UPB_SIZE(2, 3), // kUpb_FieldType_Message = 11, |
| 2301 | UPB_SIZE(3, 4), // kUpb_FieldType_Bytes = 12, |
| 2302 | 2, // kUpb_FieldType_UInt32 = 13, |
| 2303 | 2, // kUpb_FieldType_Enum = 14, |
| 2304 | 2, // kUpb_FieldType_SFixed32 = 15, |
| 2305 | 3, // kUpb_FieldType_SFixed64 = 16, |
| 2306 | 2, // kUpb_FieldType_SInt32 = 17, |
| 2307 | 3, // kUpb_FieldType_SInt64 = 18, |
| 2308 | }; |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2309 | return table[field->UPB_PRIVATE(descriptortype)]; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 2310 | } |
| 2311 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2312 | // Here we define universal getter/setter functions for message fields. |
| 2313 | // These look very branchy and inefficient, but as long as the MiniTableField |
| 2314 | // values are known at compile time, all the branches are optimized away and |
| 2315 | // we are left with ideal code. This can happen either through through |
| 2316 | // literals or UPB_ASSUME(): |
| 2317 | // |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 2318 | // // Via struct literals. |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2319 | // bool FooMessage_set_bool_field(const upb_Message* msg, bool val) { |
| 2320 | // const upb_MiniTableField field = {1, 0, 0, /* etc... */}; |
| 2321 | // // All value in "field" are compile-time known. |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2322 | // _upb_Message_SetNonExtensionField(msg, &field, &value); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2323 | // } |
| 2324 | // |
| 2325 | // // Via UPB_ASSUME(). |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2326 | // UPB_INLINE bool upb_Message_SetBool(upb_Message* msg, |
| 2327 | // const upb_MiniTableField* field, |
| 2328 | // bool value, upb_Arena* a) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2329 | // UPB_ASSUME(field->UPB_PRIVATE(descriptortype) == kUpb_FieldType_Bool); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2330 | // UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
| 2331 | // UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_1Byte); |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2332 | // _upb_Message_SetField(msg, field, &value, a); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2333 | // } |
| 2334 | // |
| 2335 | // As a result, we can use these universal getters/setters for *all* message |
| 2336 | // accessors: generated code, MiniTable accessors, and reflection. The only |
| 2337 | // 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] | 2338 | // about how they read/write the message data, for efficiency. |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2339 | // |
| 2340 | // These functions work on both extensions and non-extensions. If the field |
| 2341 | // of a setter is known to be a non-extension, the arena may be NULL and the |
| 2342 | // returned bool value may be ignored since it will always succeed. |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2343 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2344 | UPB_INLINE bool _upb_Message_HasExtensionField( |
| 2345 | const upb_Message* msg, const upb_MiniTableExtension* ext) { |
| 2346 | UPB_ASSERT(upb_MiniTableField_HasPresence(&ext->field)); |
| 2347 | return _upb_Message_Getext(msg, ext) != NULL; |
| 2348 | } |
| 2349 | |
| 2350 | UPB_INLINE bool _upb_Message_HasNonExtensionField( |
| 2351 | const upb_Message* msg, const upb_MiniTableField* field) { |
| 2352 | UPB_ASSERT(upb_MiniTableField_HasPresence(field)); |
| 2353 | UPB_ASSUME(!upb_MiniTableField_IsExtension(field)); |
| 2354 | if (_upb_MiniTableField_InOneOf(field)) { |
| 2355 | return _upb_getoneofcase_field(msg, field) == field->number; |
| 2356 | } else { |
| 2357 | return _upb_hasbit_field(msg, field); |
| 2358 | } |
| 2359 | } |
| 2360 | |
| 2361 | static UPB_FORCEINLINE void _upb_Message_GetNonExtensionField( |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2362 | const upb_Message* msg, const upb_MiniTableField* field, |
| 2363 | const void* default_val, void* val) { |
| 2364 | UPB_ASSUME(!upb_MiniTableField_IsExtension(field)); |
| 2365 | if ((_upb_MiniTableField_InOneOf(field) || |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 2366 | _upb_MiniTable_ValueIsNonZero(default_val, field)) && |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2367 | !_upb_Message_HasNonExtensionField(msg, field)) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2368 | _upb_MiniTable_CopyFieldData(val, default_val, field); |
| 2369 | return; |
| 2370 | } |
| 2371 | _upb_MiniTable_CopyFieldData(val, _upb_MiniTableField_GetConstPtr(msg, field), |
| 2372 | field); |
| 2373 | } |
| 2374 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2375 | UPB_INLINE void _upb_Message_GetExtensionField( |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2376 | const upb_Message* msg, const upb_MiniTableExtension* mt_ext, |
| 2377 | const void* default_val, void* val) { |
| 2378 | UPB_ASSUME(upb_MiniTableField_IsExtension(&mt_ext->field)); |
| 2379 | const upb_Message_Extension* ext = _upb_Message_Getext(msg, mt_ext); |
| 2380 | if (ext) { |
| 2381 | _upb_MiniTable_CopyFieldData(val, &ext->data, &mt_ext->field); |
| 2382 | } else { |
| 2383 | _upb_MiniTable_CopyFieldData(val, default_val, &mt_ext->field); |
| 2384 | } |
| 2385 | } |
| 2386 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2387 | UPB_INLINE void _upb_Message_GetField(const upb_Message* msg, |
| 2388 | const upb_MiniTableField* field, |
| 2389 | const void* default_val, void* val) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2390 | if (upb_MiniTableField_IsExtension(field)) { |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2391 | _upb_Message_GetExtensionField(msg, (upb_MiniTableExtension*)field, |
| 2392 | default_val, val); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2393 | } else { |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2394 | _upb_Message_GetNonExtensionField(msg, field, default_val, val); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2395 | } |
| 2396 | } |
| 2397 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2398 | UPB_INLINE void _upb_Message_SetNonExtensionField( |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2399 | upb_Message* msg, const upb_MiniTableField* field, const void* val) { |
| 2400 | UPB_ASSUME(!upb_MiniTableField_IsExtension(field)); |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2401 | _upb_Message_SetPresence(msg, field); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2402 | _upb_MiniTable_CopyFieldData(_upb_MiniTableField_GetPtr(msg, field), val, |
| 2403 | field); |
| 2404 | } |
| 2405 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2406 | UPB_INLINE bool _upb_Message_SetExtensionField( |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2407 | upb_Message* msg, const upb_MiniTableExtension* mt_ext, const void* val, |
| 2408 | upb_Arena* a) { |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2409 | UPB_ASSERT(a); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2410 | upb_Message_Extension* ext = |
| 2411 | _upb_Message_GetOrCreateExtension(msg, mt_ext, a); |
| 2412 | if (!ext) return false; |
| 2413 | _upb_MiniTable_CopyFieldData(&ext->data, val, &mt_ext->field); |
| 2414 | return true; |
| 2415 | } |
| 2416 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2417 | UPB_INLINE bool _upb_Message_SetField(upb_Message* msg, |
| 2418 | const upb_MiniTableField* field, |
| 2419 | const void* val, upb_Arena* a) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2420 | if (upb_MiniTableField_IsExtension(field)) { |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2421 | const upb_MiniTableExtension* ext = (const upb_MiniTableExtension*)field; |
| 2422 | return _upb_Message_SetExtensionField(msg, ext, val, a); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2423 | } else { |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2424 | _upb_Message_SetNonExtensionField(msg, field, val); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2425 | return true; |
| 2426 | } |
| 2427 | } |
| 2428 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2429 | UPB_INLINE void _upb_Message_ClearExtensionField( |
| 2430 | upb_Message* msg, const upb_MiniTableExtension* ext_l) { |
| 2431 | upb_Message_Internal* in = upb_Message_Getinternal(msg); |
| 2432 | if (!in->internal) return; |
| 2433 | const upb_Message_Extension* base = |
| 2434 | UPB_PTR_AT(in->internal, in->internal->ext_begin, upb_Message_Extension); |
| 2435 | upb_Message_Extension* ext = |
| 2436 | (upb_Message_Extension*)_upb_Message_Getext(msg, ext_l); |
| 2437 | if (ext) { |
| 2438 | *ext = *base; |
| 2439 | in->internal->ext_begin += sizeof(upb_Message_Extension); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 2440 | } |
| 2441 | } |
| 2442 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2443 | UPB_INLINE void _upb_Message_ClearNonExtensionField( |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 2444 | upb_Message* msg, const upb_MiniTableField* field) { |
| 2445 | if (field->presence > 0) { |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 2446 | _upb_clearhas(msg, _upb_Message_Hasidx(field)); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 2447 | } else if (_upb_MiniTableField_InOneOf(field)) { |
| 2448 | uint32_t* oneof_case = _upb_oneofcase_field(msg, field); |
| 2449 | if (*oneof_case != field->number) return; |
| 2450 | *oneof_case = 0; |
| 2451 | } |
| 2452 | const char zeros[16] = {0}; |
| 2453 | _upb_MiniTable_CopyFieldData(_upb_MiniTableField_GetPtr(msg, field), zeros, |
| 2454 | field); |
| 2455 | } |
| 2456 | |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 2457 | UPB_INLINE void _upb_Message_AssertMapIsUntagged( |
| 2458 | const upb_Message* msg, const upb_MiniTableField* field) { |
Adam Cozzette | 7d5592e | 2023-08-23 12:15:26 -0700 | [diff] [blame] | 2459 | UPB_UNUSED(msg); |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 2460 | _upb_MiniTableField_CheckIsMap(field); |
| 2461 | #ifndef NDEBUG |
| 2462 | upb_TaggedMessagePtr default_val = 0; |
| 2463 | upb_TaggedMessagePtr tagged; |
| 2464 | _upb_Message_GetNonExtensionField(msg, field, &default_val, &tagged); |
| 2465 | UPB_ASSERT(!upb_TaggedMessagePtr_IsEmpty(tagged)); |
| 2466 | #endif |
| 2467 | } |
| 2468 | |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 2469 | UPB_INLINE upb_Map* _upb_Message_GetOrCreateMutableMap( |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 2470 | upb_Message* msg, const upb_MiniTableField* field, size_t key_size, |
| 2471 | size_t val_size, upb_Arena* arena) { |
| 2472 | _upb_MiniTableField_CheckIsMap(field); |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 2473 | _upb_Message_AssertMapIsUntagged(msg, field); |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 2474 | upb_Map* map = NULL; |
| 2475 | upb_Map* default_map_value = NULL; |
| 2476 | _upb_Message_GetNonExtensionField(msg, field, &default_map_value, &map); |
| 2477 | if (!map) { |
| 2478 | map = _upb_Map_New(arena, key_size, val_size); |
| 2479 | // Check again due to: https://godbolt.org/z/7WfaoKG1r |
| 2480 | _upb_MiniTableField_CheckIsMap(field); |
| 2481 | _upb_Message_SetNonExtensionField(msg, field, &map); |
| 2482 | } |
| 2483 | return map; |
| 2484 | } |
| 2485 | |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2486 | #ifdef __cplusplus |
| 2487 | } /* extern "C" */ |
| 2488 | #endif |
| 2489 | |
| 2490 | #if defined(__GNUC__) && !defined(__clang__) |
| 2491 | #pragma GCC diagnostic pop |
| 2492 | #endif |
| 2493 | |
| 2494 | |
Sandy Zhang | e3b0943 | 2023-08-07 09:30:02 -0700 | [diff] [blame] | 2495 | #endif // UPB_MESSAGE_INTERNAL_ACCESSORS_H_ |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2496 | |
Protobuf Team Bot | 376ba2f | 2023-09-29 22:17:43 +0000 | [diff] [blame] | 2497 | #ifndef UPB_MESSAGE_INTERNAL_ARRAY_H_ |
| 2498 | #define UPB_MESSAGE_INTERNAL_ARRAY_H_ |
| 2499 | |
| 2500 | #include <string.h> |
| 2501 | |
| 2502 | |
| 2503 | // Must be last. |
| 2504 | |
| 2505 | #ifdef __cplusplus |
| 2506 | extern "C" { |
| 2507 | #endif |
| 2508 | |
| 2509 | // LINT.IfChange(struct_definition) |
| 2510 | // Our internal representation for repeated fields. |
| 2511 | struct upb_Array { |
| 2512 | uintptr_t data; /* Tagged ptr: low 3 bits of ptr are lg2(elem size). */ |
| 2513 | size_t size; /* The number of elements in the array. */ |
| 2514 | size_t capacity; /* Allocated storage. Measured in elements. */ |
| 2515 | }; |
| 2516 | // LINT.ThenChange(GoogleInternalName1) |
| 2517 | |
| 2518 | UPB_INLINE size_t _upb_Array_ElementSizeLg2(const upb_Array* arr) { |
| 2519 | size_t ret = arr->data & 7; |
| 2520 | UPB_ASSERT(ret <= 4); |
| 2521 | return ret; |
| 2522 | } |
| 2523 | |
| 2524 | UPB_INLINE const void* _upb_array_constptr(const upb_Array* arr) { |
| 2525 | _upb_Array_ElementSizeLg2(arr); // Check assertion. |
| 2526 | return (void*)(arr->data & ~(uintptr_t)7); |
| 2527 | } |
| 2528 | |
| 2529 | UPB_INLINE uintptr_t _upb_array_tagptr(void* ptr, int elem_size_lg2) { |
| 2530 | UPB_ASSERT(elem_size_lg2 <= 4); |
| 2531 | return (uintptr_t)ptr | elem_size_lg2; |
| 2532 | } |
| 2533 | |
| 2534 | UPB_INLINE void* _upb_array_ptr(upb_Array* arr) { |
| 2535 | return (void*)_upb_array_constptr(arr); |
| 2536 | } |
| 2537 | |
| 2538 | UPB_INLINE uintptr_t _upb_tag_arrptr(void* ptr, int elem_size_lg2) { |
| 2539 | UPB_ASSERT(elem_size_lg2 <= 4); |
| 2540 | UPB_ASSERT(((uintptr_t)ptr & 7) == 0); |
| 2541 | return (uintptr_t)ptr | (unsigned)elem_size_lg2; |
| 2542 | } |
| 2543 | |
| 2544 | extern const char _upb_Array_CTypeSizeLg2Table[]; |
| 2545 | |
| 2546 | UPB_INLINE size_t _upb_Array_CTypeSizeLg2(upb_CType ctype) { |
| 2547 | return _upb_Array_CTypeSizeLg2Table[ctype]; |
| 2548 | } |
| 2549 | |
| 2550 | UPB_INLINE upb_Array* _upb_Array_New(upb_Arena* a, size_t init_capacity, |
| 2551 | int elem_size_lg2) { |
| 2552 | UPB_ASSERT(elem_size_lg2 <= 4); |
| 2553 | const size_t arr_size = UPB_ALIGN_UP(sizeof(upb_Array), UPB_MALLOC_ALIGN); |
| 2554 | const size_t bytes = arr_size + (init_capacity << elem_size_lg2); |
| 2555 | upb_Array* arr = (upb_Array*)upb_Arena_Malloc(a, bytes); |
| 2556 | if (!arr) return NULL; |
| 2557 | arr->data = _upb_tag_arrptr(UPB_PTR_AT(arr, arr_size, void), elem_size_lg2); |
| 2558 | arr->size = 0; |
| 2559 | arr->capacity = init_capacity; |
| 2560 | return arr; |
| 2561 | } |
| 2562 | |
| 2563 | // Resizes the capacity of the array to be at least min_size. |
| 2564 | bool _upb_array_realloc(upb_Array* arr, size_t min_size, upb_Arena* arena); |
| 2565 | |
| 2566 | UPB_INLINE bool _upb_array_reserve(upb_Array* arr, size_t size, |
| 2567 | upb_Arena* arena) { |
| 2568 | if (arr->capacity < size) return _upb_array_realloc(arr, size, arena); |
| 2569 | return true; |
| 2570 | } |
| 2571 | |
| 2572 | // Resize without initializing new elements. |
| 2573 | UPB_INLINE bool _upb_Array_ResizeUninitialized(upb_Array* arr, size_t size, |
| 2574 | upb_Arena* arena) { |
| 2575 | UPB_ASSERT(size <= arr->size || arena); // Allow NULL arena when shrinking. |
| 2576 | if (!_upb_array_reserve(arr, size, arena)) return false; |
| 2577 | arr->size = size; |
| 2578 | return true; |
| 2579 | } |
| 2580 | |
| 2581 | // This function is intended for situations where elem_size is compile-time |
| 2582 | // constant or a known expression of the form (1 << lg2), so that the expression |
| 2583 | // i*elem_size does not result in an actual multiplication. |
| 2584 | UPB_INLINE void _upb_Array_Set(upb_Array* arr, size_t i, const void* data, |
| 2585 | size_t elem_size) { |
| 2586 | UPB_ASSERT(i < arr->size); |
| 2587 | UPB_ASSERT(elem_size == 1U << _upb_Array_ElementSizeLg2(arr)); |
| 2588 | char* arr_data = (char*)_upb_array_ptr(arr); |
| 2589 | memcpy(arr_data + (i * elem_size), data, elem_size); |
| 2590 | } |
| 2591 | |
| 2592 | UPB_INLINE void _upb_array_detach(const void* msg, size_t ofs) { |
| 2593 | *UPB_PTR_AT(msg, ofs, upb_Array*) = NULL; |
| 2594 | } |
| 2595 | |
| 2596 | #ifdef __cplusplus |
| 2597 | } /* extern "C" */ |
| 2598 | #endif |
| 2599 | |
| 2600 | |
| 2601 | #endif /* UPB_MESSAGE_INTERNAL_ARRAY_H_ */ |
| 2602 | |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2603 | // Must be last. |
| 2604 | |
| 2605 | #ifdef __cplusplus |
| 2606 | extern "C" { |
| 2607 | #endif |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2608 | |
| 2609 | UPB_API_INLINE void upb_Message_ClearField(upb_Message* msg, |
| 2610 | const upb_MiniTableField* field) { |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 2611 | if (upb_MiniTableField_IsExtension(field)) { |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2612 | const upb_MiniTableExtension* ext = (const upb_MiniTableExtension*)field; |
| 2613 | _upb_Message_ClearExtensionField(msg, ext); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 2614 | } else { |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2615 | _upb_Message_ClearNonExtensionField(msg, field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 2616 | } |
| 2617 | } |
| 2618 | |
Jie Luo | f36a5c6 | 2023-05-23 17:56:18 -0700 | [diff] [blame] | 2619 | UPB_API_INLINE void upb_Message_Clear(upb_Message* msg, |
| 2620 | const upb_MiniTable* l) { |
| 2621 | // Note: Can't use UPB_PTR_AT() here because we are doing pointer subtraction. |
| 2622 | char* mem = (char*)msg - sizeof(upb_Message_Internal); |
| 2623 | memset(mem, 0, upb_msg_sizeof(l)); |
| 2624 | } |
| 2625 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2626 | UPB_API_INLINE bool upb_Message_HasField(const upb_Message* msg, |
| 2627 | const upb_MiniTableField* field) { |
| 2628 | if (upb_MiniTableField_IsExtension(field)) { |
| 2629 | const upb_MiniTableExtension* ext = (const upb_MiniTableExtension*)field; |
| 2630 | return _upb_Message_HasExtensionField(msg, ext); |
| 2631 | } else { |
| 2632 | return _upb_Message_HasNonExtensionField(msg, field); |
| 2633 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 2634 | } |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2635 | |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 2636 | UPB_API_INLINE uint32_t upb_Message_WhichOneofFieldNumber( |
| 2637 | const upb_Message* message, const upb_MiniTableField* oneof_field) { |
| 2638 | UPB_ASSUME(_upb_MiniTableField_InOneOf(oneof_field)); |
| 2639 | return _upb_getoneofcase_field(message, oneof_field); |
| 2640 | } |
| 2641 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2642 | UPB_API_INLINE bool upb_Message_GetBool(const upb_Message* msg, |
| 2643 | const upb_MiniTableField* field, |
| 2644 | bool default_val) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2645 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Bool); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2646 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_1Byte); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2647 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2648 | bool ret; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2649 | _upb_Message_GetField(msg, field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2650 | return ret; |
| 2651 | } |
| 2652 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2653 | UPB_API_INLINE bool upb_Message_SetBool(upb_Message* msg, |
| 2654 | const upb_MiniTableField* field, |
| 2655 | bool value, upb_Arena* a) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2656 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Bool); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2657 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_1Byte); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2658 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2659 | return _upb_Message_SetField(msg, field, &value, a); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2660 | } |
| 2661 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2662 | UPB_API_INLINE int32_t upb_Message_GetInt32(const upb_Message* msg, |
| 2663 | const upb_MiniTableField* field, |
| 2664 | int32_t default_val) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2665 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Int32 || |
| 2666 | upb_MiniTableField_CType(field) == kUpb_CType_Enum); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2667 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2668 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2669 | int32_t ret; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2670 | _upb_Message_GetField(msg, field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2671 | return ret; |
| 2672 | } |
| 2673 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2674 | UPB_API_INLINE bool upb_Message_SetInt32(upb_Message* msg, |
| 2675 | const upb_MiniTableField* field, |
| 2676 | int32_t value, upb_Arena* a) { |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 2677 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Int32 || |
| 2678 | upb_MiniTableField_CType(field) == kUpb_CType_Enum); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2679 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2680 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2681 | return _upb_Message_SetField(msg, field, &value, a); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2682 | } |
| 2683 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2684 | UPB_API_INLINE uint32_t upb_Message_GetUInt32(const upb_Message* msg, |
| 2685 | const upb_MiniTableField* field, |
| 2686 | uint32_t default_val) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2687 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_UInt32); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2688 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2689 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2690 | uint32_t ret; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2691 | _upb_Message_GetField(msg, field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2692 | return ret; |
| 2693 | } |
| 2694 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2695 | UPB_API_INLINE bool upb_Message_SetUInt32(upb_Message* msg, |
| 2696 | const upb_MiniTableField* field, |
| 2697 | uint32_t value, upb_Arena* a) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2698 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_UInt32); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2699 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2700 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2701 | return _upb_Message_SetField(msg, field, &value, a); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2702 | } |
| 2703 | |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 2704 | UPB_API_INLINE void upb_Message_SetClosedEnum( |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 2705 | upb_Message* msg, const upb_MiniTable* msg_mini_table, |
| 2706 | const upb_MiniTableField* field, int32_t value) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2707 | UPB_ASSERT(upb_MiniTableField_IsClosedEnum(field)); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2708 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2709 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2710 | UPB_ASSERT(upb_MiniTableEnum_CheckValue( |
| 2711 | upb_MiniTable_GetSubEnumTable(msg_mini_table, field), value)); |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2712 | _upb_Message_SetNonExtensionField(msg, field, &value); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2713 | } |
| 2714 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2715 | UPB_API_INLINE int64_t upb_Message_GetInt64(const upb_Message* msg, |
| 2716 | const upb_MiniTableField* field, |
| 2717 | uint64_t default_val) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2718 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Int64); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2719 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_8Byte); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2720 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2721 | int64_t ret; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2722 | _upb_Message_GetField(msg, field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2723 | return ret; |
| 2724 | } |
| 2725 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2726 | UPB_API_INLINE bool upb_Message_SetInt64(upb_Message* msg, |
| 2727 | const upb_MiniTableField* field, |
| 2728 | int64_t value, upb_Arena* a) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2729 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Int64); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2730 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_8Byte); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2731 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2732 | return _upb_Message_SetField(msg, field, &value, a); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2733 | } |
| 2734 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2735 | UPB_API_INLINE uint64_t upb_Message_GetUInt64(const upb_Message* msg, |
| 2736 | const upb_MiniTableField* field, |
| 2737 | uint64_t default_val) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2738 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_UInt64); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2739 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_8Byte); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2740 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2741 | uint64_t ret; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2742 | _upb_Message_GetField(msg, field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2743 | return ret; |
| 2744 | } |
| 2745 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2746 | UPB_API_INLINE bool upb_Message_SetUInt64(upb_Message* msg, |
| 2747 | const upb_MiniTableField* field, |
| 2748 | uint64_t value, upb_Arena* a) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2749 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_UInt64); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2750 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_8Byte); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2751 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2752 | return _upb_Message_SetField(msg, field, &value, a); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2753 | } |
| 2754 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2755 | UPB_API_INLINE float upb_Message_GetFloat(const upb_Message* msg, |
| 2756 | const upb_MiniTableField* field, |
| 2757 | float default_val) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2758 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Float); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2759 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2760 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2761 | float ret; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2762 | _upb_Message_GetField(msg, field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2763 | return ret; |
| 2764 | } |
| 2765 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2766 | UPB_API_INLINE bool upb_Message_SetFloat(upb_Message* msg, |
| 2767 | const upb_MiniTableField* field, |
| 2768 | float value, upb_Arena* a) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2769 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Float); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2770 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2771 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2772 | return _upb_Message_SetField(msg, field, &value, a); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2773 | } |
| 2774 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2775 | UPB_API_INLINE double upb_Message_GetDouble(const upb_Message* msg, |
| 2776 | const upb_MiniTableField* field, |
| 2777 | double default_val) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2778 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Double); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2779 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_8Byte); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2780 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2781 | double ret; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2782 | _upb_Message_GetField(msg, field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2783 | return ret; |
| 2784 | } |
| 2785 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2786 | UPB_API_INLINE bool upb_Message_SetDouble(upb_Message* msg, |
| 2787 | const upb_MiniTableField* field, |
| 2788 | double value, upb_Arena* a) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2789 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Double); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2790 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_8Byte); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2791 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2792 | return _upb_Message_SetField(msg, field, &value, a); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2793 | } |
| 2794 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 2795 | UPB_API_INLINE upb_StringView |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2796 | upb_Message_GetString(const upb_Message* msg, const upb_MiniTableField* field, |
| 2797 | upb_StringView def_val) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2798 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_String || |
| 2799 | upb_MiniTableField_CType(field) == kUpb_CType_Bytes); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2800 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_StringView); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2801 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2802 | upb_StringView ret; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2803 | _upb_Message_GetField(msg, field, &def_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2804 | return ret; |
| 2805 | } |
| 2806 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2807 | UPB_API_INLINE bool upb_Message_SetString(upb_Message* msg, |
| 2808 | const upb_MiniTableField* field, |
| 2809 | upb_StringView value, upb_Arena* a) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2810 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_String || |
| 2811 | upb_MiniTableField_CType(field) == kUpb_CType_Bytes); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2812 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_StringView); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2813 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2814 | return _upb_Message_SetField(msg, field, &value, a); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2815 | } |
| 2816 | |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 2817 | UPB_API_INLINE upb_TaggedMessagePtr upb_Message_GetTaggedMessagePtr( |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2818 | const upb_Message* msg, const upb_MiniTableField* field, |
| 2819 | upb_Message* default_val) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2820 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Message); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2821 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == |
| 2822 | UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte)); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2823 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 2824 | upb_TaggedMessagePtr tagged; |
| 2825 | _upb_Message_GetNonExtensionField(msg, field, &default_val, &tagged); |
| 2826 | return tagged; |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2827 | } |
| 2828 | |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 2829 | UPB_API_INLINE const upb_Message* upb_Message_GetMessage( |
| 2830 | const upb_Message* msg, const upb_MiniTableField* field, |
| 2831 | upb_Message* default_val) { |
| 2832 | upb_TaggedMessagePtr tagged = |
| 2833 | upb_Message_GetTaggedMessagePtr(msg, field, default_val); |
| 2834 | return upb_TaggedMessagePtr_GetNonEmptyMessage(tagged); |
| 2835 | } |
| 2836 | |
| 2837 | // For internal use only; users cannot set tagged messages because only the |
| 2838 | // parser and the message copier are allowed to directly create an empty |
| 2839 | // message. |
| 2840 | UPB_API_INLINE void _upb_Message_SetTaggedMessagePtr( |
| 2841 | upb_Message* msg, const upb_MiniTable* mini_table, |
| 2842 | const upb_MiniTableField* field, upb_TaggedMessagePtr sub_message) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2843 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Message); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2844 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == |
| 2845 | UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte)); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2846 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 2847 | UPB_ASSERT(mini_table->subs[field->UPB_PRIVATE(submsg_index)].submsg); |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2848 | _upb_Message_SetNonExtensionField(msg, field, &sub_message); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2849 | } |
| 2850 | |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 2851 | UPB_API_INLINE void upb_Message_SetMessage(upb_Message* msg, |
| 2852 | const upb_MiniTable* mini_table, |
| 2853 | const upb_MiniTableField* field, |
| 2854 | upb_Message* sub_message) { |
| 2855 | _upb_Message_SetTaggedMessagePtr( |
| 2856 | msg, mini_table, field, _upb_TaggedMessagePtr_Pack(sub_message, false)); |
| 2857 | } |
| 2858 | |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 2859 | UPB_API_INLINE upb_Message* upb_Message_GetOrCreateMutableMessage( |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2860 | upb_Message* msg, const upb_MiniTable* mini_table, |
| 2861 | const upb_MiniTableField* field, upb_Arena* arena) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2862 | UPB_ASSERT(arena); |
| 2863 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Message); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2864 | upb_Message* sub_message = *UPB_PTR_AT(msg, field->offset, upb_Message*); |
| 2865 | if (!sub_message) { |
| 2866 | const upb_MiniTable* sub_mini_table = |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 2867 | mini_table->subs[field->UPB_PRIVATE(submsg_index)].submsg; |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2868 | UPB_ASSERT(sub_mini_table); |
| 2869 | sub_message = _upb_Message_New(sub_mini_table, arena); |
| 2870 | *UPB_PTR_AT(msg, field->offset, upb_Message*) = sub_message; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2871 | _upb_Message_SetPresence(msg, field); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2872 | } |
| 2873 | return sub_message; |
| 2874 | } |
| 2875 | |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 2876 | UPB_API_INLINE const upb_Array* upb_Message_GetArray( |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2877 | const upb_Message* msg, const upb_MiniTableField* field) { |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 2878 | _upb_MiniTableField_CheckIsArray(field); |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 2879 | upb_Array* ret; |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2880 | const upb_Array* default_val = NULL; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2881 | _upb_Message_GetNonExtensionField(msg, field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2882 | return ret; |
| 2883 | } |
| 2884 | |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 2885 | UPB_API_INLINE upb_Array* upb_Message_GetMutableArray( |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2886 | upb_Message* msg, const upb_MiniTableField* field) { |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 2887 | _upb_MiniTableField_CheckIsArray(field); |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 2888 | return (upb_Array*)upb_Message_GetArray(msg, field); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2889 | } |
| 2890 | |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 2891 | UPB_API_INLINE upb_Array* upb_Message_GetOrCreateMutableArray( |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 2892 | upb_Message* msg, const upb_MiniTableField* field, upb_Arena* arena) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2893 | UPB_ASSERT(arena); |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 2894 | _upb_MiniTableField_CheckIsArray(field); |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 2895 | upb_Array* array = upb_Message_GetMutableArray(msg, field); |
| 2896 | if (!array) { |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 2897 | array = _upb_Array_New(arena, 4, _upb_MiniTable_ElementSizeLg2(field)); |
| 2898 | // Check again due to: https://godbolt.org/z/7WfaoKG1r |
| 2899 | _upb_MiniTableField_CheckIsArray(field); |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 2900 | _upb_Message_SetField(msg, field, &array, arena); |
| 2901 | } |
| 2902 | return array; |
| 2903 | } |
| 2904 | |
Jie Luo | f36a5c6 | 2023-05-23 17:56:18 -0700 | [diff] [blame] | 2905 | UPB_API_INLINE void* upb_Message_ResizeArrayUninitialized( |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 2906 | upb_Message* msg, const upb_MiniTableField* field, size_t size, |
| 2907 | upb_Arena* arena) { |
| 2908 | _upb_MiniTableField_CheckIsArray(field); |
| 2909 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, field, arena); |
| 2910 | if (!arr || !_upb_Array_ResizeUninitialized(arr, size, arena)) return NULL; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 2911 | return _upb_array_ptr(arr); |
| 2912 | } |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2913 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 2914 | UPB_API_INLINE const upb_Map* upb_Message_GetMap( |
| 2915 | const upb_Message* msg, const upb_MiniTableField* field) { |
| 2916 | _upb_MiniTableField_CheckIsMap(field); |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 2917 | _upb_Message_AssertMapIsUntagged(msg, field); |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 2918 | upb_Map* ret; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 2919 | const upb_Map* default_val = NULL; |
| 2920 | _upb_Message_GetNonExtensionField(msg, field, &default_val, &ret); |
| 2921 | return ret; |
| 2922 | } |
| 2923 | |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 2924 | UPB_API_INLINE upb_Map* upb_Message_GetMutableMap( |
| 2925 | upb_Message* msg, const upb_MiniTableField* field) { |
| 2926 | return (upb_Map*)upb_Message_GetMap(msg, field); |
| 2927 | } |
| 2928 | |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 2929 | UPB_API_INLINE upb_Map* upb_Message_GetOrCreateMutableMap( |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 2930 | upb_Message* msg, const upb_MiniTable* map_entry_mini_table, |
| 2931 | const upb_MiniTableField* field, upb_Arena* arena) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2932 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Message); |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 2933 | const upb_MiniTableField* map_entry_key_field = |
| 2934 | &map_entry_mini_table->fields[0]; |
| 2935 | const upb_MiniTableField* map_entry_value_field = |
| 2936 | &map_entry_mini_table->fields[1]; |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 2937 | return _upb_Message_GetOrCreateMutableMap( |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 2938 | msg, field, |
| 2939 | _upb_Map_CTypeSize(upb_MiniTableField_CType(map_entry_key_field)), |
| 2940 | _upb_Map_CTypeSize(upb_MiniTableField_CType(map_entry_value_field)), |
| 2941 | arena); |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 2942 | } |
| 2943 | |
| 2944 | // Updates a map entry given an entry message. |
| 2945 | upb_MapInsertStatus upb_Message_InsertMapEntry(upb_Map* map, |
| 2946 | const upb_MiniTable* mini_table, |
| 2947 | const upb_MiniTableField* field, |
| 2948 | upb_Message* map_entry_message, |
| 2949 | upb_Arena* arena); |
| 2950 | |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 2951 | // Compares two messages by serializing them and calling memcmp(). |
| 2952 | bool upb_Message_IsExactlyEqual(const upb_Message* m1, const upb_Message* m2, |
| 2953 | const upb_MiniTable* layout); |
| 2954 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2955 | #ifdef __cplusplus |
| 2956 | } /* extern "C" */ |
| 2957 | #endif |
| 2958 | |
| 2959 | |
| 2960 | #endif // UPB_MESSAGE_ACCESSORS_H_ |
| 2961 | |
Protobuf Team Bot | 376ba2f | 2023-09-29 22:17:43 +0000 | [diff] [blame] | 2962 | // These functions are only used by generated code. |
| 2963 | |
| 2964 | #ifndef UPB_MESSAGE_MAP_GENCODE_UTIL_H_ |
| 2965 | #define UPB_MESSAGE_MAP_GENCODE_UTIL_H_ |
| 2966 | |
| 2967 | |
| 2968 | // Must be last. |
| 2969 | |
| 2970 | #ifdef __cplusplus |
| 2971 | extern "C" { |
| 2972 | #endif |
| 2973 | |
| 2974 | // Message map operations, these get the map from the message first. |
| 2975 | |
| 2976 | UPB_INLINE void _upb_msg_map_key(const void* msg, void* key, size_t size) { |
| 2977 | const upb_tabent* ent = (const upb_tabent*)msg; |
| 2978 | uint32_t u32len; |
| 2979 | upb_StringView k; |
| 2980 | k.data = upb_tabstr(ent->key, &u32len); |
| 2981 | k.size = u32len; |
| 2982 | _upb_map_fromkey(k, key, size); |
| 2983 | } |
| 2984 | |
| 2985 | UPB_INLINE void _upb_msg_map_value(const void* msg, void* val, size_t size) { |
| 2986 | const upb_tabent* ent = (const upb_tabent*)msg; |
| 2987 | upb_value v = {ent->val.val}; |
| 2988 | _upb_map_fromvalue(v, val, size); |
| 2989 | } |
| 2990 | |
| 2991 | UPB_INLINE void _upb_msg_map_set_value(void* msg, const void* val, |
| 2992 | size_t size) { |
| 2993 | upb_tabent* ent = (upb_tabent*)msg; |
| 2994 | // This is like _upb_map_tovalue() except the entry already exists |
| 2995 | // so we can reuse the allocated upb_StringView for string fields. |
| 2996 | if (size == UPB_MAPTYPE_STRING) { |
| 2997 | upb_StringView* strp = (upb_StringView*)(uintptr_t)ent->val.val; |
| 2998 | memcpy(strp, val, sizeof(*strp)); |
| 2999 | } else { |
| 3000 | memcpy(&ent->val.val, val, size); |
| 3001 | } |
| 3002 | } |
| 3003 | |
| 3004 | #ifdef __cplusplus |
| 3005 | } /* extern "C" */ |
| 3006 | #endif |
| 3007 | |
| 3008 | |
| 3009 | #endif /* UPB_MESSAGE_MAP_GENCODE_UTIL_H_ */ |
| 3010 | |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 3011 | #ifndef UPB_MINI_TABLE_DECODE_H_ |
| 3012 | #define UPB_MINI_TABLE_DECODE_H_ |
| 3013 | |
| 3014 | |
| 3015 | #ifndef UPB_MINI_TABLE_SUB_H_ |
| 3016 | #define UPB_MINI_TABLE_SUB_H_ |
| 3017 | |
| 3018 | |
| 3019 | typedef union upb_MiniTableSub upb_MiniTableSub; |
| 3020 | |
| 3021 | #endif /* UPB_MINI_TABLE_INTERNAL_SUB_H_ */ |
| 3022 | |
| 3023 | // Export the newer headers, for legacy users. New users should include the |
| 3024 | // more specific headers directly. |
| 3025 | // IWYU pragma: begin_exports |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 3026 | #ifndef UPB_MINI_DESCRIPTOR_BUILD_ENUM_H_ |
| 3027 | #define UPB_MINI_DESCRIPTOR_BUILD_ENUM_H_ |
| 3028 | |
| 3029 | |
| 3030 | // Must be last. |
| 3031 | |
| 3032 | #ifdef __cplusplus |
| 3033 | extern "C" { |
| 3034 | #endif |
| 3035 | |
| 3036 | // Builds a upb_MiniTableEnum from an enum MiniDescriptor. The MiniDescriptor |
| 3037 | // must be for an enum, not a message. |
| 3038 | UPB_API upb_MiniTableEnum* upb_MiniDescriptor_BuildEnum(const char* data, |
| 3039 | size_t len, |
| 3040 | upb_Arena* arena, |
| 3041 | upb_Status* status); |
| 3042 | |
Protobuf Team Bot | 986cbb6 | 2023-09-19 15:03:51 +0000 | [diff] [blame] | 3043 | // TODO: Deprecated name; update callers. |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 3044 | UPB_API_INLINE upb_MiniTableEnum* upb_MiniTableEnum_Build(const char* data, |
| 3045 | size_t len, |
| 3046 | upb_Arena* arena, |
| 3047 | upb_Status* status) { |
| 3048 | return upb_MiniDescriptor_BuildEnum(data, len, arena, status); |
| 3049 | } |
| 3050 | |
| 3051 | #ifdef __cplusplus |
| 3052 | } /* extern "C" */ |
| 3053 | #endif |
| 3054 | |
| 3055 | |
| 3056 | #endif // UPB_MINI_DESCRIPTOR_BUILD_ENUM_H_ |
| 3057 | |
| 3058 | // Functions for linking MiniTables together once they are built from a |
| 3059 | // MiniDescriptor. |
| 3060 | // |
| 3061 | // These functions have names like upb_MiniTable_Link() because they operate on |
| 3062 | // MiniTables. We put them here, rather than in the mini_table/ directory, |
| 3063 | // because they are only needed when building MiniTables from MiniDescriptors. |
| 3064 | // The interfaces in mini_table/ assume that MiniTables are immutable. |
| 3065 | |
| 3066 | #ifndef UPB_MINI_DESCRIPTOR_LINK_H_ |
| 3067 | #define UPB_MINI_DESCRIPTOR_LINK_H_ |
| 3068 | |
| 3069 | |
| 3070 | // Must be last. |
| 3071 | |
| 3072 | #ifdef __cplusplus |
| 3073 | extern "C" { |
| 3074 | #endif |
| 3075 | |
| 3076 | // Links a sub-message field to a MiniTable for that sub-message. If a |
| 3077 | // sub-message field is not linked, it will be treated as an unknown field |
| 3078 | // during parsing, and setting the field will not be allowed. It is possible |
| 3079 | // to link the message field later, at which point it will no longer be treated |
| 3080 | // as unknown. However there is no synchronization for this operation, which |
| 3081 | // means parallel mutation requires external synchronization. |
| 3082 | // Returns success/failure. |
| 3083 | UPB_API bool upb_MiniTable_SetSubMessage(upb_MiniTable* table, |
| 3084 | upb_MiniTableField* field, |
| 3085 | const upb_MiniTable* sub); |
| 3086 | |
| 3087 | // Links an enum field to a MiniTable for that enum. |
| 3088 | // All enum fields must be linked prior to parsing. |
| 3089 | // Returns success/failure. |
| 3090 | UPB_API bool upb_MiniTable_SetSubEnum(upb_MiniTable* table, |
| 3091 | upb_MiniTableField* field, |
| 3092 | const upb_MiniTableEnum* sub); |
| 3093 | |
| 3094 | // Returns a list of fields that require linking at runtime, to connect the |
| 3095 | // MiniTable to its sub-messages and sub-enums. The list of fields will be |
| 3096 | // written to the `subs` array, which must have been allocated by the caller |
| 3097 | // and must be large enough to hold a list of all fields in the message. |
| 3098 | // |
| 3099 | // The order of the fields returned by this function is significant: it matches |
| 3100 | // the order expected by upb_MiniTable_Link() below. |
| 3101 | // |
| 3102 | // The return value packs the sub-message count and sub-enum count into a single |
| 3103 | // integer like so: |
| 3104 | // return (msg_count << 16) | enum_count; |
| 3105 | UPB_API uint32_t upb_MiniTable_GetSubList(const upb_MiniTable* mt, |
| 3106 | const upb_MiniTableField** subs); |
| 3107 | |
| 3108 | // Links a message to its sub-messages and sub-enums. The caller must pass |
| 3109 | // arrays of sub-tables and sub-enums, in the same length and order as is |
| 3110 | // returned by upb_MiniTable_GetSubList() above. However, individual elements |
| 3111 | // of the sub_tables may be NULL if those sub-messages were tree shaken. |
| 3112 | // |
| 3113 | // Returns false if either array is too short, or if any of the tables fails |
| 3114 | // to link. |
| 3115 | UPB_API bool upb_MiniTable_Link(upb_MiniTable* mt, |
| 3116 | const upb_MiniTable** sub_tables, |
| 3117 | size_t sub_table_count, |
| 3118 | const upb_MiniTableEnum** sub_enums, |
| 3119 | size_t sub_enum_count); |
| 3120 | |
| 3121 | #ifdef __cplusplus |
| 3122 | } /* extern "C" */ |
| 3123 | #endif |
| 3124 | |
| 3125 | |
| 3126 | #endif // UPB_MINI_DESCRIPTOR_LINK_H_ |
| 3127 | // IWYU pragma: end_exports |
| 3128 | |
| 3129 | // Must be last. |
| 3130 | |
| 3131 | typedef enum { |
| 3132 | kUpb_MiniTablePlatform_32Bit, |
| 3133 | kUpb_MiniTablePlatform_64Bit, |
| 3134 | kUpb_MiniTablePlatform_Native = |
| 3135 | UPB_SIZE(kUpb_MiniTablePlatform_32Bit, kUpb_MiniTablePlatform_64Bit), |
| 3136 | } upb_MiniTablePlatform; |
| 3137 | |
| 3138 | #ifdef __cplusplus |
| 3139 | extern "C" { |
| 3140 | #endif |
| 3141 | |
| 3142 | // Builds a mini table from the data encoded in the buffer [data, len]. If any |
| 3143 | // errors occur, returns NULL and sets a status message. In the success case, |
| 3144 | // the caller must call upb_MiniTable_SetSub*() for all message or proto2 enum |
| 3145 | // fields to link the table to the appropriate sub-tables. |
| 3146 | upb_MiniTable* _upb_MiniTable_Build(const char* data, size_t len, |
| 3147 | upb_MiniTablePlatform platform, |
| 3148 | upb_Arena* arena, upb_Status* status); |
| 3149 | |
| 3150 | UPB_API_INLINE upb_MiniTable* upb_MiniTable_Build(const char* data, size_t len, |
| 3151 | upb_Arena* arena, |
| 3152 | upb_Status* status) { |
| 3153 | return _upb_MiniTable_Build(data, len, kUpb_MiniTablePlatform_Native, arena, |
| 3154 | status); |
| 3155 | } |
| 3156 | |
| 3157 | // Initializes a MiniTableExtension buffer that has already been allocated. |
| 3158 | // This is needed by upb_FileDef and upb_MessageDef, which allocate all of the |
| 3159 | // extensions together in a single contiguous array. |
| 3160 | const char* _upb_MiniTableExtension_Init(const char* data, size_t len, |
| 3161 | upb_MiniTableExtension* ext, |
| 3162 | const upb_MiniTable* extendee, |
| 3163 | upb_MiniTableSub sub, |
| 3164 | upb_MiniTablePlatform platform, |
| 3165 | upb_Status* status); |
| 3166 | |
| 3167 | UPB_API_INLINE const char* upb_MiniTableExtension_Init( |
| 3168 | const char* data, size_t len, upb_MiniTableExtension* ext, |
| 3169 | const upb_MiniTable* extendee, upb_MiniTableSub sub, upb_Status* status) { |
| 3170 | return _upb_MiniTableExtension_Init(data, len, ext, extendee, sub, |
| 3171 | kUpb_MiniTablePlatform_Native, status); |
| 3172 | } |
| 3173 | |
| 3174 | UPB_API upb_MiniTableExtension* _upb_MiniTableExtension_Build( |
| 3175 | const char* data, size_t len, const upb_MiniTable* extendee, |
| 3176 | upb_MiniTableSub sub, upb_MiniTablePlatform platform, upb_Arena* arena, |
| 3177 | upb_Status* status); |
| 3178 | |
| 3179 | UPB_API_INLINE upb_MiniTableExtension* upb_MiniTableExtension_Build( |
| 3180 | const char* data, size_t len, const upb_MiniTable* extendee, |
| 3181 | upb_Arena* arena, upb_Status* status) { |
| 3182 | upb_MiniTableSub sub; |
| 3183 | sub.submsg = NULL; |
| 3184 | return _upb_MiniTableExtension_Build( |
| 3185 | data, len, extendee, sub, kUpb_MiniTablePlatform_Native, arena, status); |
| 3186 | } |
| 3187 | |
| 3188 | UPB_API_INLINE upb_MiniTableExtension* upb_MiniTableExtension_BuildMessage( |
| 3189 | const char* data, size_t len, const upb_MiniTable* extendee, |
| 3190 | upb_MiniTable* submsg, upb_Arena* arena, upb_Status* status) { |
| 3191 | upb_MiniTableSub sub; |
| 3192 | sub.submsg = submsg; |
| 3193 | return _upb_MiniTableExtension_Build( |
| 3194 | data, len, extendee, sub, kUpb_MiniTablePlatform_Native, arena, status); |
| 3195 | } |
| 3196 | |
| 3197 | UPB_API_INLINE upb_MiniTableExtension* upb_MiniTableExtension_BuildEnum( |
| 3198 | const char* data, size_t len, const upb_MiniTable* extendee, |
| 3199 | upb_MiniTableEnum* subenum, upb_Arena* arena, upb_Status* status) { |
| 3200 | upb_MiniTableSub sub; |
| 3201 | sub.subenum = subenum; |
| 3202 | return _upb_MiniTableExtension_Build( |
| 3203 | data, len, extendee, sub, kUpb_MiniTablePlatform_Native, arena, status); |
| 3204 | } |
| 3205 | |
| 3206 | // Like upb_MiniTable_Build(), but the user provides a buffer of layout data so |
| 3207 | // it can be reused from call to call, avoiding repeated realloc()/free(). |
| 3208 | // |
| 3209 | // The caller owns `*buf` both before and after the call, and must free() it |
| 3210 | // when it is no longer in use. The function will realloc() `*buf` as |
| 3211 | // necessary, updating `*size` accordingly. |
| 3212 | upb_MiniTable* upb_MiniTable_BuildWithBuf(const char* data, size_t len, |
| 3213 | upb_MiniTablePlatform platform, |
| 3214 | upb_Arena* arena, void** buf, |
| 3215 | size_t* buf_size, upb_Status* status); |
| 3216 | |
| 3217 | #ifdef __cplusplus |
| 3218 | } /* extern "C" */ |
| 3219 | #endif |
| 3220 | |
| 3221 | |
| 3222 | #endif /* UPB_MINI_TABLE_DECODE_H_ */ |
| 3223 | |
| 3224 | #ifndef UPB_MINI_TABLE_FILE_H_ |
| 3225 | #define UPB_MINI_TABLE_FILE_H_ |
| 3226 | |
| 3227 | |
| 3228 | #ifndef UPB_MINI_TABLE_INTERNAL_FILE_H_ |
| 3229 | #define UPB_MINI_TABLE_INTERNAL_FILE_H_ |
| 3230 | |
| 3231 | |
| 3232 | // Must be last. |
| 3233 | |
| 3234 | struct upb_MiniTableFile { |
Sandy Zhang | e3b0943 | 2023-08-07 09:30:02 -0700 | [diff] [blame] | 3235 | const struct upb_MiniTable** msgs; |
| 3236 | const struct upb_MiniTableEnum** enums; |
| 3237 | const struct upb_MiniTableExtension** exts; |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 3238 | int msg_count; |
| 3239 | int enum_count; |
| 3240 | int ext_count; |
| 3241 | }; |
| 3242 | |
| 3243 | |
| 3244 | #endif /* UPB_MINI_TABLE_INTERNAL_FILE_H_ */ |
| 3245 | |
| 3246 | typedef struct upb_MiniTableFile upb_MiniTableFile; |
| 3247 | |
| 3248 | #endif /* UPB_MINI_TABLE_FILE_H_ */ |
| 3249 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 3250 | // upb_decode: parsing into a upb_Message using a upb_MiniTable. |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3251 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 3252 | #ifndef UPB_WIRE_DECODE_H_ |
| 3253 | #define UPB_WIRE_DECODE_H_ |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3254 | |
Protobuf Team Bot | 743bf92 | 2023-09-14 01:12:11 +0000 | [diff] [blame] | 3255 | #include <stddef.h> |
| 3256 | #include <stdint.h> |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3257 | |
Adam Cozzette | 7d5592e | 2023-08-23 12:15:26 -0700 | [diff] [blame] | 3258 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3259 | // Must be last. |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3260 | |
| 3261 | #ifdef __cplusplus |
| 3262 | extern "C" { |
| 3263 | #endif |
| 3264 | |
| 3265 | enum { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3266 | /* If set, strings will alias the input buffer instead of copying into the |
| 3267 | * arena. */ |
| 3268 | kUpb_DecodeOption_AliasString = 1, |
| 3269 | |
| 3270 | /* If set, the parse will return failure if any message is missing any |
| 3271 | * required fields when the message data ends. The parse will still continue, |
| 3272 | * and the failure will only be reported at the end. |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3273 | * |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3274 | * IMPORTANT CAVEATS: |
| 3275 | * |
| 3276 | * 1. This can throw a false positive failure if an incomplete message is seen |
| 3277 | * on the wire but is later completed when the sub-message occurs again. |
| 3278 | * For this reason, a second pass is required to verify a failure, to be |
| 3279 | * truly robust. |
| 3280 | * |
| 3281 | * 2. This can return a false success if you are decoding into a message that |
| 3282 | * already has some sub-message fields present. If the sub-message does |
| 3283 | * not occur in the binary payload, we will never visit it and discover the |
| 3284 | * incomplete sub-message. For this reason, this check is only useful for |
| 3285 | * implemting ParseFromString() semantics. For MergeFromString(), a |
| 3286 | * post-parse validation step will always be necessary. */ |
| 3287 | kUpb_DecodeOption_CheckRequired = 2, |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 3288 | |
| 3289 | /* EXPERIMENTAL: |
| 3290 | * |
| 3291 | * If set, the parser will allow parsing of sub-message fields that were not |
| 3292 | * previously linked using upb_MiniTable_SetSubMessage(). The data will be |
| 3293 | * parsed into an internal "empty" message type that cannot be accessed |
| 3294 | * directly, but can be later promoted into the true message type if the |
| 3295 | * sub-message fields are linked at a later time. |
| 3296 | * |
| 3297 | * Users should set this option if they intend to perform dynamic tree shaking |
| 3298 | * and promoting using the interfaces in message/promote.h. If this option is |
| 3299 | * enabled, it is important that the resulting messages are only accessed by |
| 3300 | * code that is aware of promotion rules: |
| 3301 | * |
| 3302 | * 1. Message pointers in upb_Message, upb_Array, and upb_Map are represented |
| 3303 | * by a tagged pointer upb_TaggedMessagePointer. The tag indicates whether |
| 3304 | * the message uses the internal "empty" type. |
| 3305 | * |
| 3306 | * 2. Any code *reading* these message pointers must test whether the "empty" |
| 3307 | * tag bit is set, using the interfaces in mini_table/types.h. However |
| 3308 | * writing of message pointers should always use plain upb_Message*, since |
| 3309 | * users are not allowed to create "empty" messages. |
| 3310 | * |
| 3311 | * 3. It is always safe to test whether a field is present or test the array |
| 3312 | * length; these interfaces will reflect that empty messages are present, |
| 3313 | * even though their data cannot be accessed without promoting first. |
| 3314 | * |
| 3315 | * 4. If a message pointer is indeed tagged as empty, the message may not be |
| 3316 | * accessed directly, only promoted through the interfaces in |
| 3317 | * message/promote.h. |
| 3318 | * |
| 3319 | * 5. Tagged/empty messages may never be created by the user. They may only |
| 3320 | * be created by the parser or the message-copying logic in message/copy.h. |
| 3321 | */ |
| 3322 | kUpb_DecodeOption_ExperimentalAllowUnlinked = 4, |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3323 | }; |
| 3324 | |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 3325 | UPB_INLINE uint32_t upb_DecodeOptions_MaxDepth(uint16_t depth) { |
| 3326 | return (uint32_t)depth << 16; |
| 3327 | } |
| 3328 | |
| 3329 | UPB_INLINE uint16_t upb_DecodeOptions_GetMaxDepth(uint32_t options) { |
| 3330 | return options >> 16; |
| 3331 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3332 | |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 3333 | // Enforce an upper bound on recursion depth. |
| 3334 | 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] | 3335 | uint32_t max_depth = upb_DecodeOptions_GetMaxDepth(decode_options); |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 3336 | if (max_depth > limit) max_depth = limit; |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 3337 | return upb_DecodeOptions_MaxDepth(max_depth) | (decode_options & 0xffff); |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 3338 | } |
| 3339 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3340 | typedef enum { |
| 3341 | kUpb_DecodeStatus_Ok = 0, |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 3342 | kUpb_DecodeStatus_Malformed = 1, // Wire format was corrupt |
| 3343 | kUpb_DecodeStatus_OutOfMemory = 2, // Arena alloc failed |
| 3344 | kUpb_DecodeStatus_BadUtf8 = 3, // String field had bad UTF-8 |
| 3345 | kUpb_DecodeStatus_MaxDepthExceeded = |
| 3346 | 4, // Exceeded upb_DecodeOptions_MaxDepth |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3347 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3348 | // kUpb_DecodeOption_CheckRequired failed (see above), but the parse otherwise |
| 3349 | // succeeded. |
| 3350 | kUpb_DecodeStatus_MissingRequired = 5, |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 3351 | |
| 3352 | // Unlinked sub-message field was present, but |
| 3353 | // kUpb_DecodeOptions_ExperimentalAllowUnlinked was not specified in the list |
| 3354 | // of options. |
| 3355 | kUpb_DecodeStatus_UnlinkedSubMessage = 6, |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3356 | } upb_DecodeStatus; |
| 3357 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 3358 | UPB_API upb_DecodeStatus upb_Decode(const char* buf, size_t size, |
| 3359 | upb_Message* msg, const upb_MiniTable* l, |
| 3360 | const upb_ExtensionRegistry* extreg, |
| 3361 | int options, upb_Arena* arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3362 | |
| 3363 | #ifdef __cplusplus |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 3364 | } /* extern "C" */ |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3365 | #endif |
| 3366 | |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 3367 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 3368 | #endif /* UPB_WIRE_DECODE_H_ */ |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3369 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3370 | // These are the specialized field parser functions for the fast parser. |
| 3371 | // Generated tables will refer to these by name. |
| 3372 | // |
| 3373 | // The function names are encoded with names like: |
| 3374 | // |
| 3375 | // // 123 4 |
| 3376 | // upb_pss_1bt(); // Parse singular string, 1 byte tag. |
| 3377 | // |
| 3378 | // In position 1: |
| 3379 | // - 'p' for parse, most function use this |
| 3380 | // - 'c' for copy, for when we are copying strings instead of aliasing |
| 3381 | // |
| 3382 | // In position 2 (cardinality): |
| 3383 | // - 's' for singular, with or without hasbit |
| 3384 | // - 'o' for oneof |
| 3385 | // - 'r' for non-packed repeated |
| 3386 | // - 'p' for packed repeated |
| 3387 | // |
| 3388 | // In position 3 (type): |
| 3389 | // - 'b1' for bool |
| 3390 | // - 'v4' for 4-byte varint |
| 3391 | // - 'v8' for 8-byte varint |
| 3392 | // - 'z4' for zig-zag-encoded 4-byte varint |
| 3393 | // - 'z8' for zig-zag-encoded 8-byte varint |
| 3394 | // - 'f4' for 4-byte fixed |
| 3395 | // - 'f8' for 8-byte fixed |
| 3396 | // - 'm' for sub-message |
| 3397 | // - 's' for string (validate UTF-8) |
| 3398 | // - 'b' for bytes |
| 3399 | // |
| 3400 | // In position 4 (tag length): |
| 3401 | // - '1' for one-byte tags (field numbers 1-15) |
| 3402 | // - '2' for two-byte tags (field numbers 16-2048) |
| 3403 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 3404 | #ifndef UPB_WIRE_DECODE_FAST_H_ |
| 3405 | #define UPB_WIRE_DECODE_FAST_H_ |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3406 | |
| 3407 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3408 | // Must be last. |
| 3409 | |
| 3410 | #ifdef __cplusplus |
| 3411 | extern "C" { |
| 3412 | #endif |
| 3413 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 3414 | struct upb_Decoder; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3415 | |
| 3416 | // The fallback, generic parsing function that can handle any field type. |
| 3417 | // 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] | 3418 | const char* _upb_FastDecoder_DecodeGeneric(struct upb_Decoder* d, |
| 3419 | const char* ptr, upb_Message* msg, |
| 3420 | intptr_t table, uint64_t hasbits, |
| 3421 | uint64_t data); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3422 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 3423 | #define UPB_PARSE_PARAMS \ |
| 3424 | 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] | 3425 | uint64_t hasbits, uint64_t data |
| 3426 | |
| 3427 | /* primitive fields ***********************************************************/ |
| 3428 | |
| 3429 | #define F(card, type, valbytes, tagbytes) \ |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 3430 | const char* upb_p##card##type##valbytes##_##tagbytes##bt(UPB_PARSE_PARAMS); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3431 | |
| 3432 | #define TYPES(card, tagbytes) \ |
| 3433 | F(card, b, 1, tagbytes) \ |
| 3434 | F(card, v, 4, tagbytes) \ |
| 3435 | F(card, v, 8, tagbytes) \ |
| 3436 | F(card, z, 4, tagbytes) \ |
| 3437 | F(card, z, 8, tagbytes) \ |
| 3438 | F(card, f, 4, tagbytes) \ |
| 3439 | F(card, f, 8, tagbytes) |
| 3440 | |
| 3441 | #define TAGBYTES(card) \ |
| 3442 | TYPES(card, 1) \ |
| 3443 | TYPES(card, 2) |
| 3444 | |
| 3445 | TAGBYTES(s) |
| 3446 | TAGBYTES(o) |
| 3447 | TAGBYTES(r) |
| 3448 | TAGBYTES(p) |
| 3449 | |
| 3450 | #undef F |
| 3451 | #undef TYPES |
| 3452 | #undef TAGBYTES |
| 3453 | |
| 3454 | /* string fields **************************************************************/ |
| 3455 | |
| 3456 | #define F(card, tagbytes, type) \ |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 3457 | const char* upb_p##card##type##_##tagbytes##bt(UPB_PARSE_PARAMS); \ |
| 3458 | const char* upb_c##card##type##_##tagbytes##bt(UPB_PARSE_PARAMS); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3459 | |
| 3460 | #define UTF8(card, tagbytes) \ |
| 3461 | F(card, tagbytes, s) \ |
| 3462 | F(card, tagbytes, b) |
| 3463 | |
| 3464 | #define TAGBYTES(card) \ |
| 3465 | UTF8(card, 1) \ |
| 3466 | UTF8(card, 2) |
| 3467 | |
| 3468 | TAGBYTES(s) |
| 3469 | TAGBYTES(o) |
| 3470 | TAGBYTES(r) |
| 3471 | |
| 3472 | #undef F |
| 3473 | #undef TAGBYTES |
| 3474 | |
| 3475 | /* sub-message fields *********************************************************/ |
| 3476 | |
| 3477 | #define F(card, tagbytes, size_ceil, ceil_arg) \ |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 3478 | 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] | 3479 | |
| 3480 | #define SIZES(card, tagbytes) \ |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 3481 | F(card, tagbytes, 64, 64) \ |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3482 | F(card, tagbytes, 128, 128) \ |
| 3483 | F(card, tagbytes, 192, 192) \ |
| 3484 | F(card, tagbytes, 256, 256) \ |
| 3485 | F(card, tagbytes, max, -1) |
| 3486 | |
| 3487 | #define TAGBYTES(card) \ |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 3488 | SIZES(card, 1) \ |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3489 | SIZES(card, 2) |
| 3490 | |
| 3491 | TAGBYTES(s) |
| 3492 | TAGBYTES(o) |
| 3493 | TAGBYTES(r) |
| 3494 | |
| 3495 | #undef TAGBYTES |
| 3496 | #undef SIZES |
| 3497 | #undef F |
| 3498 | |
| 3499 | #undef UPB_PARSE_PARAMS |
| 3500 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3501 | #ifdef __cplusplus |
| 3502 | } /* extern "C" */ |
| 3503 | #endif |
| 3504 | |
| 3505 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 3506 | #endif /* UPB_WIRE_DECODE_FAST_H_ */ |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 3507 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 3508 | // upb_Encode: parsing from a upb_Message using a upb_MiniTable. |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3509 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 3510 | #ifndef UPB_WIRE_ENCODE_H_ |
| 3511 | #define UPB_WIRE_ENCODE_H_ |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3512 | |
Protobuf Team Bot | 743bf92 | 2023-09-14 01:12:11 +0000 | [diff] [blame] | 3513 | #include <stddef.h> |
| 3514 | #include <stdint.h> |
| 3515 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3516 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3517 | // Must be last. |
| 3518 | |
| 3519 | #ifdef __cplusplus |
| 3520 | extern "C" { |
| 3521 | #endif |
| 3522 | |
| 3523 | enum { |
| 3524 | /* If set, the results of serializing will be deterministic across all |
| 3525 | * instances of this binary. There are no guarantees across different |
| 3526 | * binary builds. |
| 3527 | * |
| 3528 | * If your proto contains maps, the encoder will need to malloc()/free() |
| 3529 | * memory during encode. */ |
| 3530 | kUpb_EncodeOption_Deterministic = 1, |
| 3531 | |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 3532 | // When set, unknown fields are not printed. |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3533 | kUpb_EncodeOption_SkipUnknown = 2, |
| 3534 | |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 3535 | // When set, the encode will fail if any required fields are missing. |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3536 | kUpb_EncodeOption_CheckRequired = 4, |
| 3537 | }; |
| 3538 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3539 | typedef enum { |
| 3540 | kUpb_EncodeStatus_Ok = 0, |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 3541 | kUpb_EncodeStatus_OutOfMemory = 1, // Arena alloc failed |
| 3542 | kUpb_EncodeStatus_MaxDepthExceeded = 2, |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3543 | |
| 3544 | // kUpb_EncodeOption_CheckRequired failed but the parse otherwise succeeded. |
| 3545 | kUpb_EncodeStatus_MissingRequired = 3, |
| 3546 | } upb_EncodeStatus; |
| 3547 | |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 3548 | UPB_INLINE uint32_t upb_EncodeOptions_MaxDepth(uint16_t depth) { |
| 3549 | return (uint32_t)depth << 16; |
| 3550 | } |
| 3551 | |
| 3552 | UPB_INLINE uint16_t upb_EncodeOptions_GetMaxDepth(uint32_t options) { |
| 3553 | return options >> 16; |
| 3554 | } |
| 3555 | |
| 3556 | // Enforce an upper bound on recursion depth. |
| 3557 | UPB_INLINE int upb_Encode_LimitDepth(uint32_t encode_options, uint32_t limit) { |
| 3558 | uint32_t max_depth = upb_EncodeOptions_GetMaxDepth(encode_options); |
| 3559 | if (max_depth > limit) max_depth = limit; |
| 3560 | return upb_EncodeOptions_MaxDepth(max_depth) | (encode_options & 0xffff); |
| 3561 | } |
| 3562 | |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 3563 | UPB_API upb_EncodeStatus upb_Encode(const void* msg, const upb_MiniTable* l, |
| 3564 | int options, upb_Arena* arena, char** buf, |
| 3565 | size_t* size); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3566 | |
| 3567 | #ifdef __cplusplus |
| 3568 | } /* extern "C" */ |
| 3569 | #endif |
| 3570 | |
| 3571 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 3572 | #endif /* UPB_WIRE_ENCODE_H_ */ |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 3573 | // IWYU pragma: end_exports |
| 3574 | |
| 3575 | #endif // UPB_GENERATED_CODE_SUPPORT_H_ |
Protobuf Team Bot | 0cb912c | 2023-09-28 20:14:04 +0000 | [diff] [blame] | 3576 | /* This file was generated by upb_generator from the input file: |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 3577 | * |
| 3578 | * google/protobuf/descriptor.proto |
| 3579 | * |
| 3580 | * Do not edit -- your changes will be discarded when the file is |
| 3581 | * regenerated. */ |
| 3582 | |
Protobuf Team Bot | d11eb71 | 2023-09-15 00:25:33 +0000 | [diff] [blame] | 3583 | #ifndef GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_MINITABLE_H_ |
| 3584 | #define GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_MINITABLE_H_ |
| 3585 | |
| 3586 | |
| 3587 | // Must be last. |
| 3588 | |
| 3589 | #ifdef __cplusplus |
| 3590 | extern "C" { |
| 3591 | #endif |
| 3592 | |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 3593 | extern const upb_MiniTable google__protobuf__FileDescriptorSet_msg_init; |
| 3594 | extern const upb_MiniTable google__protobuf__FileDescriptorProto_msg_init; |
| 3595 | extern const upb_MiniTable google__protobuf__DescriptorProto_msg_init; |
| 3596 | extern const upb_MiniTable google__protobuf__DescriptorProto__ExtensionRange_msg_init; |
| 3597 | extern const upb_MiniTable google__protobuf__DescriptorProto__ReservedRange_msg_init; |
| 3598 | extern const upb_MiniTable google__protobuf__ExtensionRangeOptions_msg_init; |
| 3599 | extern const upb_MiniTable google__protobuf__ExtensionRangeOptions__Declaration_msg_init; |
| 3600 | extern const upb_MiniTable google__protobuf__FieldDescriptorProto_msg_init; |
| 3601 | extern const upb_MiniTable google__protobuf__OneofDescriptorProto_msg_init; |
| 3602 | extern const upb_MiniTable google__protobuf__EnumDescriptorProto_msg_init; |
| 3603 | extern const upb_MiniTable google__protobuf__EnumDescriptorProto__EnumReservedRange_msg_init; |
| 3604 | extern const upb_MiniTable google__protobuf__EnumValueDescriptorProto_msg_init; |
| 3605 | extern const upb_MiniTable google__protobuf__ServiceDescriptorProto_msg_init; |
| 3606 | extern const upb_MiniTable google__protobuf__MethodDescriptorProto_msg_init; |
| 3607 | extern const upb_MiniTable google__protobuf__FileOptions_msg_init; |
| 3608 | extern const upb_MiniTable google__protobuf__MessageOptions_msg_init; |
| 3609 | extern const upb_MiniTable google__protobuf__FieldOptions_msg_init; |
| 3610 | extern const upb_MiniTable google__protobuf__FieldOptions__EditionDefault_msg_init; |
| 3611 | extern const upb_MiniTable google__protobuf__OneofOptions_msg_init; |
| 3612 | extern const upb_MiniTable google__protobuf__EnumOptions_msg_init; |
| 3613 | extern const upb_MiniTable google__protobuf__EnumValueOptions_msg_init; |
| 3614 | extern const upb_MiniTable google__protobuf__ServiceOptions_msg_init; |
| 3615 | extern const upb_MiniTable google__protobuf__MethodOptions_msg_init; |
| 3616 | extern const upb_MiniTable google__protobuf__UninterpretedOption_msg_init; |
| 3617 | extern const upb_MiniTable google__protobuf__UninterpretedOption__NamePart_msg_init; |
| 3618 | extern const upb_MiniTable google__protobuf__FeatureSet_msg_init; |
| 3619 | extern const upb_MiniTable google__protobuf__FeatureSetDefaults_msg_init; |
| 3620 | extern const upb_MiniTable google__protobuf__FeatureSetDefaults__FeatureSetEditionDefault_msg_init; |
| 3621 | extern const upb_MiniTable google__protobuf__SourceCodeInfo_msg_init; |
| 3622 | extern const upb_MiniTable google__protobuf__SourceCodeInfo__Location_msg_init; |
| 3623 | extern const upb_MiniTable google__protobuf__GeneratedCodeInfo_msg_init; |
| 3624 | extern const upb_MiniTable google__protobuf__GeneratedCodeInfo__Annotation_msg_init; |
Protobuf Team Bot | d11eb71 | 2023-09-15 00:25:33 +0000 | [diff] [blame] | 3625 | |
| 3626 | extern const upb_MiniTableEnum google_protobuf_Edition_enum_init; |
| 3627 | extern const upb_MiniTableEnum google_protobuf_ExtensionRangeOptions_VerificationState_enum_init; |
| 3628 | extern const upb_MiniTableEnum google_protobuf_FeatureSet_EnumType_enum_init; |
| 3629 | extern const upb_MiniTableEnum google_protobuf_FeatureSet_FieldPresence_enum_init; |
| 3630 | extern const upb_MiniTableEnum google_protobuf_FeatureSet_JsonFormat_enum_init; |
| 3631 | extern const upb_MiniTableEnum google_protobuf_FeatureSet_MessageEncoding_enum_init; |
| 3632 | extern const upb_MiniTableEnum google_protobuf_FeatureSet_RepeatedFieldEncoding_enum_init; |
Protobuf Team Bot | 6112795 | 2023-09-26 20:07:33 +0000 | [diff] [blame] | 3633 | extern const upb_MiniTableEnum google_protobuf_FeatureSet_Utf8Validation_enum_init; |
Protobuf Team Bot | d11eb71 | 2023-09-15 00:25:33 +0000 | [diff] [blame] | 3634 | extern const upb_MiniTableEnum google_protobuf_FieldDescriptorProto_Label_enum_init; |
| 3635 | extern const upb_MiniTableEnum google_protobuf_FieldDescriptorProto_Type_enum_init; |
| 3636 | extern const upb_MiniTableEnum google_protobuf_FieldOptions_CType_enum_init; |
| 3637 | extern const upb_MiniTableEnum google_protobuf_FieldOptions_JSType_enum_init; |
| 3638 | extern const upb_MiniTableEnum google_protobuf_FieldOptions_OptionRetention_enum_init; |
| 3639 | extern const upb_MiniTableEnum google_protobuf_FieldOptions_OptionTargetType_enum_init; |
| 3640 | extern const upb_MiniTableEnum google_protobuf_FileOptions_OptimizeMode_enum_init; |
| 3641 | extern const upb_MiniTableEnum google_protobuf_GeneratedCodeInfo_Annotation_Semantic_enum_init; |
| 3642 | extern const upb_MiniTableEnum google_protobuf_MethodOptions_IdempotencyLevel_enum_init; |
| 3643 | extern const upb_MiniTableFile google_protobuf_descriptor_proto_upb_file_layout; |
| 3644 | |
| 3645 | #ifdef __cplusplus |
| 3646 | } /* extern "C" */ |
| 3647 | #endif |
| 3648 | |
| 3649 | |
| 3650 | #endif /* GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_MINITABLE_H_ */ |
| 3651 | |
| 3652 | #ifndef UPB_WIRE_EPS_COPY_INPUT_STREAM_H_ |
| 3653 | #define UPB_WIRE_EPS_COPY_INPUT_STREAM_H_ |
| 3654 | |
| 3655 | #include <string.h> |
| 3656 | |
| 3657 | |
| 3658 | // Must be last. |
| 3659 | |
| 3660 | #ifdef __cplusplus |
| 3661 | extern "C" { |
| 3662 | #endif |
| 3663 | |
| 3664 | // The maximum number of bytes a single protobuf field can take up in the |
| 3665 | // wire format. We only want to do one bounds check per field, so the input |
| 3666 | // stream guarantees that after upb_EpsCopyInputStream_IsDone() is called, |
| 3667 | // the decoder can read this many bytes without performing another bounds |
| 3668 | // check. The stream will copy into a patch buffer as necessary to guarantee |
| 3669 | // this invariant. |
| 3670 | #define kUpb_EpsCopyInputStream_SlopBytes 16 |
| 3671 | |
| 3672 | enum { |
| 3673 | kUpb_EpsCopyInputStream_NoAliasing = 0, |
| 3674 | kUpb_EpsCopyInputStream_OnPatch = 1, |
| 3675 | kUpb_EpsCopyInputStream_NoDelta = 2 |
| 3676 | }; |
| 3677 | |
| 3678 | typedef struct { |
| 3679 | const char* end; // Can read up to SlopBytes bytes beyond this. |
| 3680 | const char* limit_ptr; // For bounds checks, = end + UPB_MIN(limit, 0) |
| 3681 | uintptr_t aliasing; |
| 3682 | int limit; // Submessage limit relative to end |
| 3683 | bool error; // To distinguish between EOF and error. |
| 3684 | char patch[kUpb_EpsCopyInputStream_SlopBytes * 2]; |
| 3685 | } upb_EpsCopyInputStream; |
| 3686 | |
| 3687 | // Returns true if the stream is in the error state. A stream enters the error |
| 3688 | // state when the user reads past a limit (caught in IsDone()) or the |
| 3689 | // ZeroCopyInputStream returns an error. |
| 3690 | UPB_INLINE bool upb_EpsCopyInputStream_IsError(upb_EpsCopyInputStream* e) { |
| 3691 | return e->error; |
| 3692 | } |
| 3693 | |
| 3694 | typedef const char* upb_EpsCopyInputStream_BufferFlipCallback( |
| 3695 | upb_EpsCopyInputStream* e, const char* old_end, const char* new_start); |
| 3696 | |
| 3697 | typedef const char* upb_EpsCopyInputStream_IsDoneFallbackFunc( |
| 3698 | upb_EpsCopyInputStream* e, const char* ptr, int overrun); |
| 3699 | |
| 3700 | // Initializes a upb_EpsCopyInputStream using the contents of the buffer |
| 3701 | // [*ptr, size]. Updates `*ptr` as necessary to guarantee that at least |
| 3702 | // kUpb_EpsCopyInputStream_SlopBytes are available to read. |
| 3703 | UPB_INLINE void upb_EpsCopyInputStream_Init(upb_EpsCopyInputStream* e, |
| 3704 | const char** ptr, size_t size, |
| 3705 | bool enable_aliasing) { |
| 3706 | if (size <= kUpb_EpsCopyInputStream_SlopBytes) { |
| 3707 | memset(&e->patch, 0, 32); |
| 3708 | if (size) memcpy(&e->patch, *ptr, size); |
| 3709 | e->aliasing = enable_aliasing ? (uintptr_t)*ptr - (uintptr_t)e->patch |
| 3710 | : kUpb_EpsCopyInputStream_NoAliasing; |
| 3711 | *ptr = e->patch; |
| 3712 | e->end = *ptr + size; |
| 3713 | e->limit = 0; |
| 3714 | } else { |
| 3715 | e->end = *ptr + size - kUpb_EpsCopyInputStream_SlopBytes; |
| 3716 | e->limit = kUpb_EpsCopyInputStream_SlopBytes; |
| 3717 | e->aliasing = enable_aliasing ? kUpb_EpsCopyInputStream_NoDelta |
| 3718 | : kUpb_EpsCopyInputStream_NoAliasing; |
| 3719 | } |
| 3720 | e->limit_ptr = e->end; |
| 3721 | e->error = false; |
| 3722 | } |
| 3723 | |
| 3724 | typedef enum { |
| 3725 | // The current stream position is at a limit. |
| 3726 | kUpb_IsDoneStatus_Done, |
| 3727 | |
| 3728 | // The current stream position is not at a limit. |
| 3729 | kUpb_IsDoneStatus_NotDone, |
| 3730 | |
| 3731 | // The current stream position is not at a limit, and the stream needs to |
| 3732 | // be flipped to a new buffer before more data can be read. |
| 3733 | kUpb_IsDoneStatus_NeedFallback, |
| 3734 | } upb_IsDoneStatus; |
| 3735 | |
| 3736 | // Returns the status of the current stream position. This is a low-level |
| 3737 | // function, it is simpler to call upb_EpsCopyInputStream_IsDone() if possible. |
| 3738 | UPB_INLINE upb_IsDoneStatus upb_EpsCopyInputStream_IsDoneStatus( |
| 3739 | upb_EpsCopyInputStream* e, const char* ptr, int* overrun) { |
| 3740 | *overrun = ptr - e->end; |
| 3741 | if (UPB_LIKELY(ptr < e->limit_ptr)) { |
| 3742 | return kUpb_IsDoneStatus_NotDone; |
| 3743 | } else if (UPB_LIKELY(*overrun == e->limit)) { |
| 3744 | return kUpb_IsDoneStatus_Done; |
| 3745 | } else { |
| 3746 | return kUpb_IsDoneStatus_NeedFallback; |
| 3747 | } |
| 3748 | } |
| 3749 | |
| 3750 | // Returns true if the stream has hit a limit, either the current delimited |
| 3751 | // limit or the overall end-of-stream. As a side effect, this function may flip |
| 3752 | // the pointer to a new buffer if there are less than |
| 3753 | // kUpb_EpsCopyInputStream_SlopBytes of data to be read in the current buffer. |
| 3754 | // |
| 3755 | // Postcondition: if the function returns false, there are at least |
| 3756 | // kUpb_EpsCopyInputStream_SlopBytes of data available to read at *ptr. |
| 3757 | UPB_INLINE bool upb_EpsCopyInputStream_IsDoneWithCallback( |
| 3758 | upb_EpsCopyInputStream* e, const char** ptr, |
| 3759 | upb_EpsCopyInputStream_IsDoneFallbackFunc* func) { |
| 3760 | int overrun; |
| 3761 | switch (upb_EpsCopyInputStream_IsDoneStatus(e, *ptr, &overrun)) { |
| 3762 | case kUpb_IsDoneStatus_Done: |
| 3763 | return true; |
| 3764 | case kUpb_IsDoneStatus_NotDone: |
| 3765 | return false; |
| 3766 | case kUpb_IsDoneStatus_NeedFallback: |
| 3767 | *ptr = func(e, *ptr, overrun); |
| 3768 | return *ptr == NULL; |
| 3769 | } |
| 3770 | UPB_UNREACHABLE(); |
| 3771 | } |
| 3772 | |
| 3773 | const char* _upb_EpsCopyInputStream_IsDoneFallbackNoCallback( |
| 3774 | upb_EpsCopyInputStream* e, const char* ptr, int overrun); |
| 3775 | |
| 3776 | // A simpler version of IsDoneWithCallback() that does not support a buffer flip |
| 3777 | // callback. Useful in cases where we do not need to insert custom logic at |
| 3778 | // every buffer flip. |
| 3779 | // |
| 3780 | // If this returns true, the user must call upb_EpsCopyInputStream_IsError() |
| 3781 | // to distinguish between EOF and error. |
| 3782 | UPB_INLINE bool upb_EpsCopyInputStream_IsDone(upb_EpsCopyInputStream* e, |
| 3783 | const char** ptr) { |
| 3784 | return upb_EpsCopyInputStream_IsDoneWithCallback( |
| 3785 | e, ptr, _upb_EpsCopyInputStream_IsDoneFallbackNoCallback); |
| 3786 | } |
| 3787 | |
| 3788 | // Returns the total number of bytes that are safe to read from the current |
| 3789 | // buffer without reading uninitialized or unallocated memory. |
| 3790 | // |
| 3791 | // Note that this check does not respect any semantic limits on the stream, |
| 3792 | // either limits from PushLimit() or the overall stream end, so some of these |
| 3793 | // bytes may have unpredictable, nonsense values in them. The guarantee is only |
| 3794 | // that the bytes are valid to read from the perspective of the C language |
| 3795 | // (ie. you can read without triggering UBSAN or ASAN). |
| 3796 | UPB_INLINE size_t upb_EpsCopyInputStream_BytesAvailable( |
| 3797 | upb_EpsCopyInputStream* e, const char* ptr) { |
| 3798 | return (e->end - ptr) + kUpb_EpsCopyInputStream_SlopBytes; |
| 3799 | } |
| 3800 | |
| 3801 | // Returns true if the given delimited field size is valid (it does not extend |
| 3802 | // beyond any previously-pushed limits). `ptr` should point to the beginning |
| 3803 | // of the field data, after the delimited size. |
| 3804 | // |
| 3805 | // Note that this does *not* guarantee that all of the data for this field is in |
| 3806 | // the current buffer. |
| 3807 | UPB_INLINE bool upb_EpsCopyInputStream_CheckSize( |
| 3808 | const upb_EpsCopyInputStream* e, const char* ptr, int size) { |
| 3809 | UPB_ASSERT(size >= 0); |
| 3810 | return ptr - e->end + size <= e->limit; |
| 3811 | } |
| 3812 | |
| 3813 | UPB_INLINE bool _upb_EpsCopyInputStream_CheckSizeAvailable( |
| 3814 | upb_EpsCopyInputStream* e, const char* ptr, int size, bool submessage) { |
| 3815 | // This is one extra branch compared to the more normal: |
| 3816 | // return (size_t)(end - ptr) < size; |
| 3817 | // However it is one less computation if we are just about to use "ptr + len": |
| 3818 | // https://godbolt.org/z/35YGPz |
| 3819 | // In microbenchmarks this shows a small improvement. |
| 3820 | uintptr_t uptr = (uintptr_t)ptr; |
| 3821 | uintptr_t uend = (uintptr_t)e->limit_ptr; |
| 3822 | uintptr_t res = uptr + (size_t)size; |
| 3823 | if (!submessage) uend += kUpb_EpsCopyInputStream_SlopBytes; |
| 3824 | // NOTE: this check depends on having a linear address space. This is not |
| 3825 | // technically guaranteed by uintptr_t. |
| 3826 | bool ret = res >= uptr && res <= uend; |
| 3827 | if (size < 0) UPB_ASSERT(!ret); |
| 3828 | return ret; |
| 3829 | } |
| 3830 | |
| 3831 | // Returns true if the given delimited field size is valid (it does not extend |
| 3832 | // beyond any previously-pushed limited) *and* all of the data for this field is |
| 3833 | // available to be read in the current buffer. |
| 3834 | // |
| 3835 | // If the size is negative, this function will always return false. This |
| 3836 | // property can be useful in some cases. |
| 3837 | UPB_INLINE bool upb_EpsCopyInputStream_CheckDataSizeAvailable( |
| 3838 | upb_EpsCopyInputStream* e, const char* ptr, int size) { |
| 3839 | return _upb_EpsCopyInputStream_CheckSizeAvailable(e, ptr, size, false); |
| 3840 | } |
| 3841 | |
| 3842 | // Returns true if the given sub-message size is valid (it does not extend |
| 3843 | // beyond any previously-pushed limited) *and* all of the data for this |
| 3844 | // sub-message is available to be parsed in the current buffer. |
| 3845 | // |
| 3846 | // This implies that all fields from the sub-message can be parsed from the |
| 3847 | // current buffer while maintaining the invariant that we always have at least |
| 3848 | // kUpb_EpsCopyInputStream_SlopBytes of data available past the beginning of |
| 3849 | // any individual field start. |
| 3850 | // |
| 3851 | // If the size is negative, this function will always return false. This |
| 3852 | // property can be useful in some cases. |
| 3853 | UPB_INLINE bool upb_EpsCopyInputStream_CheckSubMessageSizeAvailable( |
| 3854 | upb_EpsCopyInputStream* e, const char* ptr, int size) { |
| 3855 | return _upb_EpsCopyInputStream_CheckSizeAvailable(e, ptr, size, true); |
| 3856 | } |
| 3857 | |
| 3858 | // Returns true if aliasing_enabled=true was passed to |
| 3859 | // upb_EpsCopyInputStream_Init() when this stream was initialized. |
| 3860 | UPB_INLINE bool upb_EpsCopyInputStream_AliasingEnabled( |
| 3861 | upb_EpsCopyInputStream* e) { |
| 3862 | return e->aliasing != kUpb_EpsCopyInputStream_NoAliasing; |
| 3863 | } |
| 3864 | |
| 3865 | // Returns true if aliasing_enabled=true was passed to |
| 3866 | // upb_EpsCopyInputStream_Init() when this stream was initialized *and* we can |
| 3867 | // alias into the region [ptr, size] in an input buffer. |
| 3868 | UPB_INLINE bool upb_EpsCopyInputStream_AliasingAvailable( |
| 3869 | upb_EpsCopyInputStream* e, const char* ptr, size_t size) { |
| 3870 | // When EpsCopyInputStream supports streaming, this will need to become a |
| 3871 | // runtime check. |
| 3872 | return upb_EpsCopyInputStream_CheckDataSizeAvailable(e, ptr, size) && |
| 3873 | e->aliasing >= kUpb_EpsCopyInputStream_NoDelta; |
| 3874 | } |
| 3875 | |
| 3876 | // Returns a pointer into an input buffer that corresponds to the parsing |
| 3877 | // pointer `ptr`. The returned pointer may be the same as `ptr`, but also may |
| 3878 | // be different if we are currently parsing out of the patch buffer. |
| 3879 | // |
| 3880 | // REQUIRES: Aliasing must be available for the given pointer. If the input is a |
| 3881 | // flat buffer and aliasing is enabled, then aliasing will always be available. |
| 3882 | UPB_INLINE const char* upb_EpsCopyInputStream_GetAliasedPtr( |
| 3883 | upb_EpsCopyInputStream* e, const char* ptr) { |
| 3884 | UPB_ASSUME(upb_EpsCopyInputStream_AliasingAvailable(e, ptr, 0)); |
| 3885 | uintptr_t delta = |
| 3886 | e->aliasing == kUpb_EpsCopyInputStream_NoDelta ? 0 : e->aliasing; |
| 3887 | return (const char*)((uintptr_t)ptr + delta); |
| 3888 | } |
| 3889 | |
| 3890 | // Reads string data from the input, aliasing into the input buffer instead of |
| 3891 | // copying. The parsing pointer is passed in `*ptr`, and will be updated if |
| 3892 | // necessary to point to the actual input buffer. Returns the new parsing |
| 3893 | // pointer, which will be advanced past the string data. |
| 3894 | // |
| 3895 | // REQUIRES: Aliasing must be available for this data region (test with |
| 3896 | // upb_EpsCopyInputStream_AliasingAvailable(). |
| 3897 | UPB_INLINE const char* upb_EpsCopyInputStream_ReadStringAliased( |
| 3898 | upb_EpsCopyInputStream* e, const char** ptr, size_t size) { |
| 3899 | UPB_ASSUME(upb_EpsCopyInputStream_AliasingAvailable(e, *ptr, size)); |
| 3900 | const char* ret = *ptr + size; |
| 3901 | *ptr = upb_EpsCopyInputStream_GetAliasedPtr(e, *ptr); |
| 3902 | UPB_ASSUME(ret != NULL); |
| 3903 | return ret; |
| 3904 | } |
| 3905 | |
| 3906 | // Skips `size` bytes of data from the input and returns a pointer past the end. |
| 3907 | // Returns NULL on end of stream or error. |
| 3908 | UPB_INLINE const char* upb_EpsCopyInputStream_Skip(upb_EpsCopyInputStream* e, |
| 3909 | const char* ptr, int size) { |
| 3910 | if (!upb_EpsCopyInputStream_CheckDataSizeAvailable(e, ptr, size)) return NULL; |
| 3911 | return ptr + size; |
| 3912 | } |
| 3913 | |
| 3914 | // Copies `size` bytes of data from the input `ptr` into the buffer `to`, and |
| 3915 | // returns a pointer past the end. Returns NULL on end of stream or error. |
| 3916 | UPB_INLINE const char* upb_EpsCopyInputStream_Copy(upb_EpsCopyInputStream* e, |
| 3917 | const char* ptr, void* to, |
| 3918 | int size) { |
| 3919 | if (!upb_EpsCopyInputStream_CheckDataSizeAvailable(e, ptr, size)) return NULL; |
| 3920 | memcpy(to, ptr, size); |
| 3921 | return ptr + size; |
| 3922 | } |
| 3923 | |
| 3924 | // Reads string data from the stream and advances the pointer accordingly. |
| 3925 | // If aliasing was enabled when the stream was initialized, then the returned |
| 3926 | // pointer will point into the input buffer if possible, otherwise new data |
| 3927 | // will be allocated from arena and copied into. We may be forced to copy even |
| 3928 | // if aliasing was enabled if the input data spans input buffers. |
| 3929 | // |
| 3930 | // Returns NULL if memory allocation failed, or we reached a premature EOF. |
| 3931 | UPB_INLINE const char* upb_EpsCopyInputStream_ReadString( |
| 3932 | upb_EpsCopyInputStream* e, const char** ptr, size_t size, |
| 3933 | upb_Arena* arena) { |
| 3934 | if (upb_EpsCopyInputStream_AliasingAvailable(e, *ptr, size)) { |
| 3935 | return upb_EpsCopyInputStream_ReadStringAliased(e, ptr, size); |
| 3936 | } else { |
| 3937 | // We need to allocate and copy. |
| 3938 | if (!upb_EpsCopyInputStream_CheckDataSizeAvailable(e, *ptr, size)) { |
| 3939 | return NULL; |
| 3940 | } |
| 3941 | UPB_ASSERT(arena); |
| 3942 | char* data = (char*)upb_Arena_Malloc(arena, size); |
| 3943 | if (!data) return NULL; |
| 3944 | const char* ret = upb_EpsCopyInputStream_Copy(e, *ptr, data, size); |
| 3945 | *ptr = data; |
| 3946 | return ret; |
| 3947 | } |
| 3948 | } |
| 3949 | |
| 3950 | UPB_INLINE void _upb_EpsCopyInputStream_CheckLimit(upb_EpsCopyInputStream* e) { |
| 3951 | UPB_ASSERT(e->limit_ptr == e->end + UPB_MIN(0, e->limit)); |
| 3952 | } |
| 3953 | |
| 3954 | // Pushes a limit onto the stack of limits for the current stream. The limit |
| 3955 | // will extend for `size` bytes beyond the position in `ptr`. Future calls to |
| 3956 | // upb_EpsCopyInputStream_IsDone() will return `true` when the stream position |
| 3957 | // reaches this limit. |
| 3958 | // |
| 3959 | // Returns a delta that the caller must store and supply to PopLimit() below. |
| 3960 | UPB_INLINE int upb_EpsCopyInputStream_PushLimit(upb_EpsCopyInputStream* e, |
| 3961 | const char* ptr, int size) { |
| 3962 | int limit = size + (int)(ptr - e->end); |
| 3963 | int delta = e->limit - limit; |
| 3964 | _upb_EpsCopyInputStream_CheckLimit(e); |
| 3965 | UPB_ASSERT(limit <= e->limit); |
| 3966 | e->limit = limit; |
| 3967 | e->limit_ptr = e->end + UPB_MIN(0, limit); |
| 3968 | _upb_EpsCopyInputStream_CheckLimit(e); |
| 3969 | return delta; |
| 3970 | } |
| 3971 | |
| 3972 | // Pops the last limit that was pushed on this stream. This may only be called |
| 3973 | // once IsDone() returns true. The user must pass the delta that was returned |
| 3974 | // from PushLimit(). |
| 3975 | UPB_INLINE void upb_EpsCopyInputStream_PopLimit(upb_EpsCopyInputStream* e, |
| 3976 | const char* ptr, |
| 3977 | int saved_delta) { |
| 3978 | UPB_ASSERT(ptr - e->end == e->limit); |
| 3979 | _upb_EpsCopyInputStream_CheckLimit(e); |
| 3980 | e->limit += saved_delta; |
| 3981 | e->limit_ptr = e->end + UPB_MIN(0, e->limit); |
| 3982 | _upb_EpsCopyInputStream_CheckLimit(e); |
| 3983 | } |
| 3984 | |
| 3985 | UPB_INLINE const char* _upb_EpsCopyInputStream_IsDoneFallbackInline( |
| 3986 | upb_EpsCopyInputStream* e, const char* ptr, int overrun, |
| 3987 | upb_EpsCopyInputStream_BufferFlipCallback* callback) { |
| 3988 | if (overrun < e->limit) { |
| 3989 | // Need to copy remaining data into patch buffer. |
| 3990 | UPB_ASSERT(overrun < kUpb_EpsCopyInputStream_SlopBytes); |
| 3991 | const char* old_end = ptr; |
| 3992 | const char* new_start = &e->patch[0] + overrun; |
| 3993 | memset(e->patch + kUpb_EpsCopyInputStream_SlopBytes, 0, |
| 3994 | kUpb_EpsCopyInputStream_SlopBytes); |
| 3995 | memcpy(e->patch, e->end, kUpb_EpsCopyInputStream_SlopBytes); |
| 3996 | ptr = new_start; |
| 3997 | e->end = &e->patch[kUpb_EpsCopyInputStream_SlopBytes]; |
| 3998 | e->limit -= kUpb_EpsCopyInputStream_SlopBytes; |
| 3999 | e->limit_ptr = e->end + e->limit; |
| 4000 | UPB_ASSERT(ptr < e->limit_ptr); |
| 4001 | if (e->aliasing != kUpb_EpsCopyInputStream_NoAliasing) { |
| 4002 | e->aliasing = (uintptr_t)old_end - (uintptr_t)new_start; |
| 4003 | } |
| 4004 | return callback(e, old_end, new_start); |
| 4005 | } else { |
| 4006 | UPB_ASSERT(overrun > e->limit); |
| 4007 | e->error = true; |
| 4008 | return callback(e, NULL, NULL); |
| 4009 | } |
| 4010 | } |
| 4011 | |
| 4012 | typedef const char* upb_EpsCopyInputStream_ParseDelimitedFunc( |
| 4013 | upb_EpsCopyInputStream* e, const char* ptr, void* ctx); |
| 4014 | |
| 4015 | // Tries to perform a fast-path handling of the given delimited message data. |
| 4016 | // If the sub-message beginning at `*ptr` and extending for `len` is short and |
| 4017 | // fits within this buffer, calls `func` with `ctx` as a parameter, where the |
| 4018 | // pushing and popping of limits is handled automatically and with lower cost |
| 4019 | // than the normal PushLimit()/PopLimit() sequence. |
| 4020 | static UPB_FORCEINLINE bool upb_EpsCopyInputStream_TryParseDelimitedFast( |
| 4021 | upb_EpsCopyInputStream* e, const char** ptr, int len, |
| 4022 | upb_EpsCopyInputStream_ParseDelimitedFunc* func, void* ctx) { |
| 4023 | if (!upb_EpsCopyInputStream_CheckSubMessageSizeAvailable(e, *ptr, len)) { |
| 4024 | return false; |
| 4025 | } |
| 4026 | |
| 4027 | // Fast case: Sub-message is <128 bytes and fits in the current buffer. |
| 4028 | // This means we can preserve limit/limit_ptr verbatim. |
| 4029 | const char* saved_limit_ptr = e->limit_ptr; |
| 4030 | int saved_limit = e->limit; |
| 4031 | e->limit_ptr = *ptr + len; |
| 4032 | e->limit = e->limit_ptr - e->end; |
| 4033 | UPB_ASSERT(e->limit_ptr == e->end + UPB_MIN(0, e->limit)); |
| 4034 | *ptr = func(e, *ptr, ctx); |
| 4035 | e->limit_ptr = saved_limit_ptr; |
| 4036 | e->limit = saved_limit; |
| 4037 | UPB_ASSERT(e->limit_ptr == e->end + UPB_MIN(0, e->limit)); |
| 4038 | return true; |
| 4039 | } |
| 4040 | |
| 4041 | #ifdef __cplusplus |
| 4042 | } /* extern "C" */ |
| 4043 | #endif |
| 4044 | |
| 4045 | |
| 4046 | #endif // UPB_WIRE_EPS_COPY_INPUT_STREAM_H_ |
| 4047 | |
Protobuf Team Bot | 376ba2f | 2023-09-29 22:17:43 +0000 | [diff] [blame] | 4048 | #ifndef UPB_BASE_INTERNAL_LOG2_H_ |
| 4049 | #define UPB_BASE_INTERNAL_LOG2_H_ |
| 4050 | |
| 4051 | // Must be last. |
| 4052 | |
| 4053 | #ifdef __cplusplus |
| 4054 | extern "C" { |
| 4055 | #endif |
| 4056 | |
| 4057 | UPB_INLINE int upb_Log2Ceiling(int x) { |
| 4058 | if (x <= 1) return 0; |
| 4059 | #ifdef __GNUC__ |
| 4060 | return 32 - __builtin_clz(x - 1); |
| 4061 | #else |
| 4062 | int lg2 = 0; |
| 4063 | while ((1 << lg2) < x) lg2++; |
| 4064 | return lg2; |
| 4065 | #endif |
| 4066 | } |
| 4067 | |
| 4068 | UPB_INLINE int upb_Log2CeilingSize(int x) { return 1 << upb_Log2Ceiling(x); } |
| 4069 | |
| 4070 | #ifdef __cplusplus |
| 4071 | } /* extern "C" */ |
| 4072 | #endif |
| 4073 | |
| 4074 | |
| 4075 | #endif /* UPB_BASE_INTERNAL_LOG2_H_ */ |
| 4076 | |
Protobuf Team Bot | d11eb71 | 2023-09-15 00:25:33 +0000 | [diff] [blame] | 4077 | #ifndef UPB_HASH_INT_TABLE_H_ |
| 4078 | #define UPB_HASH_INT_TABLE_H_ |
| 4079 | |
| 4080 | |
| 4081 | // Must be last. |
| 4082 | |
| 4083 | typedef struct { |
| 4084 | upb_table t; // For entries that don't fit in the array part. |
| 4085 | const upb_tabval* array; // Array part of the table. See const note above. |
| 4086 | size_t array_size; // Array part size. |
| 4087 | size_t array_count; // Array part number of elements. |
| 4088 | } upb_inttable; |
| 4089 | |
| 4090 | #ifdef __cplusplus |
| 4091 | extern "C" { |
| 4092 | #endif |
| 4093 | |
| 4094 | // Initialize a table. If memory allocation failed, false is returned and |
| 4095 | // the table is uninitialized. |
| 4096 | bool upb_inttable_init(upb_inttable* table, upb_Arena* a); |
| 4097 | |
| 4098 | // Returns the number of values in the table. |
| 4099 | size_t upb_inttable_count(const upb_inttable* t); |
| 4100 | |
| 4101 | // Inserts the given key into the hashtable with the given value. |
| 4102 | // The key must not already exist in the hash table. |
| 4103 | // The value must not be UINTPTR_MAX. |
| 4104 | // |
| 4105 | // If a table resize was required but memory allocation failed, false is |
| 4106 | // returned and the table is unchanged. |
| 4107 | bool upb_inttable_insert(upb_inttable* t, uintptr_t key, upb_value val, |
| 4108 | upb_Arena* a); |
| 4109 | |
| 4110 | // Looks up key in this table, returning "true" if the key was found. |
| 4111 | // If v is non-NULL, copies the value for this key into *v. |
| 4112 | bool upb_inttable_lookup(const upb_inttable* t, uintptr_t key, upb_value* v); |
| 4113 | |
| 4114 | // Removes an item from the table. Returns true if the remove was successful, |
| 4115 | // and stores the removed item in *val if non-NULL. |
| 4116 | bool upb_inttable_remove(upb_inttable* t, uintptr_t key, upb_value* val); |
| 4117 | |
| 4118 | // Updates an existing entry in an inttable. |
| 4119 | // If the entry does not exist, returns false and does nothing. |
| 4120 | // Unlike insert/remove, this does not invalidate iterators. |
| 4121 | bool upb_inttable_replace(upb_inttable* t, uintptr_t key, upb_value val); |
| 4122 | |
| 4123 | // Optimizes the table for the current set of entries, for both memory use and |
| 4124 | // lookup time. Client should call this after all entries have been inserted; |
| 4125 | // inserting more entries is legal, but will likely require a table resize. |
| 4126 | void upb_inttable_compact(upb_inttable* t, upb_Arena* a); |
| 4127 | |
| 4128 | // Iteration over inttable: |
| 4129 | // |
| 4130 | // intptr_t iter = UPB_INTTABLE_BEGIN; |
| 4131 | // uintptr_t key; |
| 4132 | // upb_value val; |
| 4133 | // while (upb_inttable_next(t, &key, &val, &iter)) { |
| 4134 | // // ... |
| 4135 | // } |
| 4136 | |
| 4137 | #define UPB_INTTABLE_BEGIN -1 |
| 4138 | |
| 4139 | bool upb_inttable_next(const upb_inttable* t, uintptr_t* key, upb_value* val, |
| 4140 | intptr_t* iter); |
| 4141 | void upb_inttable_removeiter(upb_inttable* t, intptr_t* iter); |
| 4142 | |
| 4143 | #ifdef __cplusplus |
| 4144 | } /* extern "C" */ |
| 4145 | #endif |
| 4146 | |
| 4147 | |
| 4148 | #endif /* UPB_HASH_INT_TABLE_H_ */ |
| 4149 | |
| 4150 | #ifndef UPB_JSON_DECODE_H_ |
| 4151 | #define UPB_JSON_DECODE_H_ |
| 4152 | |
| 4153 | |
| 4154 | #ifndef UPB_REFLECTION_DEF_H_ |
| 4155 | #define UPB_REFLECTION_DEF_H_ |
| 4156 | |
| 4157 | // IWYU pragma: begin_exports |
| 4158 | |
Protobuf Team Bot | 0631035 | 2023-09-26 21:54:58 +0000 | [diff] [blame] | 4159 | // IWYU pragma: private, include "upb/reflection/def.h" |
Protobuf Team Bot | d11eb71 | 2023-09-15 00:25:33 +0000 | [diff] [blame] | 4160 | |
| 4161 | #ifndef UPB_REFLECTION_DEF_POOL_H_ |
| 4162 | #define UPB_REFLECTION_DEF_POOL_H_ |
| 4163 | |
| 4164 | |
Protobuf Team Bot | 0631035 | 2023-09-26 21:54:58 +0000 | [diff] [blame] | 4165 | // IWYU pragma: private, include "upb/reflection/def.h" |
Protobuf Team Bot | d11eb71 | 2023-09-15 00:25:33 +0000 | [diff] [blame] | 4166 | |
| 4167 | // Declarations common to all public def types. |
| 4168 | |
| 4169 | #ifndef UPB_REFLECTION_COMMON_H_ |
| 4170 | #define UPB_REFLECTION_COMMON_H_ |
| 4171 | |
| 4172 | // begin:google_only |
| 4173 | // #ifndef UPB_BOOTSTRAP_STAGE0 |
| 4174 | // #include "net/proto2/proto/descriptor.upb.h" |
| 4175 | // #else |
| 4176 | // #include "google/protobuf/descriptor.upb.h" |
| 4177 | // #endif |
| 4178 | // end:google_only |
| 4179 | |
| 4180 | // begin:github_only |
Protobuf Team Bot | 0cb912c | 2023-09-28 20:14:04 +0000 | [diff] [blame] | 4181 | /* This file was generated by upb_generator from the input file: |
Protobuf Team Bot | d11eb71 | 2023-09-15 00:25:33 +0000 | [diff] [blame] | 4182 | * |
| 4183 | * google/protobuf/descriptor.proto |
| 4184 | * |
| 4185 | * Do not edit -- your changes will be discarded when the file is |
| 4186 | * regenerated. */ |
| 4187 | |
Mike Kruskal | 9d43502 | 2023-07-11 12:45:07 -0700 | [diff] [blame] | 4188 | #ifndef GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_H_ |
| 4189 | #define GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_H_ |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4190 | |
Protobuf Team Bot | 111d655 | 2023-09-15 21:07:08 +0000 | [diff] [blame] | 4191 | |
| 4192 | |
| 4193 | // Must be last. |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4194 | |
| 4195 | #ifdef __cplusplus |
| 4196 | extern "C" { |
| 4197 | #endif |
| 4198 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4199 | typedef struct google_protobuf_FileDescriptorSet google_protobuf_FileDescriptorSet; |
| 4200 | typedef struct google_protobuf_FileDescriptorProto google_protobuf_FileDescriptorProto; |
| 4201 | typedef struct google_protobuf_DescriptorProto google_protobuf_DescriptorProto; |
| 4202 | typedef struct google_protobuf_DescriptorProto_ExtensionRange google_protobuf_DescriptorProto_ExtensionRange; |
| 4203 | typedef struct google_protobuf_DescriptorProto_ReservedRange google_protobuf_DescriptorProto_ReservedRange; |
| 4204 | typedef struct google_protobuf_ExtensionRangeOptions google_protobuf_ExtensionRangeOptions; |
Mike Kruskal | 145900f | 2023-03-27 09:55:52 -0700 | [diff] [blame] | 4205 | typedef struct google_protobuf_ExtensionRangeOptions_Declaration google_protobuf_ExtensionRangeOptions_Declaration; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4206 | typedef struct google_protobuf_FieldDescriptorProto google_protobuf_FieldDescriptorProto; |
| 4207 | typedef struct google_protobuf_OneofDescriptorProto google_protobuf_OneofDescriptorProto; |
| 4208 | typedef struct google_protobuf_EnumDescriptorProto google_protobuf_EnumDescriptorProto; |
| 4209 | typedef struct google_protobuf_EnumDescriptorProto_EnumReservedRange google_protobuf_EnumDescriptorProto_EnumReservedRange; |
| 4210 | typedef struct google_protobuf_EnumValueDescriptorProto google_protobuf_EnumValueDescriptorProto; |
| 4211 | typedef struct google_protobuf_ServiceDescriptorProto google_protobuf_ServiceDescriptorProto; |
| 4212 | typedef struct google_protobuf_MethodDescriptorProto google_protobuf_MethodDescriptorProto; |
| 4213 | typedef struct google_protobuf_FileOptions google_protobuf_FileOptions; |
| 4214 | typedef struct google_protobuf_MessageOptions google_protobuf_MessageOptions; |
| 4215 | typedef struct google_protobuf_FieldOptions google_protobuf_FieldOptions; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 4216 | typedef struct google_protobuf_FieldOptions_EditionDefault google_protobuf_FieldOptions_EditionDefault; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4217 | typedef struct google_protobuf_OneofOptions google_protobuf_OneofOptions; |
| 4218 | typedef struct google_protobuf_EnumOptions google_protobuf_EnumOptions; |
| 4219 | typedef struct google_protobuf_EnumValueOptions google_protobuf_EnumValueOptions; |
| 4220 | typedef struct google_protobuf_ServiceOptions google_protobuf_ServiceOptions; |
| 4221 | typedef struct google_protobuf_MethodOptions google_protobuf_MethodOptions; |
| 4222 | typedef struct google_protobuf_UninterpretedOption google_protobuf_UninterpretedOption; |
| 4223 | typedef struct google_protobuf_UninterpretedOption_NamePart google_protobuf_UninterpretedOption_NamePart; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 4224 | typedef struct google_protobuf_FeatureSet google_protobuf_FeatureSet; |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 4225 | typedef struct google_protobuf_FeatureSetDefaults google_protobuf_FeatureSetDefaults; |
| 4226 | typedef struct google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4227 | typedef struct google_protobuf_SourceCodeInfo google_protobuf_SourceCodeInfo; |
| 4228 | typedef struct google_protobuf_SourceCodeInfo_Location google_protobuf_SourceCodeInfo_Location; |
| 4229 | typedef struct google_protobuf_GeneratedCodeInfo google_protobuf_GeneratedCodeInfo; |
| 4230 | typedef struct google_protobuf_GeneratedCodeInfo_Annotation google_protobuf_GeneratedCodeInfo_Annotation; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4231 | |
| 4232 | typedef enum { |
Protobuf Team Bot | fa98bb3 | 2023-09-01 18:11:09 +0000 | [diff] [blame] | 4233 | google_protobuf_EDITION_UNKNOWN = 0, |
| 4234 | google_protobuf_EDITION_1_TEST_ONLY = 1, |
| 4235 | google_protobuf_EDITION_2_TEST_ONLY = 2, |
Protobuf Team Bot | 6703802 | 2023-10-04 04:14:37 +0000 | [diff] [blame] | 4236 | google_protobuf_EDITION_PROTO2 = 998, |
| 4237 | google_protobuf_EDITION_PROTO3 = 999, |
Protobuf Team Bot | fa98bb3 | 2023-09-01 18:11:09 +0000 | [diff] [blame] | 4238 | google_protobuf_EDITION_2023 = 1000, |
| 4239 | google_protobuf_EDITION_99997_TEST_ONLY = 99997, |
| 4240 | google_protobuf_EDITION_99998_TEST_ONLY = 99998, |
| 4241 | google_protobuf_EDITION_99999_TEST_ONLY = 99999 |
| 4242 | } google_protobuf_Edition; |
| 4243 | |
| 4244 | typedef enum { |
Protobuf Team Bot | 469f027 | 2023-04-21 18:12:45 -0700 | [diff] [blame] | 4245 | google_protobuf_ExtensionRangeOptions_DECLARATION = 0, |
| 4246 | google_protobuf_ExtensionRangeOptions_UNVERIFIED = 1 |
| 4247 | } google_protobuf_ExtensionRangeOptions_VerificationState; |
| 4248 | |
| 4249 | typedef enum { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 4250 | google_protobuf_FeatureSet_ENUM_TYPE_UNKNOWN = 0, |
| 4251 | google_protobuf_FeatureSet_OPEN = 1, |
| 4252 | google_protobuf_FeatureSet_CLOSED = 2 |
| 4253 | } google_protobuf_FeatureSet_EnumType; |
| 4254 | |
| 4255 | typedef enum { |
| 4256 | google_protobuf_FeatureSet_FIELD_PRESENCE_UNKNOWN = 0, |
| 4257 | google_protobuf_FeatureSet_EXPLICIT = 1, |
| 4258 | google_protobuf_FeatureSet_IMPLICIT = 2, |
| 4259 | google_protobuf_FeatureSet_LEGACY_REQUIRED = 3 |
| 4260 | } google_protobuf_FeatureSet_FieldPresence; |
| 4261 | |
| 4262 | typedef enum { |
| 4263 | google_protobuf_FeatureSet_JSON_FORMAT_UNKNOWN = 0, |
| 4264 | google_protobuf_FeatureSet_ALLOW = 1, |
| 4265 | google_protobuf_FeatureSet_LEGACY_BEST_EFFORT = 2 |
| 4266 | } google_protobuf_FeatureSet_JsonFormat; |
| 4267 | |
| 4268 | typedef enum { |
| 4269 | google_protobuf_FeatureSet_MESSAGE_ENCODING_UNKNOWN = 0, |
| 4270 | google_protobuf_FeatureSet_LENGTH_PREFIXED = 1, |
| 4271 | google_protobuf_FeatureSet_DELIMITED = 2 |
| 4272 | } google_protobuf_FeatureSet_MessageEncoding; |
| 4273 | |
| 4274 | typedef enum { |
| 4275 | google_protobuf_FeatureSet_REPEATED_FIELD_ENCODING_UNKNOWN = 0, |
| 4276 | google_protobuf_FeatureSet_PACKED = 1, |
| 4277 | google_protobuf_FeatureSet_EXPANDED = 2 |
| 4278 | } google_protobuf_FeatureSet_RepeatedFieldEncoding; |
| 4279 | |
| 4280 | typedef enum { |
Protobuf Team Bot | 6112795 | 2023-09-26 20:07:33 +0000 | [diff] [blame] | 4281 | google_protobuf_FeatureSet_UTF8_VALIDATION_UNKNOWN = 0, |
Protobuf Team Bot | 4b301ad | 2023-10-14 03:20:44 +0000 | [diff] [blame^] | 4282 | google_protobuf_FeatureSet_NONE = 1, |
Protobuf Team Bot | 6112795 | 2023-09-26 20:07:33 +0000 | [diff] [blame] | 4283 | google_protobuf_FeatureSet_VERIFY = 2 |
| 4284 | } google_protobuf_FeatureSet_Utf8Validation; |
| 4285 | |
| 4286 | typedef enum { |
Mike Kruskal | ccbdaa7 | 2023-02-02 20:42:14 -0800 | [diff] [blame] | 4287 | google_protobuf_FieldDescriptorProto_LABEL_OPTIONAL = 1, |
| 4288 | google_protobuf_FieldDescriptorProto_LABEL_REQUIRED = 2, |
| 4289 | google_protobuf_FieldDescriptorProto_LABEL_REPEATED = 3 |
| 4290 | } google_protobuf_FieldDescriptorProto_Label; |
| 4291 | |
| 4292 | typedef enum { |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4293 | google_protobuf_FieldDescriptorProto_TYPE_DOUBLE = 1, |
| 4294 | google_protobuf_FieldDescriptorProto_TYPE_FLOAT = 2, |
| 4295 | google_protobuf_FieldDescriptorProto_TYPE_INT64 = 3, |
| 4296 | google_protobuf_FieldDescriptorProto_TYPE_UINT64 = 4, |
| 4297 | google_protobuf_FieldDescriptorProto_TYPE_INT32 = 5, |
| 4298 | google_protobuf_FieldDescriptorProto_TYPE_FIXED64 = 6, |
| 4299 | google_protobuf_FieldDescriptorProto_TYPE_FIXED32 = 7, |
| 4300 | google_protobuf_FieldDescriptorProto_TYPE_BOOL = 8, |
| 4301 | google_protobuf_FieldDescriptorProto_TYPE_STRING = 9, |
| 4302 | google_protobuf_FieldDescriptorProto_TYPE_GROUP = 10, |
| 4303 | google_protobuf_FieldDescriptorProto_TYPE_MESSAGE = 11, |
| 4304 | google_protobuf_FieldDescriptorProto_TYPE_BYTES = 12, |
| 4305 | google_protobuf_FieldDescriptorProto_TYPE_UINT32 = 13, |
| 4306 | google_protobuf_FieldDescriptorProto_TYPE_ENUM = 14, |
| 4307 | google_protobuf_FieldDescriptorProto_TYPE_SFIXED32 = 15, |
| 4308 | google_protobuf_FieldDescriptorProto_TYPE_SFIXED64 = 16, |
| 4309 | google_protobuf_FieldDescriptorProto_TYPE_SINT32 = 17, |
| 4310 | google_protobuf_FieldDescriptorProto_TYPE_SINT64 = 18 |
| 4311 | } google_protobuf_FieldDescriptorProto_Type; |
| 4312 | |
| 4313 | typedef enum { |
| 4314 | google_protobuf_FieldOptions_STRING = 0, |
| 4315 | google_protobuf_FieldOptions_CORD = 1, |
| 4316 | google_protobuf_FieldOptions_STRING_PIECE = 2 |
| 4317 | } google_protobuf_FieldOptions_CType; |
| 4318 | |
| 4319 | typedef enum { |
| 4320 | google_protobuf_FieldOptions_JS_NORMAL = 0, |
| 4321 | google_protobuf_FieldOptions_JS_STRING = 1, |
| 4322 | google_protobuf_FieldOptions_JS_NUMBER = 2 |
| 4323 | } google_protobuf_FieldOptions_JSType; |
| 4324 | |
| 4325 | typedef enum { |
Adam Cozzette | 90ff32c | 2023-01-21 15:04:56 -0800 | [diff] [blame] | 4326 | google_protobuf_FieldOptions_RETENTION_UNKNOWN = 0, |
| 4327 | google_protobuf_FieldOptions_RETENTION_RUNTIME = 1, |
| 4328 | google_protobuf_FieldOptions_RETENTION_SOURCE = 2 |
| 4329 | } google_protobuf_FieldOptions_OptionRetention; |
| 4330 | |
| 4331 | typedef enum { |
| 4332 | google_protobuf_FieldOptions_TARGET_TYPE_UNKNOWN = 0, |
| 4333 | google_protobuf_FieldOptions_TARGET_TYPE_FILE = 1, |
| 4334 | google_protobuf_FieldOptions_TARGET_TYPE_EXTENSION_RANGE = 2, |
| 4335 | google_protobuf_FieldOptions_TARGET_TYPE_MESSAGE = 3, |
| 4336 | google_protobuf_FieldOptions_TARGET_TYPE_FIELD = 4, |
| 4337 | google_protobuf_FieldOptions_TARGET_TYPE_ONEOF = 5, |
| 4338 | google_protobuf_FieldOptions_TARGET_TYPE_ENUM = 6, |
| 4339 | google_protobuf_FieldOptions_TARGET_TYPE_ENUM_ENTRY = 7, |
| 4340 | google_protobuf_FieldOptions_TARGET_TYPE_SERVICE = 8, |
| 4341 | google_protobuf_FieldOptions_TARGET_TYPE_METHOD = 9 |
| 4342 | } google_protobuf_FieldOptions_OptionTargetType; |
| 4343 | |
| 4344 | typedef enum { |
Mike Kruskal | ccbdaa7 | 2023-02-02 20:42:14 -0800 | [diff] [blame] | 4345 | google_protobuf_FileOptions_SPEED = 1, |
| 4346 | google_protobuf_FileOptions_CODE_SIZE = 2, |
| 4347 | google_protobuf_FileOptions_LITE_RUNTIME = 3 |
| 4348 | } google_protobuf_FileOptions_OptimizeMode; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4349 | |
| 4350 | typedef enum { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4351 | google_protobuf_GeneratedCodeInfo_Annotation_NONE = 0, |
| 4352 | google_protobuf_GeneratedCodeInfo_Annotation_SET = 1, |
| 4353 | google_protobuf_GeneratedCodeInfo_Annotation_ALIAS = 2 |
| 4354 | } google_protobuf_GeneratedCodeInfo_Annotation_Semantic; |
| 4355 | |
Mike Kruskal | ccbdaa7 | 2023-02-02 20:42:14 -0800 | [diff] [blame] | 4356 | typedef enum { |
| 4357 | google_protobuf_MethodOptions_IDEMPOTENCY_UNKNOWN = 0, |
| 4358 | google_protobuf_MethodOptions_NO_SIDE_EFFECTS = 1, |
| 4359 | google_protobuf_MethodOptions_IDEMPOTENT = 2 |
| 4360 | } google_protobuf_MethodOptions_IdempotencyLevel; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4361 | |
Mike Kruskal | ccbdaa7 | 2023-02-02 20:42:14 -0800 | [diff] [blame] | 4362 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4363 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4364 | /* google.protobuf.FileDescriptorSet */ |
| 4365 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4366 | UPB_INLINE google_protobuf_FileDescriptorSet* google_protobuf_FileDescriptorSet_new(upb_Arena* arena) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 4367 | 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] | 4368 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4369 | UPB_INLINE google_protobuf_FileDescriptorSet* google_protobuf_FileDescriptorSet_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 4370 | google_protobuf_FileDescriptorSet* ret = google_protobuf_FileDescriptorSet_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 4371 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 4372 | 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] | 4373 | return NULL; |
| 4374 | } |
| 4375 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4376 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4377 | UPB_INLINE google_protobuf_FileDescriptorSet* google_protobuf_FileDescriptorSet_parse_ex(const char* buf, size_t size, |
| 4378 | const upb_ExtensionRegistry* extreg, |
| 4379 | int options, upb_Arena* arena) { |
| 4380 | google_protobuf_FileDescriptorSet* ret = google_protobuf_FileDescriptorSet_new(arena); |
| 4381 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 4382 | 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] | 4383 | kUpb_DecodeStatus_Ok) { |
| 4384 | return NULL; |
| 4385 | } |
| 4386 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4387 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4388 | 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] | 4389 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 4390 | (void)upb_Encode(msg, &google__protobuf__FileDescriptorSet_msg_init, 0, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4391 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4392 | } |
| 4393 | UPB_INLINE char* google_protobuf_FileDescriptorSet_serialize_ex(const google_protobuf_FileDescriptorSet* msg, int options, |
| 4394 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4395 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 4396 | (void)upb_Encode(msg, &google__protobuf__FileDescriptorSet_msg_init, options, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4397 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4398 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4399 | UPB_INLINE void google_protobuf_FileDescriptorSet_clear_file(google_protobuf_FileDescriptorSet* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4400 | 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] | 4401 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4402 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4403 | 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] | 4404 | 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] | 4405 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4406 | if (arr) { |
| 4407 | if (size) *size = arr->size; |
| 4408 | return (const google_protobuf_FileDescriptorProto* const*)_upb_array_constptr(arr); |
| 4409 | } else { |
| 4410 | if (size) *size = 0; |
| 4411 | return NULL; |
| 4412 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4413 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 4414 | 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] | 4415 | 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] | 4416 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4417 | if (size) { |
| 4418 | *size = arr ? arr->size : 0; |
| 4419 | } |
| 4420 | return arr; |
| 4421 | } |
| 4422 | 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] | 4423 | 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] | 4424 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 4425 | (upb_Message*)msg, &field, arena); |
| 4426 | if (size) { |
| 4427 | *size = arr ? arr->size : 0; |
| 4428 | } |
| 4429 | return arr; |
| 4430 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4431 | UPB_INLINE bool google_protobuf_FileDescriptorSet_has_file(const google_protobuf_FileDescriptorSet* msg) { |
| 4432 | size_t size; |
| 4433 | google_protobuf_FileDescriptorSet_file(msg, &size); |
| 4434 | return size != 0; |
| 4435 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4436 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4437 | 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] | 4438 | 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] | 4439 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 4440 | if (arr) { |
| 4441 | if (size) *size = arr->size; |
| 4442 | return (google_protobuf_FileDescriptorProto**)_upb_array_ptr(arr); |
| 4443 | } else { |
| 4444 | if (size) *size = 0; |
| 4445 | return NULL; |
| 4446 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4447 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4448 | 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] | 4449 | 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] | 4450 | return (google_protobuf_FileDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4451 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4452 | 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] | 4453 | 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] | 4454 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 4455 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 4456 | return NULL; |
| 4457 | } |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 4458 | 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] | 4459 | if (!arr || !sub) return NULL; |
| 4460 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4461 | return sub; |
| 4462 | } |
| 4463 | |
| 4464 | /* google.protobuf.FileDescriptorProto */ |
| 4465 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4466 | UPB_INLINE google_protobuf_FileDescriptorProto* google_protobuf_FileDescriptorProto_new(upb_Arena* arena) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 4467 | 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] | 4468 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4469 | UPB_INLINE google_protobuf_FileDescriptorProto* google_protobuf_FileDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 4470 | google_protobuf_FileDescriptorProto* ret = google_protobuf_FileDescriptorProto_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 4471 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 4472 | 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] | 4473 | return NULL; |
| 4474 | } |
| 4475 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4476 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4477 | UPB_INLINE google_protobuf_FileDescriptorProto* google_protobuf_FileDescriptorProto_parse_ex(const char* buf, size_t size, |
| 4478 | const upb_ExtensionRegistry* extreg, |
| 4479 | int options, upb_Arena* arena) { |
| 4480 | google_protobuf_FileDescriptorProto* ret = google_protobuf_FileDescriptorProto_new(arena); |
| 4481 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 4482 | 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] | 4483 | kUpb_DecodeStatus_Ok) { |
| 4484 | return NULL; |
| 4485 | } |
| 4486 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4487 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4488 | 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] | 4489 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 4490 | (void)upb_Encode(msg, &google__protobuf__FileDescriptorProto_msg_init, 0, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4491 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4492 | } |
| 4493 | UPB_INLINE char* google_protobuf_FileDescriptorProto_serialize_ex(const google_protobuf_FileDescriptorProto* msg, int options, |
| 4494 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4495 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 4496 | (void)upb_Encode(msg, &google__protobuf__FileDescriptorProto_msg_init, options, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4497 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4498 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4499 | 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] | 4500 | 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] | 4501 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4502 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4503 | 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] | 4504 | upb_StringView default_val = upb_StringView_FromString(""); |
| 4505 | upb_StringView ret; |
Protobuf Team Bot | 0e484c7 | 2023-09-06 19:28:27 +0000 | [diff] [blame] | 4506 | 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] | 4507 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 4508 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4509 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4510 | 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] | 4511 | 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] | 4512 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4513 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4514 | 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] | 4515 | 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] | 4516 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4517 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4518 | 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] | 4519 | upb_StringView default_val = upb_StringView_FromString(""); |
| 4520 | upb_StringView ret; |
Protobuf Team Bot | 0e484c7 | 2023-09-06 19:28:27 +0000 | [diff] [blame] | 4521 | 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] | 4522 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 4523 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4524 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4525 | 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] | 4526 | 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] | 4527 | return _upb_Message_HasNonExtensionField(msg, &field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4528 | } |
| 4529 | UPB_INLINE void google_protobuf_FileDescriptorProto_clear_dependency(google_protobuf_FileDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4530 | 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] | 4531 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4532 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4533 | 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] | 4534 | 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] | 4535 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4536 | if (arr) { |
| 4537 | if (size) *size = arr->size; |
| 4538 | return (upb_StringView const*)_upb_array_constptr(arr); |
| 4539 | } else { |
| 4540 | if (size) *size = 0; |
| 4541 | return NULL; |
| 4542 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4543 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 4544 | 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] | 4545 | 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] | 4546 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4547 | if (size) { |
| 4548 | *size = arr ? arr->size : 0; |
| 4549 | } |
| 4550 | return arr; |
| 4551 | } |
| 4552 | 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] | 4553 | 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] | 4554 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 4555 | (upb_Message*)msg, &field, arena); |
| 4556 | if (size) { |
| 4557 | *size = arr ? arr->size : 0; |
| 4558 | } |
| 4559 | return arr; |
| 4560 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4561 | UPB_INLINE bool google_protobuf_FileDescriptorProto_has_dependency(const google_protobuf_FileDescriptorProto* msg) { |
| 4562 | size_t size; |
| 4563 | google_protobuf_FileDescriptorProto_dependency(msg, &size); |
| 4564 | return size != 0; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4565 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4566 | 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] | 4567 | 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] | 4568 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4569 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4570 | 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] | 4571 | 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] | 4572 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4573 | if (arr) { |
| 4574 | if (size) *size = arr->size; |
| 4575 | return (const google_protobuf_DescriptorProto* const*)_upb_array_constptr(arr); |
| 4576 | } else { |
| 4577 | if (size) *size = 0; |
| 4578 | return NULL; |
| 4579 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4580 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 4581 | 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] | 4582 | 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] | 4583 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4584 | if (size) { |
| 4585 | *size = arr ? arr->size : 0; |
| 4586 | } |
| 4587 | return arr; |
| 4588 | } |
| 4589 | 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] | 4590 | 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] | 4591 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 4592 | (upb_Message*)msg, &field, arena); |
| 4593 | if (size) { |
| 4594 | *size = arr ? arr->size : 0; |
| 4595 | } |
| 4596 | return arr; |
| 4597 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4598 | UPB_INLINE bool google_protobuf_FileDescriptorProto_has_message_type(const google_protobuf_FileDescriptorProto* msg) { |
| 4599 | size_t size; |
| 4600 | google_protobuf_FileDescriptorProto_message_type(msg, &size); |
| 4601 | return size != 0; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4602 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4603 | 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] | 4604 | 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] | 4605 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4606 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4607 | 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] | 4608 | 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] | 4609 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4610 | if (arr) { |
| 4611 | if (size) *size = arr->size; |
| 4612 | return (const google_protobuf_EnumDescriptorProto* const*)_upb_array_constptr(arr); |
| 4613 | } else { |
| 4614 | if (size) *size = 0; |
| 4615 | return NULL; |
| 4616 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4617 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 4618 | 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] | 4619 | 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] | 4620 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4621 | if (size) { |
| 4622 | *size = arr ? arr->size : 0; |
| 4623 | } |
| 4624 | return arr; |
| 4625 | } |
| 4626 | 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] | 4627 | 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] | 4628 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 4629 | (upb_Message*)msg, &field, arena); |
| 4630 | if (size) { |
| 4631 | *size = arr ? arr->size : 0; |
| 4632 | } |
| 4633 | return arr; |
| 4634 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4635 | UPB_INLINE bool google_protobuf_FileDescriptorProto_has_enum_type(const google_protobuf_FileDescriptorProto* msg) { |
| 4636 | size_t size; |
| 4637 | google_protobuf_FileDescriptorProto_enum_type(msg, &size); |
| 4638 | return size != 0; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4639 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4640 | UPB_INLINE void google_protobuf_FileDescriptorProto_clear_service(google_protobuf_FileDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4641 | 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] | 4642 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4643 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4644 | 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] | 4645 | 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] | 4646 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4647 | if (arr) { |
| 4648 | if (size) *size = arr->size; |
| 4649 | return (const google_protobuf_ServiceDescriptorProto* const*)_upb_array_constptr(arr); |
| 4650 | } else { |
| 4651 | if (size) *size = 0; |
| 4652 | return NULL; |
| 4653 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4654 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 4655 | 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] | 4656 | 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] | 4657 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4658 | if (size) { |
| 4659 | *size = arr ? arr->size : 0; |
| 4660 | } |
| 4661 | return arr; |
| 4662 | } |
| 4663 | 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] | 4664 | 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] | 4665 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 4666 | (upb_Message*)msg, &field, arena); |
| 4667 | if (size) { |
| 4668 | *size = arr ? arr->size : 0; |
| 4669 | } |
| 4670 | return arr; |
| 4671 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4672 | UPB_INLINE bool google_protobuf_FileDescriptorProto_has_service(const google_protobuf_FileDescriptorProto* msg) { |
| 4673 | size_t size; |
| 4674 | google_protobuf_FileDescriptorProto_service(msg, &size); |
| 4675 | return size != 0; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4676 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4677 | UPB_INLINE void google_protobuf_FileDescriptorProto_clear_extension(google_protobuf_FileDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4678 | 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] | 4679 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4680 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4681 | 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] | 4682 | 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] | 4683 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4684 | if (arr) { |
| 4685 | if (size) *size = arr->size; |
| 4686 | return (const google_protobuf_FieldDescriptorProto* const*)_upb_array_constptr(arr); |
| 4687 | } else { |
| 4688 | if (size) *size = 0; |
| 4689 | return NULL; |
| 4690 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4691 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 4692 | 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] | 4693 | 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] | 4694 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4695 | if (size) { |
| 4696 | *size = arr ? arr->size : 0; |
| 4697 | } |
| 4698 | return arr; |
| 4699 | } |
| 4700 | 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] | 4701 | 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] | 4702 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 4703 | (upb_Message*)msg, &field, arena); |
| 4704 | if (size) { |
| 4705 | *size = arr ? arr->size : 0; |
| 4706 | } |
| 4707 | return arr; |
| 4708 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4709 | UPB_INLINE bool google_protobuf_FileDescriptorProto_has_extension(const google_protobuf_FileDescriptorProto* msg) { |
| 4710 | size_t size; |
| 4711 | google_protobuf_FileDescriptorProto_extension(msg, &size); |
| 4712 | return size != 0; |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4713 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4714 | UPB_INLINE void google_protobuf_FileDescriptorProto_clear_options(google_protobuf_FileDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4715 | 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] | 4716 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4717 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4718 | 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] | 4719 | const google_protobuf_FileOptions* default_val = NULL; |
| 4720 | const google_protobuf_FileOptions* ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4721 | 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] | 4722 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 4723 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4724 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4725 | 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] | 4726 | 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] | 4727 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4728 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4729 | 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] | 4730 | 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] | 4731 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4732 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4733 | 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] | 4734 | const google_protobuf_SourceCodeInfo* default_val = NULL; |
| 4735 | const google_protobuf_SourceCodeInfo* ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4736 | 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] | 4737 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 4738 | return ret; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4739 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4740 | 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] | 4741 | 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] | 4742 | return _upb_Message_HasNonExtensionField(msg, &field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4743 | } |
| 4744 | 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] | 4745 | 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] | 4746 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4747 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4748 | 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] | 4749 | 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] | 4750 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4751 | if (arr) { |
| 4752 | if (size) *size = arr->size; |
| 4753 | return (int32_t const*)_upb_array_constptr(arr); |
| 4754 | } else { |
| 4755 | if (size) *size = 0; |
| 4756 | return NULL; |
| 4757 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4758 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 4759 | 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] | 4760 | 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] | 4761 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4762 | if (size) { |
| 4763 | *size = arr ? arr->size : 0; |
| 4764 | } |
| 4765 | return arr; |
| 4766 | } |
| 4767 | 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] | 4768 | 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] | 4769 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 4770 | (upb_Message*)msg, &field, arena); |
| 4771 | if (size) { |
| 4772 | *size = arr ? arr->size : 0; |
| 4773 | } |
| 4774 | return arr; |
| 4775 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4776 | UPB_INLINE bool google_protobuf_FileDescriptorProto_has_public_dependency(const google_protobuf_FileDescriptorProto* msg) { |
| 4777 | size_t size; |
| 4778 | google_protobuf_FileDescriptorProto_public_dependency(msg, &size); |
| 4779 | return size != 0; |
| 4780 | } |
| 4781 | 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] | 4782 | 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] | 4783 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4784 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4785 | 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] | 4786 | 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] | 4787 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4788 | if (arr) { |
| 4789 | if (size) *size = arr->size; |
| 4790 | return (int32_t const*)_upb_array_constptr(arr); |
| 4791 | } else { |
| 4792 | if (size) *size = 0; |
| 4793 | return NULL; |
| 4794 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4795 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 4796 | 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] | 4797 | 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] | 4798 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4799 | if (size) { |
| 4800 | *size = arr ? arr->size : 0; |
| 4801 | } |
| 4802 | return arr; |
| 4803 | } |
| 4804 | 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] | 4805 | 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] | 4806 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 4807 | (upb_Message*)msg, &field, arena); |
| 4808 | if (size) { |
| 4809 | *size = arr ? arr->size : 0; |
| 4810 | } |
| 4811 | return arr; |
| 4812 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4813 | UPB_INLINE bool google_protobuf_FileDescriptorProto_has_weak_dependency(const google_protobuf_FileDescriptorProto* msg) { |
| 4814 | size_t size; |
| 4815 | google_protobuf_FileDescriptorProto_weak_dependency(msg, &size); |
| 4816 | return size != 0; |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4817 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4818 | 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] | 4819 | 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] | 4820 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4821 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4822 | 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] | 4823 | upb_StringView default_val = upb_StringView_FromString(""); |
| 4824 | upb_StringView ret; |
Protobuf Team Bot | 0e484c7 | 2023-09-06 19:28:27 +0000 | [diff] [blame] | 4825 | 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] | 4826 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 4827 | return ret; |
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 bool google_protobuf_FileDescriptorProto_has_syntax(const google_protobuf_FileDescriptorProto* msg) { |
Protobuf Team Bot | 0e484c7 | 2023-09-06 19:28:27 +0000 | [diff] [blame] | 4830 | 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] | 4831 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4832 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4833 | UPB_INLINE void google_protobuf_FileDescriptorProto_clear_edition(google_protobuf_FileDescriptorProto* msg) { |
Protobuf Team Bot | ab58f8f | 2023-09-26 16:14:19 +0000 | [diff] [blame] | 4834 | const upb_MiniTableField field = {14, UPB_SIZE(40, 4), 6, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 4835 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4836 | } |
Protobuf Team Bot | ab58f8f | 2023-09-26 16:14:19 +0000 | [diff] [blame] | 4837 | UPB_INLINE int32_t google_protobuf_FileDescriptorProto_edition(const google_protobuf_FileDescriptorProto* msg) { |
| 4838 | int32_t default_val = 0; |
| 4839 | int32_t ret; |
| 4840 | const upb_MiniTableField field = {14, UPB_SIZE(40, 4), 6, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 4841 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 4842 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4843 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4844 | UPB_INLINE bool google_protobuf_FileDescriptorProto_has_edition(const google_protobuf_FileDescriptorProto* msg) { |
Protobuf Team Bot | ab58f8f | 2023-09-26 16:14:19 +0000 | [diff] [blame] | 4845 | const upb_MiniTableField field = {14, UPB_SIZE(40, 4), 6, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 4846 | return _upb_Message_HasNonExtensionField(msg, &field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4847 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4848 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4849 | 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] | 4850 | 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] | 4851 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 4852 | } |
| 4853 | 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] | 4854 | 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] | 4855 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 4856 | } |
| 4857 | 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] | 4858 | 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] | 4859 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 4860 | if (arr) { |
| 4861 | if (size) *size = arr->size; |
| 4862 | return (upb_StringView*)_upb_array_ptr(arr); |
| 4863 | } else { |
| 4864 | if (size) *size = 0; |
| 4865 | return NULL; |
| 4866 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4867 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4868 | 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] | 4869 | 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] | 4870 | return (upb_StringView*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4871 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4872 | 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] | 4873 | 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] | 4874 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 4875 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 4876 | return false; |
| 4877 | } |
| 4878 | _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val)); |
| 4879 | return true; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4880 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4881 | 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] | 4882 | 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] | 4883 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 4884 | if (arr) { |
| 4885 | if (size) *size = arr->size; |
| 4886 | return (google_protobuf_DescriptorProto**)_upb_array_ptr(arr); |
| 4887 | } else { |
| 4888 | if (size) *size = 0; |
| 4889 | return NULL; |
| 4890 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4891 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4892 | 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] | 4893 | 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] | 4894 | return (google_protobuf_DescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4895 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4896 | 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] | 4897 | 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] | 4898 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 4899 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 4900 | return NULL; |
| 4901 | } |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 4902 | 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] | 4903 | if (!arr || !sub) return NULL; |
| 4904 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4905 | return sub; |
| 4906 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4907 | 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] | 4908 | 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] | 4909 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 4910 | if (arr) { |
| 4911 | if (size) *size = arr->size; |
| 4912 | return (google_protobuf_EnumDescriptorProto**)_upb_array_ptr(arr); |
| 4913 | } else { |
| 4914 | if (size) *size = 0; |
| 4915 | return NULL; |
| 4916 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4917 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4918 | 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] | 4919 | 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] | 4920 | return (google_protobuf_EnumDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4921 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4922 | 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] | 4923 | 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] | 4924 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 4925 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 4926 | return NULL; |
| 4927 | } |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 4928 | 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] | 4929 | if (!arr || !sub) return NULL; |
| 4930 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4931 | return sub; |
| 4932 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4933 | 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] | 4934 | 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] | 4935 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 4936 | if (arr) { |
| 4937 | if (size) *size = arr->size; |
| 4938 | return (google_protobuf_ServiceDescriptorProto**)_upb_array_ptr(arr); |
| 4939 | } else { |
| 4940 | if (size) *size = 0; |
| 4941 | return NULL; |
| 4942 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4943 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4944 | 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] | 4945 | 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] | 4946 | return (google_protobuf_ServiceDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4947 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4948 | 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] | 4949 | 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] | 4950 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 4951 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 4952 | return NULL; |
| 4953 | } |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 4954 | 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] | 4955 | if (!arr || !sub) return NULL; |
| 4956 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4957 | return sub; |
| 4958 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4959 | 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] | 4960 | 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] | 4961 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 4962 | if (arr) { |
| 4963 | if (size) *size = arr->size; |
| 4964 | return (google_protobuf_FieldDescriptorProto**)_upb_array_ptr(arr); |
| 4965 | } else { |
| 4966 | if (size) *size = 0; |
| 4967 | return NULL; |
| 4968 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4969 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4970 | 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] | 4971 | 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] | 4972 | return (google_protobuf_FieldDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4973 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4974 | 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] | 4975 | 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] | 4976 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 4977 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 4978 | return NULL; |
| 4979 | } |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 4980 | 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] | 4981 | if (!arr || !sub) return NULL; |
| 4982 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4983 | return sub; |
| 4984 | } |
| 4985 | 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] | 4986 | 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] | 4987 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 4988 | } |
| 4989 | 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] | 4990 | struct google_protobuf_FileOptions* sub = (struct google_protobuf_FileOptions*)google_protobuf_FileDescriptorProto_options(msg); |
| 4991 | if (sub == NULL) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 4992 | 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] | 4993 | if (sub) google_protobuf_FileDescriptorProto_set_options(msg, sub); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4994 | } |
| 4995 | return sub; |
| 4996 | } |
| 4997 | 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] | 4998 | 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] | 4999 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 5000 | } |
| 5001 | 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] | 5002 | struct google_protobuf_SourceCodeInfo* sub = (struct google_protobuf_SourceCodeInfo*)google_protobuf_FileDescriptorProto_source_code_info(msg); |
| 5003 | if (sub == NULL) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 5004 | 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] | 5005 | if (sub) google_protobuf_FileDescriptorProto_set_source_code_info(msg, sub); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5006 | } |
| 5007 | return sub; |
| 5008 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5009 | 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] | 5010 | 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] | 5011 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 5012 | if (arr) { |
| 5013 | if (size) *size = arr->size; |
| 5014 | return (int32_t*)_upb_array_ptr(arr); |
| 5015 | } else { |
| 5016 | if (size) *size = 0; |
| 5017 | return NULL; |
| 5018 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5019 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5020 | 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] | 5021 | 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] | 5022 | return (int32_t*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5023 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5024 | 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] | 5025 | 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] | 5026 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 5027 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 5028 | return false; |
| 5029 | } |
| 5030 | _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val)); |
| 5031 | return true; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5032 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5033 | 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] | 5034 | 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] | 5035 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 5036 | if (arr) { |
| 5037 | if (size) *size = arr->size; |
| 5038 | return (int32_t*)_upb_array_ptr(arr); |
| 5039 | } else { |
| 5040 | if (size) *size = 0; |
| 5041 | return NULL; |
| 5042 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5043 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5044 | 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] | 5045 | 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] | 5046 | return (int32_t*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5047 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5048 | 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] | 5049 | 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] | 5050 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 5051 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 5052 | return false; |
| 5053 | } |
| 5054 | _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val)); |
| 5055 | return true; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5056 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5057 | 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] | 5058 | 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] | 5059 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 5060 | } |
Protobuf Team Bot | ab58f8f | 2023-09-26 16:14:19 +0000 | [diff] [blame] | 5061 | UPB_INLINE void google_protobuf_FileDescriptorProto_set_edition(google_protobuf_FileDescriptorProto *msg, int32_t value) { |
| 5062 | const upb_MiniTableField field = {14, UPB_SIZE(40, 4), 6, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 5063 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5064 | } |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 5065 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5066 | /* google.protobuf.DescriptorProto */ |
| 5067 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5068 | UPB_INLINE google_protobuf_DescriptorProto* google_protobuf_DescriptorProto_new(upb_Arena* arena) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 5069 | 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] | 5070 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5071 | UPB_INLINE google_protobuf_DescriptorProto* google_protobuf_DescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 5072 | google_protobuf_DescriptorProto* ret = google_protobuf_DescriptorProto_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 5073 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 5074 | 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] | 5075 | return NULL; |
| 5076 | } |
| 5077 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5078 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5079 | UPB_INLINE google_protobuf_DescriptorProto* google_protobuf_DescriptorProto_parse_ex(const char* buf, size_t size, |
| 5080 | const upb_ExtensionRegistry* extreg, |
| 5081 | int options, upb_Arena* arena) { |
| 5082 | google_protobuf_DescriptorProto* ret = google_protobuf_DescriptorProto_new(arena); |
| 5083 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 5084 | 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] | 5085 | kUpb_DecodeStatus_Ok) { |
| 5086 | return NULL; |
| 5087 | } |
| 5088 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5089 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5090 | 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] | 5091 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 5092 | (void)upb_Encode(msg, &google__protobuf__DescriptorProto_msg_init, 0, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5093 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5094 | } |
| 5095 | UPB_INLINE char* google_protobuf_DescriptorProto_serialize_ex(const google_protobuf_DescriptorProto* msg, int options, |
| 5096 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5097 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 5098 | (void)upb_Encode(msg, &google__protobuf__DescriptorProto_msg_init, options, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5099 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5100 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5101 | UPB_INLINE void google_protobuf_DescriptorProto_clear_name(google_protobuf_DescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5102 | 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] | 5103 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5104 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5105 | 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] | 5106 | upb_StringView default_val = upb_StringView_FromString(""); |
| 5107 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5108 | 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] | 5109 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 5110 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5111 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5112 | 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] | 5113 | 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] | 5114 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5115 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5116 | UPB_INLINE void google_protobuf_DescriptorProto_clear_field(google_protobuf_DescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5117 | 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] | 5118 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5119 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5120 | 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] | 5121 | 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] | 5122 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 5123 | if (arr) { |
| 5124 | if (size) *size = arr->size; |
| 5125 | return (const google_protobuf_FieldDescriptorProto* const*)_upb_array_constptr(arr); |
| 5126 | } else { |
| 5127 | if (size) *size = 0; |
| 5128 | return NULL; |
| 5129 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5130 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 5131 | 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] | 5132 | 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] | 5133 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 5134 | if (size) { |
| 5135 | *size = arr ? arr->size : 0; |
| 5136 | } |
| 5137 | return arr; |
| 5138 | } |
| 5139 | 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] | 5140 | 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] | 5141 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 5142 | (upb_Message*)msg, &field, arena); |
| 5143 | if (size) { |
| 5144 | *size = arr ? arr->size : 0; |
| 5145 | } |
| 5146 | return arr; |
| 5147 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5148 | UPB_INLINE bool google_protobuf_DescriptorProto_has_field(const google_protobuf_DescriptorProto* msg) { |
| 5149 | size_t size; |
| 5150 | google_protobuf_DescriptorProto_field(msg, &size); |
| 5151 | return size != 0; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5152 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5153 | 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] | 5154 | 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] | 5155 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5156 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5157 | 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] | 5158 | 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] | 5159 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 5160 | if (arr) { |
| 5161 | if (size) *size = arr->size; |
| 5162 | return (const google_protobuf_DescriptorProto* const*)_upb_array_constptr(arr); |
| 5163 | } else { |
| 5164 | if (size) *size = 0; |
| 5165 | return NULL; |
| 5166 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5167 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 5168 | 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] | 5169 | 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] | 5170 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 5171 | if (size) { |
| 5172 | *size = arr ? arr->size : 0; |
| 5173 | } |
| 5174 | return arr; |
| 5175 | } |
| 5176 | 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] | 5177 | 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] | 5178 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 5179 | (upb_Message*)msg, &field, arena); |
| 5180 | if (size) { |
| 5181 | *size = arr ? arr->size : 0; |
| 5182 | } |
| 5183 | return arr; |
| 5184 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5185 | UPB_INLINE bool google_protobuf_DescriptorProto_has_nested_type(const google_protobuf_DescriptorProto* msg) { |
| 5186 | size_t size; |
| 5187 | google_protobuf_DescriptorProto_nested_type(msg, &size); |
| 5188 | return size != 0; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5189 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5190 | 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] | 5191 | 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] | 5192 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5193 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5194 | 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] | 5195 | 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] | 5196 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 5197 | if (arr) { |
| 5198 | if (size) *size = arr->size; |
| 5199 | return (const google_protobuf_EnumDescriptorProto* const*)_upb_array_constptr(arr); |
| 5200 | } else { |
| 5201 | if (size) *size = 0; |
| 5202 | return NULL; |
| 5203 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5204 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 5205 | 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] | 5206 | 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] | 5207 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 5208 | if (size) { |
| 5209 | *size = arr ? arr->size : 0; |
| 5210 | } |
| 5211 | return arr; |
| 5212 | } |
| 5213 | 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] | 5214 | 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] | 5215 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 5216 | (upb_Message*)msg, &field, arena); |
| 5217 | if (size) { |
| 5218 | *size = arr ? arr->size : 0; |
| 5219 | } |
| 5220 | return arr; |
| 5221 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5222 | UPB_INLINE bool google_protobuf_DescriptorProto_has_enum_type(const google_protobuf_DescriptorProto* msg) { |
| 5223 | size_t size; |
| 5224 | google_protobuf_DescriptorProto_enum_type(msg, &size); |
| 5225 | return size != 0; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5226 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5227 | 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] | 5228 | 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] | 5229 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5230 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5231 | 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] | 5232 | 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] | 5233 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 5234 | if (arr) { |
| 5235 | if (size) *size = arr->size; |
| 5236 | return (const google_protobuf_DescriptorProto_ExtensionRange* const*)_upb_array_constptr(arr); |
| 5237 | } else { |
| 5238 | if (size) *size = 0; |
| 5239 | return NULL; |
| 5240 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5241 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 5242 | 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] | 5243 | 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] | 5244 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 5245 | if (size) { |
| 5246 | *size = arr ? arr->size : 0; |
| 5247 | } |
| 5248 | return arr; |
| 5249 | } |
| 5250 | 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] | 5251 | 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] | 5252 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 5253 | (upb_Message*)msg, &field, arena); |
| 5254 | if (size) { |
| 5255 | *size = arr ? arr->size : 0; |
| 5256 | } |
| 5257 | return arr; |
| 5258 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5259 | UPB_INLINE bool google_protobuf_DescriptorProto_has_extension_range(const google_protobuf_DescriptorProto* msg) { |
| 5260 | size_t size; |
| 5261 | google_protobuf_DescriptorProto_extension_range(msg, &size); |
| 5262 | return size != 0; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5263 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5264 | UPB_INLINE void google_protobuf_DescriptorProto_clear_extension(google_protobuf_DescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5265 | 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] | 5266 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5267 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5268 | 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] | 5269 | 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] | 5270 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 5271 | if (arr) { |
| 5272 | if (size) *size = arr->size; |
| 5273 | return (const google_protobuf_FieldDescriptorProto* const*)_upb_array_constptr(arr); |
| 5274 | } else { |
| 5275 | if (size) *size = 0; |
| 5276 | return NULL; |
| 5277 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5278 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 5279 | 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] | 5280 | 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] | 5281 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 5282 | if (size) { |
| 5283 | *size = arr ? arr->size : 0; |
| 5284 | } |
| 5285 | return arr; |
| 5286 | } |
| 5287 | 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] | 5288 | 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] | 5289 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 5290 | (upb_Message*)msg, &field, arena); |
| 5291 | if (size) { |
| 5292 | *size = arr ? arr->size : 0; |
| 5293 | } |
| 5294 | return arr; |
| 5295 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5296 | UPB_INLINE bool google_protobuf_DescriptorProto_has_extension(const google_protobuf_DescriptorProto* msg) { |
| 5297 | size_t size; |
| 5298 | google_protobuf_DescriptorProto_extension(msg, &size); |
| 5299 | return size != 0; |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5300 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5301 | UPB_INLINE void google_protobuf_DescriptorProto_clear_options(google_protobuf_DescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5302 | 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] | 5303 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5304 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5305 | 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] | 5306 | const google_protobuf_MessageOptions* default_val = NULL; |
| 5307 | const google_protobuf_MessageOptions* ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5308 | 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] | 5309 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 5310 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5311 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5312 | 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] | 5313 | 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] | 5314 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5315 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5316 | 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] | 5317 | 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] | 5318 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5319 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5320 | 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] | 5321 | 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] | 5322 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 5323 | if (arr) { |
| 5324 | if (size) *size = arr->size; |
| 5325 | return (const google_protobuf_OneofDescriptorProto* const*)_upb_array_constptr(arr); |
| 5326 | } else { |
| 5327 | if (size) *size = 0; |
| 5328 | return NULL; |
| 5329 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5330 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 5331 | 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] | 5332 | 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] | 5333 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 5334 | if (size) { |
| 5335 | *size = arr ? arr->size : 0; |
| 5336 | } |
| 5337 | return arr; |
| 5338 | } |
| 5339 | 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] | 5340 | 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] | 5341 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 5342 | (upb_Message*)msg, &field, arena); |
| 5343 | if (size) { |
| 5344 | *size = arr ? arr->size : 0; |
| 5345 | } |
| 5346 | return arr; |
| 5347 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5348 | UPB_INLINE bool google_protobuf_DescriptorProto_has_oneof_decl(const google_protobuf_DescriptorProto* msg) { |
| 5349 | size_t size; |
| 5350 | google_protobuf_DescriptorProto_oneof_decl(msg, &size); |
| 5351 | return size != 0; |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5352 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5353 | 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] | 5354 | 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] | 5355 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5356 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5357 | 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] | 5358 | 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] | 5359 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 5360 | if (arr) { |
| 5361 | if (size) *size = arr->size; |
| 5362 | return (const google_protobuf_DescriptorProto_ReservedRange* const*)_upb_array_constptr(arr); |
| 5363 | } else { |
| 5364 | if (size) *size = 0; |
| 5365 | return NULL; |
| 5366 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5367 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 5368 | 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] | 5369 | 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] | 5370 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 5371 | if (size) { |
| 5372 | *size = arr ? arr->size : 0; |
| 5373 | } |
| 5374 | return arr; |
| 5375 | } |
| 5376 | 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] | 5377 | 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] | 5378 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 5379 | (upb_Message*)msg, &field, arena); |
| 5380 | if (size) { |
| 5381 | *size = arr ? arr->size : 0; |
| 5382 | } |
| 5383 | return arr; |
| 5384 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5385 | UPB_INLINE bool google_protobuf_DescriptorProto_has_reserved_range(const google_protobuf_DescriptorProto* msg) { |
| 5386 | size_t size; |
| 5387 | google_protobuf_DescriptorProto_reserved_range(msg, &size); |
| 5388 | return size != 0; |
| 5389 | } |
| 5390 | 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] | 5391 | 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] | 5392 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5393 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5394 | 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] | 5395 | 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] | 5396 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 5397 | if (arr) { |
| 5398 | if (size) *size = arr->size; |
| 5399 | return (upb_StringView const*)_upb_array_constptr(arr); |
| 5400 | } else { |
| 5401 | if (size) *size = 0; |
| 5402 | return NULL; |
| 5403 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5404 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 5405 | 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] | 5406 | 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] | 5407 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 5408 | if (size) { |
| 5409 | *size = arr ? arr->size : 0; |
| 5410 | } |
| 5411 | return arr; |
| 5412 | } |
| 5413 | 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] | 5414 | 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] | 5415 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 5416 | (upb_Message*)msg, &field, arena); |
| 5417 | if (size) { |
| 5418 | *size = arr ? arr->size : 0; |
| 5419 | } |
| 5420 | return arr; |
| 5421 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5422 | UPB_INLINE bool google_protobuf_DescriptorProto_has_reserved_name(const google_protobuf_DescriptorProto* msg) { |
| 5423 | size_t size; |
| 5424 | google_protobuf_DescriptorProto_reserved_name(msg, &size); |
| 5425 | return size != 0; |
| 5426 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5427 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5428 | 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] | 5429 | 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] | 5430 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 5431 | } |
| 5432 | 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] | 5433 | 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] | 5434 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 5435 | if (arr) { |
| 5436 | if (size) *size = arr->size; |
| 5437 | return (google_protobuf_FieldDescriptorProto**)_upb_array_ptr(arr); |
| 5438 | } else { |
| 5439 | if (size) *size = 0; |
| 5440 | return NULL; |
| 5441 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5442 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5443 | 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] | 5444 | 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] | 5445 | return (google_protobuf_FieldDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5446 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5447 | 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] | 5448 | 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] | 5449 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 5450 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 5451 | return NULL; |
| 5452 | } |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 5453 | 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] | 5454 | if (!arr || !sub) return NULL; |
| 5455 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5456 | return sub; |
| 5457 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5458 | 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] | 5459 | 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] | 5460 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 5461 | if (arr) { |
| 5462 | if (size) *size = arr->size; |
| 5463 | return (google_protobuf_DescriptorProto**)_upb_array_ptr(arr); |
| 5464 | } else { |
| 5465 | if (size) *size = 0; |
| 5466 | return NULL; |
| 5467 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5468 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5469 | 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] | 5470 | 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] | 5471 | return (google_protobuf_DescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5472 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5473 | 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] | 5474 | 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] | 5475 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 5476 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 5477 | return NULL; |
| 5478 | } |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 5479 | 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] | 5480 | if (!arr || !sub) return NULL; |
| 5481 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5482 | return sub; |
| 5483 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5484 | 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] | 5485 | 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] | 5486 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 5487 | if (arr) { |
| 5488 | if (size) *size = arr->size; |
| 5489 | return (google_protobuf_EnumDescriptorProto**)_upb_array_ptr(arr); |
| 5490 | } else { |
| 5491 | if (size) *size = 0; |
| 5492 | return NULL; |
| 5493 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5494 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5495 | 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] | 5496 | 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] | 5497 | return (google_protobuf_EnumDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5498 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5499 | 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] | 5500 | 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] | 5501 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 5502 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 5503 | return NULL; |
| 5504 | } |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 5505 | 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] | 5506 | if (!arr || !sub) return NULL; |
| 5507 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5508 | return sub; |
| 5509 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5510 | 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] | 5511 | 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] | 5512 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 5513 | if (arr) { |
| 5514 | if (size) *size = arr->size; |
| 5515 | return (google_protobuf_DescriptorProto_ExtensionRange**)_upb_array_ptr(arr); |
| 5516 | } else { |
| 5517 | if (size) *size = 0; |
| 5518 | return NULL; |
| 5519 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5520 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5521 | 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] | 5522 | 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] | 5523 | return (google_protobuf_DescriptorProto_ExtensionRange**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5524 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5525 | 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] | 5526 | 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] | 5527 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 5528 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 5529 | return NULL; |
| 5530 | } |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 5531 | 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] | 5532 | if (!arr || !sub) return NULL; |
| 5533 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5534 | return sub; |
| 5535 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5536 | 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] | 5537 | 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] | 5538 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 5539 | if (arr) { |
| 5540 | if (size) *size = arr->size; |
| 5541 | return (google_protobuf_FieldDescriptorProto**)_upb_array_ptr(arr); |
| 5542 | } else { |
| 5543 | if (size) *size = 0; |
| 5544 | return NULL; |
| 5545 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5546 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5547 | 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] | 5548 | 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] | 5549 | return (google_protobuf_FieldDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5550 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5551 | 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] | 5552 | 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] | 5553 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 5554 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 5555 | return NULL; |
| 5556 | } |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 5557 | 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] | 5558 | if (!arr || !sub) return NULL; |
| 5559 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5560 | return sub; |
| 5561 | } |
| 5562 | 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] | 5563 | 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] | 5564 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 5565 | } |
| 5566 | 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] | 5567 | struct google_protobuf_MessageOptions* sub = (struct google_protobuf_MessageOptions*)google_protobuf_DescriptorProto_options(msg); |
| 5568 | if (sub == NULL) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 5569 | 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] | 5570 | if (sub) google_protobuf_DescriptorProto_set_options(msg, sub); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5571 | } |
| 5572 | return sub; |
| 5573 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5574 | 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] | 5575 | 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] | 5576 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 5577 | if (arr) { |
| 5578 | if (size) *size = arr->size; |
| 5579 | return (google_protobuf_OneofDescriptorProto**)_upb_array_ptr(arr); |
| 5580 | } else { |
| 5581 | if (size) *size = 0; |
| 5582 | return NULL; |
| 5583 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5584 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5585 | 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] | 5586 | 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] | 5587 | return (google_protobuf_OneofDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5588 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5589 | 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] | 5590 | 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] | 5591 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 5592 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 5593 | return NULL; |
| 5594 | } |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 5595 | 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] | 5596 | if (!arr || !sub) return NULL; |
| 5597 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5598 | return sub; |
| 5599 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5600 | 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] | 5601 | 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] | 5602 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 5603 | if (arr) { |
| 5604 | if (size) *size = arr->size; |
| 5605 | return (google_protobuf_DescriptorProto_ReservedRange**)_upb_array_ptr(arr); |
| 5606 | } else { |
| 5607 | if (size) *size = 0; |
| 5608 | return NULL; |
| 5609 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5610 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5611 | 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] | 5612 | 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] | 5613 | return (google_protobuf_DescriptorProto_ReservedRange**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5614 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5615 | 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] | 5616 | 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] | 5617 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 5618 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 5619 | return NULL; |
| 5620 | } |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 5621 | 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] | 5622 | if (!arr || !sub) return NULL; |
| 5623 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5624 | return sub; |
| 5625 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5626 | 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] | 5627 | 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] | 5628 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 5629 | if (arr) { |
| 5630 | if (size) *size = arr->size; |
| 5631 | return (upb_StringView*)_upb_array_ptr(arr); |
| 5632 | } else { |
| 5633 | if (size) *size = 0; |
| 5634 | return NULL; |
| 5635 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5636 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5637 | 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] | 5638 | 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] | 5639 | return (upb_StringView*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5640 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5641 | 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] | 5642 | 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] | 5643 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 5644 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 5645 | return false; |
| 5646 | } |
| 5647 | _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val)); |
| 5648 | return true; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5649 | } |
| 5650 | |
| 5651 | /* google.protobuf.DescriptorProto.ExtensionRange */ |
| 5652 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5653 | UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange* google_protobuf_DescriptorProto_ExtensionRange_new(upb_Arena* arena) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 5654 | 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] | 5655 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5656 | UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange* google_protobuf_DescriptorProto_ExtensionRange_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 5657 | google_protobuf_DescriptorProto_ExtensionRange* ret = google_protobuf_DescriptorProto_ExtensionRange_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 5658 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 5659 | 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] | 5660 | return NULL; |
| 5661 | } |
| 5662 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5663 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5664 | UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange* google_protobuf_DescriptorProto_ExtensionRange_parse_ex(const char* buf, size_t size, |
| 5665 | const upb_ExtensionRegistry* extreg, |
| 5666 | int options, upb_Arena* arena) { |
| 5667 | google_protobuf_DescriptorProto_ExtensionRange* ret = google_protobuf_DescriptorProto_ExtensionRange_new(arena); |
| 5668 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 5669 | 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] | 5670 | kUpb_DecodeStatus_Ok) { |
| 5671 | return NULL; |
| 5672 | } |
| 5673 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5674 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5675 | 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] | 5676 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 5677 | (void)upb_Encode(msg, &google__protobuf__DescriptorProto__ExtensionRange_msg_init, 0, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5678 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5679 | } |
| 5680 | UPB_INLINE char* google_protobuf_DescriptorProto_ExtensionRange_serialize_ex(const google_protobuf_DescriptorProto_ExtensionRange* msg, int options, |
| 5681 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5682 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 5683 | (void)upb_Encode(msg, &google__protobuf__DescriptorProto__ExtensionRange_msg_init, options, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5684 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5685 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5686 | 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] | 5687 | 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] | 5688 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5689 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5690 | 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] | 5691 | int32_t default_val = (int32_t)0; |
| 5692 | int32_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5693 | 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] | 5694 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 5695 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5696 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5697 | 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] | 5698 | 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] | 5699 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5700 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5701 | 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] | 5702 | 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] | 5703 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5704 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5705 | 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] | 5706 | int32_t default_val = (int32_t)0; |
| 5707 | int32_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5708 | 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] | 5709 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 5710 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5711 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5712 | 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] | 5713 | 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] | 5714 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5715 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5716 | 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] | 5717 | 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] | 5718 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5719 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5720 | 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] | 5721 | const google_protobuf_ExtensionRangeOptions* default_val = NULL; |
| 5722 | const google_protobuf_ExtensionRangeOptions* ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5723 | 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] | 5724 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 5725 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5726 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5727 | 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] | 5728 | 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] | 5729 | return _upb_Message_HasNonExtensionField(msg, &field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5730 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5731 | |
| 5732 | 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] | 5733 | const upb_MiniTableField field = {1, 4, 1, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 5734 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 5735 | } |
| 5736 | 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] | 5737 | 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] | 5738 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 5739 | } |
| 5740 | 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] | 5741 | 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] | 5742 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 5743 | } |
| 5744 | 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] | 5745 | struct google_protobuf_ExtensionRangeOptions* sub = (struct google_protobuf_ExtensionRangeOptions*)google_protobuf_DescriptorProto_ExtensionRange_options(msg); |
| 5746 | if (sub == NULL) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 5747 | 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] | 5748 | if (sub) google_protobuf_DescriptorProto_ExtensionRange_set_options(msg, sub); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5749 | } |
| 5750 | return sub; |
| 5751 | } |
| 5752 | |
| 5753 | /* google.protobuf.DescriptorProto.ReservedRange */ |
| 5754 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5755 | UPB_INLINE google_protobuf_DescriptorProto_ReservedRange* google_protobuf_DescriptorProto_ReservedRange_new(upb_Arena* arena) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 5756 | 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] | 5757 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5758 | UPB_INLINE google_protobuf_DescriptorProto_ReservedRange* google_protobuf_DescriptorProto_ReservedRange_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 5759 | google_protobuf_DescriptorProto_ReservedRange* ret = google_protobuf_DescriptorProto_ReservedRange_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 5760 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 5761 | 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] | 5762 | return NULL; |
| 5763 | } |
| 5764 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5765 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5766 | UPB_INLINE google_protobuf_DescriptorProto_ReservedRange* google_protobuf_DescriptorProto_ReservedRange_parse_ex(const char* buf, size_t size, |
| 5767 | const upb_ExtensionRegistry* extreg, |
| 5768 | int options, upb_Arena* arena) { |
| 5769 | google_protobuf_DescriptorProto_ReservedRange* ret = google_protobuf_DescriptorProto_ReservedRange_new(arena); |
| 5770 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 5771 | 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] | 5772 | kUpb_DecodeStatus_Ok) { |
| 5773 | return NULL; |
| 5774 | } |
| 5775 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5776 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5777 | 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] | 5778 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 5779 | (void)upb_Encode(msg, &google__protobuf__DescriptorProto__ReservedRange_msg_init, 0, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5780 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5781 | } |
| 5782 | UPB_INLINE char* google_protobuf_DescriptorProto_ReservedRange_serialize_ex(const google_protobuf_DescriptorProto_ReservedRange* msg, int options, |
| 5783 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5784 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 5785 | (void)upb_Encode(msg, &google__protobuf__DescriptorProto__ReservedRange_msg_init, options, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5786 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5787 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5788 | 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] | 5789 | 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] | 5790 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5791 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5792 | 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] | 5793 | int32_t default_val = (int32_t)0; |
| 5794 | int32_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5795 | 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] | 5796 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 5797 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5798 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5799 | 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] | 5800 | 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] | 5801 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5802 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5803 | 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] | 5804 | 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] | 5805 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5806 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5807 | 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] | 5808 | int32_t default_val = (int32_t)0; |
| 5809 | int32_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5810 | 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] | 5811 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 5812 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5813 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5814 | 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] | 5815 | 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] | 5816 | return _upb_Message_HasNonExtensionField(msg, &field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5817 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5818 | |
| 5819 | 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] | 5820 | 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] | 5821 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 5822 | } |
| 5823 | 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] | 5824 | 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] | 5825 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5826 | } |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 5827 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5828 | /* google.protobuf.ExtensionRangeOptions */ |
| 5829 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5830 | UPB_INLINE google_protobuf_ExtensionRangeOptions* google_protobuf_ExtensionRangeOptions_new(upb_Arena* arena) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 5831 | 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] | 5832 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5833 | UPB_INLINE google_protobuf_ExtensionRangeOptions* google_protobuf_ExtensionRangeOptions_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 5834 | google_protobuf_ExtensionRangeOptions* ret = google_protobuf_ExtensionRangeOptions_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 5835 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 5836 | 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] | 5837 | return NULL; |
| 5838 | } |
| 5839 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5840 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5841 | UPB_INLINE google_protobuf_ExtensionRangeOptions* google_protobuf_ExtensionRangeOptions_parse_ex(const char* buf, size_t size, |
| 5842 | const upb_ExtensionRegistry* extreg, |
| 5843 | int options, upb_Arena* arena) { |
| 5844 | google_protobuf_ExtensionRangeOptions* ret = google_protobuf_ExtensionRangeOptions_new(arena); |
| 5845 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 5846 | 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] | 5847 | kUpb_DecodeStatus_Ok) { |
| 5848 | return NULL; |
| 5849 | } |
| 5850 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5851 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5852 | 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] | 5853 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 5854 | (void)upb_Encode(msg, &google__protobuf__ExtensionRangeOptions_msg_init, 0, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5855 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5856 | } |
| 5857 | UPB_INLINE char* google_protobuf_ExtensionRangeOptions_serialize_ex(const google_protobuf_ExtensionRangeOptions* msg, int options, |
| 5858 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5859 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 5860 | (void)upb_Encode(msg, &google__protobuf__ExtensionRangeOptions_msg_init, options, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5861 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5862 | } |
Mike Kruskal | 145900f | 2023-03-27 09:55:52 -0700 | [diff] [blame] | 5863 | UPB_INLINE void google_protobuf_ExtensionRangeOptions_clear_declaration(google_protobuf_ExtensionRangeOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5864 | 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] | 5865 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 5866 | } |
| 5867 | 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] | 5868 | 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] | 5869 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 5870 | if (arr) { |
| 5871 | if (size) *size = arr->size; |
| 5872 | return (const google_protobuf_ExtensionRangeOptions_Declaration* const*)_upb_array_constptr(arr); |
| 5873 | } else { |
| 5874 | if (size) *size = 0; |
| 5875 | return NULL; |
| 5876 | } |
| 5877 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 5878 | 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] | 5879 | 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] | 5880 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 5881 | if (size) { |
| 5882 | *size = arr ? arr->size : 0; |
| 5883 | } |
| 5884 | return arr; |
| 5885 | } |
| 5886 | 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] | 5887 | 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] | 5888 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 5889 | (upb_Message*)msg, &field, arena); |
| 5890 | if (size) { |
| 5891 | *size = arr ? arr->size : 0; |
| 5892 | } |
| 5893 | return arr; |
| 5894 | } |
Mike Kruskal | 145900f | 2023-03-27 09:55:52 -0700 | [diff] [blame] | 5895 | UPB_INLINE bool google_protobuf_ExtensionRangeOptions_has_declaration(const google_protobuf_ExtensionRangeOptions* msg) { |
| 5896 | size_t size; |
| 5897 | google_protobuf_ExtensionRangeOptions_declaration(msg, &size); |
| 5898 | return size != 0; |
| 5899 | } |
Protobuf Team Bot | 469f027 | 2023-04-21 18:12:45 -0700 | [diff] [blame] | 5900 | UPB_INLINE void google_protobuf_ExtensionRangeOptions_clear_verification(google_protobuf_ExtensionRangeOptions* msg) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 5901 | 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] | 5902 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 5903 | } |
| 5904 | UPB_INLINE int32_t google_protobuf_ExtensionRangeOptions_verification(const google_protobuf_ExtensionRangeOptions* msg) { |
| 5905 | int32_t default_val = 1; |
| 5906 | int32_t ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 5907 | 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] | 5908 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 5909 | return ret; |
| 5910 | } |
| 5911 | 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] | 5912 | const upb_MiniTableField field = {3, UPB_SIZE(8, 4), 1, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
| 5913 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 5914 | } |
| 5915 | UPB_INLINE void google_protobuf_ExtensionRangeOptions_clear_features(google_protobuf_ExtensionRangeOptions* msg) { |
| 5916 | 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)}; |
| 5917 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 5918 | } |
| 5919 | UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_ExtensionRangeOptions_features(const google_protobuf_ExtensionRangeOptions* msg) { |
| 5920 | const google_protobuf_FeatureSet* default_val = NULL; |
| 5921 | const google_protobuf_FeatureSet* ret; |
| 5922 | 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)}; |
| 5923 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 5924 | return ret; |
| 5925 | } |
| 5926 | UPB_INLINE bool google_protobuf_ExtensionRangeOptions_has_features(const google_protobuf_ExtensionRangeOptions* msg) { |
| 5927 | 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] | 5928 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 5929 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5930 | 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] | 5931 | 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] | 5932 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5933 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5934 | 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] | 5935 | 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] | 5936 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 5937 | if (arr) { |
| 5938 | if (size) *size = arr->size; |
| 5939 | return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr); |
| 5940 | } else { |
| 5941 | if (size) *size = 0; |
| 5942 | return NULL; |
| 5943 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5944 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 5945 | 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] | 5946 | 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] | 5947 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 5948 | if (size) { |
| 5949 | *size = arr ? arr->size : 0; |
| 5950 | } |
| 5951 | return arr; |
| 5952 | } |
| 5953 | 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] | 5954 | 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] | 5955 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 5956 | (upb_Message*)msg, &field, arena); |
| 5957 | if (size) { |
| 5958 | *size = arr ? arr->size : 0; |
| 5959 | } |
| 5960 | return arr; |
| 5961 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5962 | UPB_INLINE bool google_protobuf_ExtensionRangeOptions_has_uninterpreted_option(const google_protobuf_ExtensionRangeOptions* msg) { |
| 5963 | size_t size; |
| 5964 | google_protobuf_ExtensionRangeOptions_uninterpreted_option(msg, &size); |
| 5965 | return size != 0; |
| 5966 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5967 | |
Mike Kruskal | 145900f | 2023-03-27 09:55:52 -0700 | [diff] [blame] | 5968 | 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] | 5969 | 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] | 5970 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 5971 | if (arr) { |
| 5972 | if (size) *size = arr->size; |
| 5973 | return (google_protobuf_ExtensionRangeOptions_Declaration**)_upb_array_ptr(arr); |
| 5974 | } else { |
| 5975 | if (size) *size = 0; |
| 5976 | return NULL; |
| 5977 | } |
| 5978 | } |
| 5979 | 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] | 5980 | 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] | 5981 | return (google_protobuf_ExtensionRangeOptions_Declaration**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Mike Kruskal | 145900f | 2023-03-27 09:55:52 -0700 | [diff] [blame] | 5982 | } |
| 5983 | 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] | 5984 | 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] | 5985 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 5986 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 5987 | return NULL; |
| 5988 | } |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 5989 | struct google_protobuf_ExtensionRangeOptions_Declaration* sub = (struct google_protobuf_ExtensionRangeOptions_Declaration*)_upb_Message_New(&google__protobuf__ExtensionRangeOptions__Declaration_msg_init, arena); |
Mike Kruskal | 145900f | 2023-03-27 09:55:52 -0700 | [diff] [blame] | 5990 | if (!arr || !sub) return NULL; |
| 5991 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
| 5992 | return sub; |
| 5993 | } |
Protobuf Team Bot | 469f027 | 2023-04-21 18:12:45 -0700 | [diff] [blame] | 5994 | 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] | 5995 | 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] | 5996 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 5997 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 5998 | UPB_INLINE void google_protobuf_ExtensionRangeOptions_set_features(google_protobuf_ExtensionRangeOptions *msg, google_protobuf_FeatureSet* value) { |
| 5999 | 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)}; |
| 6000 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 6001 | } |
| 6002 | UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_ExtensionRangeOptions_mutable_features(google_protobuf_ExtensionRangeOptions* msg, upb_Arena* arena) { |
| 6003 | struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_ExtensionRangeOptions_features(msg); |
| 6004 | if (sub == NULL) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6005 | sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena); |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 6006 | if (sub) google_protobuf_ExtensionRangeOptions_set_features(msg, sub); |
| 6007 | } |
| 6008 | return sub; |
| 6009 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 6010 | 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] | 6011 | 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] | 6012 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 6013 | if (arr) { |
| 6014 | if (size) *size = arr->size; |
| 6015 | return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr); |
| 6016 | } else { |
| 6017 | if (size) *size = 0; |
| 6018 | return NULL; |
| 6019 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6020 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 6021 | 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] | 6022 | 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] | 6023 | return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6024 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6025 | 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] | 6026 | 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] | 6027 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 6028 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 6029 | return NULL; |
| 6030 | } |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6031 | 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] | 6032 | if (!arr || !sub) return NULL; |
| 6033 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6034 | return sub; |
| 6035 | } |
| 6036 | |
Mike Kruskal | 145900f | 2023-03-27 09:55:52 -0700 | [diff] [blame] | 6037 | /* google.protobuf.ExtensionRangeOptions.Declaration */ |
| 6038 | |
| 6039 | UPB_INLINE google_protobuf_ExtensionRangeOptions_Declaration* google_protobuf_ExtensionRangeOptions_Declaration_new(upb_Arena* arena) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6040 | return (google_protobuf_ExtensionRangeOptions_Declaration*)_upb_Message_New(&google__protobuf__ExtensionRangeOptions__Declaration_msg_init, arena); |
Mike Kruskal | 145900f | 2023-03-27 09:55:52 -0700 | [diff] [blame] | 6041 | } |
| 6042 | UPB_INLINE google_protobuf_ExtensionRangeOptions_Declaration* google_protobuf_ExtensionRangeOptions_Declaration_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 6043 | google_protobuf_ExtensionRangeOptions_Declaration* ret = google_protobuf_ExtensionRangeOptions_Declaration_new(arena); |
| 6044 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6045 | if (upb_Decode(buf, size, ret, &google__protobuf__ExtensionRangeOptions__Declaration_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { |
Mike Kruskal | 145900f | 2023-03-27 09:55:52 -0700 | [diff] [blame] | 6046 | return NULL; |
| 6047 | } |
| 6048 | return ret; |
| 6049 | } |
| 6050 | UPB_INLINE google_protobuf_ExtensionRangeOptions_Declaration* google_protobuf_ExtensionRangeOptions_Declaration_parse_ex(const char* buf, size_t size, |
| 6051 | const upb_ExtensionRegistry* extreg, |
| 6052 | int options, upb_Arena* arena) { |
| 6053 | google_protobuf_ExtensionRangeOptions_Declaration* ret = google_protobuf_ExtensionRangeOptions_Declaration_new(arena); |
| 6054 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6055 | if (upb_Decode(buf, size, ret, &google__protobuf__ExtensionRangeOptions__Declaration_msg_init, extreg, options, arena) != |
Mike Kruskal | 145900f | 2023-03-27 09:55:52 -0700 | [diff] [blame] | 6056 | kUpb_DecodeStatus_Ok) { |
| 6057 | return NULL; |
| 6058 | } |
| 6059 | return ret; |
| 6060 | } |
| 6061 | UPB_INLINE char* google_protobuf_ExtensionRangeOptions_Declaration_serialize(const google_protobuf_ExtensionRangeOptions_Declaration* msg, upb_Arena* arena, size_t* len) { |
| 6062 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6063 | (void)upb_Encode(msg, &google__protobuf__ExtensionRangeOptions__Declaration_msg_init, 0, arena, &ptr, len); |
Mike Kruskal | 145900f | 2023-03-27 09:55:52 -0700 | [diff] [blame] | 6064 | return ptr; |
| 6065 | } |
| 6066 | UPB_INLINE char* google_protobuf_ExtensionRangeOptions_Declaration_serialize_ex(const google_protobuf_ExtensionRangeOptions_Declaration* msg, int options, |
| 6067 | upb_Arena* arena, size_t* len) { |
| 6068 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6069 | (void)upb_Encode(msg, &google__protobuf__ExtensionRangeOptions__Declaration_msg_init, options, arena, &ptr, len); |
Mike Kruskal | 145900f | 2023-03-27 09:55:52 -0700 | [diff] [blame] | 6070 | return ptr; |
| 6071 | } |
| 6072 | 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] | 6073 | 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] | 6074 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 6075 | } |
| 6076 | UPB_INLINE int32_t google_protobuf_ExtensionRangeOptions_Declaration_number(const google_protobuf_ExtensionRangeOptions_Declaration* msg) { |
| 6077 | int32_t default_val = (int32_t)0; |
| 6078 | int32_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6079 | 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] | 6080 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 6081 | return ret; |
| 6082 | } |
| 6083 | 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] | 6084 | 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] | 6085 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 6086 | } |
| 6087 | 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] | 6088 | 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] | 6089 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 6090 | } |
| 6091 | UPB_INLINE upb_StringView google_protobuf_ExtensionRangeOptions_Declaration_full_name(const google_protobuf_ExtensionRangeOptions_Declaration* msg) { |
| 6092 | upb_StringView default_val = upb_StringView_FromString(""); |
| 6093 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6094 | 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] | 6095 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 6096 | return ret; |
| 6097 | } |
| 6098 | 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] | 6099 | 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] | 6100 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 6101 | } |
| 6102 | 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] | 6103 | 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] | 6104 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 6105 | } |
| 6106 | UPB_INLINE upb_StringView google_protobuf_ExtensionRangeOptions_Declaration_type(const google_protobuf_ExtensionRangeOptions_Declaration* msg) { |
| 6107 | upb_StringView default_val = upb_StringView_FromString(""); |
| 6108 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6109 | 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] | 6110 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 6111 | return ret; |
| 6112 | } |
| 6113 | 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] | 6114 | 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] | 6115 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 6116 | } |
Protobuf Team Bot | 41287bd | 2023-04-10 18:57:14 -0700 | [diff] [blame] | 6117 | 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] | 6118 | 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] | 6119 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 6120 | } |
| 6121 | UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_reserved(const google_protobuf_ExtensionRangeOptions_Declaration* msg) { |
| 6122 | bool default_val = false; |
| 6123 | bool ret; |
Sandy Zhang | 96c601d | 2023-07-05 12:39:20 -0700 | [diff] [blame] | 6124 | 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] | 6125 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 6126 | return ret; |
| 6127 | } |
| 6128 | 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] | 6129 | 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] | 6130 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 6131 | } |
Protobuf Team Bot | 469f027 | 2023-04-21 18:12:45 -0700 | [diff] [blame] | 6132 | 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] | 6133 | 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] | 6134 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 6135 | } |
| 6136 | UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_repeated(const google_protobuf_ExtensionRangeOptions_Declaration* msg) { |
| 6137 | bool default_val = false; |
| 6138 | bool ret; |
Sandy Zhang | 96c601d | 2023-07-05 12:39:20 -0700 | [diff] [blame] | 6139 | 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] | 6140 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 6141 | return ret; |
| 6142 | } |
| 6143 | 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] | 6144 | 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] | 6145 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 6146 | } |
Mike Kruskal | 145900f | 2023-03-27 09:55:52 -0700 | [diff] [blame] | 6147 | |
| 6148 | 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] | 6149 | 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] | 6150 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 6151 | } |
| 6152 | 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] | 6153 | 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] | 6154 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 6155 | } |
| 6156 | 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] | 6157 | 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] | 6158 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 6159 | } |
Protobuf Team Bot | 41287bd | 2023-04-10 18:57:14 -0700 | [diff] [blame] | 6160 | 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] | 6161 | 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] | 6162 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 6163 | } |
Protobuf Team Bot | 469f027 | 2023-04-21 18:12:45 -0700 | [diff] [blame] | 6164 | 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] | 6165 | 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] | 6166 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 6167 | } |
Mike Kruskal | 145900f | 2023-03-27 09:55:52 -0700 | [diff] [blame] | 6168 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6169 | /* google.protobuf.FieldDescriptorProto */ |
| 6170 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6171 | UPB_INLINE google_protobuf_FieldDescriptorProto* google_protobuf_FieldDescriptorProto_new(upb_Arena* arena) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6172 | 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] | 6173 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6174 | UPB_INLINE google_protobuf_FieldDescriptorProto* google_protobuf_FieldDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 6175 | google_protobuf_FieldDescriptorProto* ret = google_protobuf_FieldDescriptorProto_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 6176 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6177 | 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] | 6178 | return NULL; |
| 6179 | } |
| 6180 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6181 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6182 | UPB_INLINE google_protobuf_FieldDescriptorProto* google_protobuf_FieldDescriptorProto_parse_ex(const char* buf, size_t size, |
| 6183 | const upb_ExtensionRegistry* extreg, |
| 6184 | int options, upb_Arena* arena) { |
| 6185 | google_protobuf_FieldDescriptorProto* ret = google_protobuf_FieldDescriptorProto_new(arena); |
| 6186 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6187 | 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] | 6188 | kUpb_DecodeStatus_Ok) { |
| 6189 | return NULL; |
| 6190 | } |
| 6191 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6192 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6193 | 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] | 6194 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6195 | (void)upb_Encode(msg, &google__protobuf__FieldDescriptorProto_msg_init, 0, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6196 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6197 | } |
| 6198 | UPB_INLINE char* google_protobuf_FieldDescriptorProto_serialize_ex(const google_protobuf_FieldDescriptorProto* msg, int options, |
| 6199 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6200 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6201 | (void)upb_Encode(msg, &google__protobuf__FieldDescriptorProto_msg_init, options, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6202 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6203 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6204 | UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_name(google_protobuf_FieldDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6205 | 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] | 6206 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6207 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6208 | 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] | 6209 | upb_StringView default_val = upb_StringView_FromString(""); |
| 6210 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6211 | 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] | 6212 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6213 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6214 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6215 | 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] | 6216 | 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] | 6217 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6218 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6219 | UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_extendee(google_protobuf_FieldDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6220 | 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] | 6221 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6222 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6223 | 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] | 6224 | upb_StringView default_val = upb_StringView_FromString(""); |
| 6225 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6226 | 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] | 6227 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6228 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6229 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6230 | 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] | 6231 | 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] | 6232 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6233 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6234 | UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_number(google_protobuf_FieldDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6235 | 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] | 6236 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6237 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6238 | 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] | 6239 | int32_t default_val = (int32_t)0; |
| 6240 | int32_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6241 | 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] | 6242 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6243 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6244 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6245 | 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] | 6246 | 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] | 6247 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6248 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6249 | UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_label(google_protobuf_FieldDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6250 | 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] | 6251 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6252 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6253 | 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] | 6254 | int32_t default_val = 1; |
| 6255 | int32_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6256 | 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] | 6257 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6258 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6259 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6260 | 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] | 6261 | 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] | 6262 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6263 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6264 | UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_type(google_protobuf_FieldDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6265 | 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] | 6266 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6267 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6268 | 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] | 6269 | int32_t default_val = 1; |
| 6270 | int32_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6271 | 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] | 6272 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6273 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6274 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6275 | 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] | 6276 | 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] | 6277 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6278 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6279 | 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] | 6280 | 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] | 6281 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6282 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6283 | 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] | 6284 | upb_StringView default_val = upb_StringView_FromString(""); |
| 6285 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6286 | 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] | 6287 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6288 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6289 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6290 | 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] | 6291 | 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] | 6292 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6293 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6294 | 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] | 6295 | 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] | 6296 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6297 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6298 | 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] | 6299 | upb_StringView default_val = upb_StringView_FromString(""); |
| 6300 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6301 | 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] | 6302 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6303 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6304 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6305 | 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] | 6306 | 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] | 6307 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6308 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6309 | UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_options(google_protobuf_FieldDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6310 | 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] | 6311 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6312 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6313 | 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] | 6314 | const google_protobuf_FieldOptions* default_val = NULL; |
| 6315 | const google_protobuf_FieldOptions* ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6316 | 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] | 6317 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6318 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6319 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6320 | 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] | 6321 | 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] | 6322 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6323 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6324 | 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] | 6325 | 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] | 6326 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6327 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6328 | 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] | 6329 | int32_t default_val = (int32_t)0; |
| 6330 | int32_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6331 | 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] | 6332 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6333 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6334 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6335 | 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] | 6336 | 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] | 6337 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6338 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6339 | 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] | 6340 | 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] | 6341 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6342 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6343 | 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] | 6344 | upb_StringView default_val = upb_StringView_FromString(""); |
| 6345 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6346 | 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] | 6347 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6348 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6349 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6350 | 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] | 6351 | 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] | 6352 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6353 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6354 | 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] | 6355 | 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] | 6356 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6357 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6358 | 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] | 6359 | bool default_val = false; |
| 6360 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6361 | 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] | 6362 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6363 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6364 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6365 | 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] | 6366 | 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] | 6367 | return _upb_Message_HasNonExtensionField(msg, &field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6368 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6369 | |
| 6370 | 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] | 6371 | 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] | 6372 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6373 | } |
| 6374 | 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] | 6375 | 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] | 6376 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6377 | } |
| 6378 | 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] | 6379 | 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] | 6380 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6381 | } |
| 6382 | 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] | 6383 | 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] | 6384 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6385 | } |
| 6386 | 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] | 6387 | 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] | 6388 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6389 | } |
| 6390 | 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] | 6391 | 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] | 6392 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6393 | } |
| 6394 | 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] | 6395 | 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] | 6396 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6397 | } |
| 6398 | 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] | 6399 | 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] | 6400 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6401 | } |
| 6402 | 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] | 6403 | struct google_protobuf_FieldOptions* sub = (struct google_protobuf_FieldOptions*)google_protobuf_FieldDescriptorProto_options(msg); |
| 6404 | if (sub == NULL) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6405 | 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] | 6406 | if (sub) google_protobuf_FieldDescriptorProto_set_options(msg, sub); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6407 | } |
| 6408 | return sub; |
| 6409 | } |
| 6410 | 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] | 6411 | 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] | 6412 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6413 | } |
| 6414 | 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] | 6415 | 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] | 6416 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6417 | } |
| 6418 | 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] | 6419 | 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] | 6420 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6421 | } |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6422 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6423 | /* google.protobuf.OneofDescriptorProto */ |
| 6424 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6425 | UPB_INLINE google_protobuf_OneofDescriptorProto* google_protobuf_OneofDescriptorProto_new(upb_Arena* arena) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6426 | 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] | 6427 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6428 | UPB_INLINE google_protobuf_OneofDescriptorProto* google_protobuf_OneofDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 6429 | google_protobuf_OneofDescriptorProto* ret = google_protobuf_OneofDescriptorProto_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 6430 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6431 | 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] | 6432 | return NULL; |
| 6433 | } |
| 6434 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6435 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6436 | UPB_INLINE google_protobuf_OneofDescriptorProto* google_protobuf_OneofDescriptorProto_parse_ex(const char* buf, size_t size, |
| 6437 | const upb_ExtensionRegistry* extreg, |
| 6438 | int options, upb_Arena* arena) { |
| 6439 | google_protobuf_OneofDescriptorProto* ret = google_protobuf_OneofDescriptorProto_new(arena); |
| 6440 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6441 | 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] | 6442 | kUpb_DecodeStatus_Ok) { |
| 6443 | return NULL; |
| 6444 | } |
| 6445 | return ret; |
| 6446 | } |
| 6447 | 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] | 6448 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6449 | (void)upb_Encode(msg, &google__protobuf__OneofDescriptorProto_msg_init, 0, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6450 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6451 | } |
| 6452 | UPB_INLINE char* google_protobuf_OneofDescriptorProto_serialize_ex(const google_protobuf_OneofDescriptorProto* msg, int options, |
| 6453 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6454 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6455 | (void)upb_Encode(msg, &google__protobuf__OneofDescriptorProto_msg_init, options, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6456 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6457 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6458 | UPB_INLINE void google_protobuf_OneofDescriptorProto_clear_name(google_protobuf_OneofDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6459 | 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] | 6460 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6461 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6462 | 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] | 6463 | upb_StringView default_val = upb_StringView_FromString(""); |
| 6464 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6465 | 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] | 6466 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6467 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6468 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6469 | 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] | 6470 | 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] | 6471 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6472 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6473 | UPB_INLINE void google_protobuf_OneofDescriptorProto_clear_options(google_protobuf_OneofDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6474 | 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] | 6475 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6476 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6477 | 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] | 6478 | const google_protobuf_OneofOptions* default_val = NULL; |
| 6479 | const google_protobuf_OneofOptions* ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6480 | 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] | 6481 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6482 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6483 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6484 | 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] | 6485 | 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] | 6486 | return _upb_Message_HasNonExtensionField(msg, &field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6487 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6488 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6489 | 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] | 6490 | 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] | 6491 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6492 | } |
| 6493 | 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] | 6494 | 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] | 6495 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6496 | } |
| 6497 | 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] | 6498 | struct google_protobuf_OneofOptions* sub = (struct google_protobuf_OneofOptions*)google_protobuf_OneofDescriptorProto_options(msg); |
| 6499 | if (sub == NULL) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6500 | 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] | 6501 | if (sub) google_protobuf_OneofDescriptorProto_set_options(msg, sub); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6502 | } |
| 6503 | return sub; |
| 6504 | } |
| 6505 | |
| 6506 | /* google.protobuf.EnumDescriptorProto */ |
| 6507 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6508 | UPB_INLINE google_protobuf_EnumDescriptorProto* google_protobuf_EnumDescriptorProto_new(upb_Arena* arena) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6509 | 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] | 6510 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6511 | UPB_INLINE google_protobuf_EnumDescriptorProto* google_protobuf_EnumDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 6512 | google_protobuf_EnumDescriptorProto* ret = google_protobuf_EnumDescriptorProto_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 6513 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6514 | 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] | 6515 | return NULL; |
| 6516 | } |
| 6517 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6518 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6519 | UPB_INLINE google_protobuf_EnumDescriptorProto* google_protobuf_EnumDescriptorProto_parse_ex(const char* buf, size_t size, |
| 6520 | const upb_ExtensionRegistry* extreg, |
| 6521 | int options, upb_Arena* arena) { |
| 6522 | google_protobuf_EnumDescriptorProto* ret = google_protobuf_EnumDescriptorProto_new(arena); |
| 6523 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6524 | 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] | 6525 | kUpb_DecodeStatus_Ok) { |
| 6526 | return NULL; |
| 6527 | } |
| 6528 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6529 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6530 | 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] | 6531 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6532 | (void)upb_Encode(msg, &google__protobuf__EnumDescriptorProto_msg_init, 0, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6533 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6534 | } |
| 6535 | UPB_INLINE char* google_protobuf_EnumDescriptorProto_serialize_ex(const google_protobuf_EnumDescriptorProto* msg, int options, |
| 6536 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6537 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6538 | (void)upb_Encode(msg, &google__protobuf__EnumDescriptorProto_msg_init, options, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6539 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6540 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6541 | UPB_INLINE void google_protobuf_EnumDescriptorProto_clear_name(google_protobuf_EnumDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6542 | 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] | 6543 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6544 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6545 | 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] | 6546 | upb_StringView default_val = upb_StringView_FromString(""); |
| 6547 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6548 | 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] | 6549 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6550 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6551 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6552 | 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] | 6553 | 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] | 6554 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6555 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6556 | UPB_INLINE void google_protobuf_EnumDescriptorProto_clear_value(google_protobuf_EnumDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6557 | 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] | 6558 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6559 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 6560 | 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] | 6561 | 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] | 6562 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 6563 | if (arr) { |
| 6564 | if (size) *size = arr->size; |
| 6565 | return (const google_protobuf_EnumValueDescriptorProto* const*)_upb_array_constptr(arr); |
| 6566 | } else { |
| 6567 | if (size) *size = 0; |
| 6568 | return NULL; |
| 6569 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6570 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 6571 | 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] | 6572 | 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] | 6573 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 6574 | if (size) { |
| 6575 | *size = arr ? arr->size : 0; |
| 6576 | } |
| 6577 | return arr; |
| 6578 | } |
| 6579 | 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] | 6580 | 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] | 6581 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 6582 | (upb_Message*)msg, &field, arena); |
| 6583 | if (size) { |
| 6584 | *size = arr ? arr->size : 0; |
| 6585 | } |
| 6586 | return arr; |
| 6587 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6588 | UPB_INLINE bool google_protobuf_EnumDescriptorProto_has_value(const google_protobuf_EnumDescriptorProto* msg) { |
| 6589 | size_t size; |
| 6590 | google_protobuf_EnumDescriptorProto_value(msg, &size); |
| 6591 | return size != 0; |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6592 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6593 | UPB_INLINE void google_protobuf_EnumDescriptorProto_clear_options(google_protobuf_EnumDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6594 | 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] | 6595 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6596 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6597 | 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] | 6598 | const google_protobuf_EnumOptions* default_val = NULL; |
| 6599 | const google_protobuf_EnumOptions* ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6600 | 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] | 6601 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6602 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6603 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6604 | 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] | 6605 | 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] | 6606 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6607 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6608 | 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] | 6609 | 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] | 6610 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6611 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 6612 | 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] | 6613 | 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] | 6614 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 6615 | if (arr) { |
| 6616 | if (size) *size = arr->size; |
| 6617 | return (const google_protobuf_EnumDescriptorProto_EnumReservedRange* const*)_upb_array_constptr(arr); |
| 6618 | } else { |
| 6619 | if (size) *size = 0; |
| 6620 | return NULL; |
| 6621 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6622 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 6623 | 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] | 6624 | 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] | 6625 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 6626 | if (size) { |
| 6627 | *size = arr ? arr->size : 0; |
| 6628 | } |
| 6629 | return arr; |
| 6630 | } |
| 6631 | 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] | 6632 | 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] | 6633 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 6634 | (upb_Message*)msg, &field, arena); |
| 6635 | if (size) { |
| 6636 | *size = arr ? arr->size : 0; |
| 6637 | } |
| 6638 | return arr; |
| 6639 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6640 | UPB_INLINE bool google_protobuf_EnumDescriptorProto_has_reserved_range(const google_protobuf_EnumDescriptorProto* msg) { |
| 6641 | size_t size; |
| 6642 | google_protobuf_EnumDescriptorProto_reserved_range(msg, &size); |
| 6643 | return size != 0; |
| 6644 | } |
| 6645 | 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] | 6646 | 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] | 6647 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6648 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 6649 | 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] | 6650 | 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] | 6651 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 6652 | if (arr) { |
| 6653 | if (size) *size = arr->size; |
| 6654 | return (upb_StringView const*)_upb_array_constptr(arr); |
| 6655 | } else { |
| 6656 | if (size) *size = 0; |
| 6657 | return NULL; |
| 6658 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6659 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 6660 | 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] | 6661 | 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] | 6662 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 6663 | if (size) { |
| 6664 | *size = arr ? arr->size : 0; |
| 6665 | } |
| 6666 | return arr; |
| 6667 | } |
| 6668 | 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] | 6669 | 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] | 6670 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 6671 | (upb_Message*)msg, &field, arena); |
| 6672 | if (size) { |
| 6673 | *size = arr ? arr->size : 0; |
| 6674 | } |
| 6675 | return arr; |
| 6676 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6677 | UPB_INLINE bool google_protobuf_EnumDescriptorProto_has_reserved_name(const google_protobuf_EnumDescriptorProto* msg) { |
| 6678 | size_t size; |
| 6679 | google_protobuf_EnumDescriptorProto_reserved_name(msg, &size); |
| 6680 | return size != 0; |
| 6681 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6682 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6683 | 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] | 6684 | 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] | 6685 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6686 | } |
| 6687 | 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] | 6688 | 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] | 6689 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 6690 | if (arr) { |
| 6691 | if (size) *size = arr->size; |
| 6692 | return (google_protobuf_EnumValueDescriptorProto**)_upb_array_ptr(arr); |
| 6693 | } else { |
| 6694 | if (size) *size = 0; |
| 6695 | return NULL; |
| 6696 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6697 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 6698 | 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] | 6699 | 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] | 6700 | return (google_protobuf_EnumValueDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6701 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6702 | 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] | 6703 | 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] | 6704 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 6705 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 6706 | return NULL; |
| 6707 | } |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6708 | 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] | 6709 | if (!arr || !sub) return NULL; |
| 6710 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6711 | return sub; |
| 6712 | } |
| 6713 | 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] | 6714 | 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] | 6715 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6716 | } |
| 6717 | 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] | 6718 | struct google_protobuf_EnumOptions* sub = (struct google_protobuf_EnumOptions*)google_protobuf_EnumDescriptorProto_options(msg); |
| 6719 | if (sub == NULL) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6720 | 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] | 6721 | if (sub) google_protobuf_EnumDescriptorProto_set_options(msg, sub); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6722 | } |
| 6723 | return sub; |
| 6724 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 6725 | 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] | 6726 | 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] | 6727 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 6728 | if (arr) { |
| 6729 | if (size) *size = arr->size; |
| 6730 | return (google_protobuf_EnumDescriptorProto_EnumReservedRange**)_upb_array_ptr(arr); |
| 6731 | } else { |
| 6732 | if (size) *size = 0; |
| 6733 | return NULL; |
| 6734 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6735 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 6736 | 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] | 6737 | 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] | 6738 | return (google_protobuf_EnumDescriptorProto_EnumReservedRange**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6739 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6740 | 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] | 6741 | 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] | 6742 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 6743 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 6744 | return NULL; |
| 6745 | } |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6746 | 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] | 6747 | if (!arr || !sub) return NULL; |
| 6748 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6749 | return sub; |
| 6750 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 6751 | 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] | 6752 | 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] | 6753 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 6754 | if (arr) { |
| 6755 | if (size) *size = arr->size; |
| 6756 | return (upb_StringView*)_upb_array_ptr(arr); |
| 6757 | } else { |
| 6758 | if (size) *size = 0; |
| 6759 | return NULL; |
| 6760 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6761 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 6762 | 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] | 6763 | 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] | 6764 | return (upb_StringView*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6765 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6766 | 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] | 6767 | 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] | 6768 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 6769 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 6770 | return false; |
| 6771 | } |
| 6772 | _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val)); |
| 6773 | return true; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6774 | } |
| 6775 | |
| 6776 | /* google.protobuf.EnumDescriptorProto.EnumReservedRange */ |
| 6777 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6778 | UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange* google_protobuf_EnumDescriptorProto_EnumReservedRange_new(upb_Arena* arena) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6779 | 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] | 6780 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6781 | UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange* google_protobuf_EnumDescriptorProto_EnumReservedRange_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 6782 | google_protobuf_EnumDescriptorProto_EnumReservedRange* ret = google_protobuf_EnumDescriptorProto_EnumReservedRange_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 6783 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6784 | 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] | 6785 | return NULL; |
| 6786 | } |
| 6787 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6788 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6789 | UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange* google_protobuf_EnumDescriptorProto_EnumReservedRange_parse_ex(const char* buf, size_t size, |
| 6790 | const upb_ExtensionRegistry* extreg, |
| 6791 | int options, upb_Arena* arena) { |
| 6792 | google_protobuf_EnumDescriptorProto_EnumReservedRange* ret = google_protobuf_EnumDescriptorProto_EnumReservedRange_new(arena); |
| 6793 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6794 | 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] | 6795 | kUpb_DecodeStatus_Ok) { |
| 6796 | return NULL; |
| 6797 | } |
| 6798 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6799 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6800 | 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] | 6801 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6802 | (void)upb_Encode(msg, &google__protobuf__EnumDescriptorProto__EnumReservedRange_msg_init, 0, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6803 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6804 | } |
| 6805 | UPB_INLINE char* google_protobuf_EnumDescriptorProto_EnumReservedRange_serialize_ex(const google_protobuf_EnumDescriptorProto_EnumReservedRange* msg, int options, |
| 6806 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6807 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6808 | (void)upb_Encode(msg, &google__protobuf__EnumDescriptorProto__EnumReservedRange_msg_init, options, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6809 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6810 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6811 | 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] | 6812 | 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] | 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 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] | 6816 | int32_t default_val = (int32_t)0; |
| 6817 | int32_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6818 | 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] | 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_EnumDescriptorProto_EnumReservedRange_has_start(const google_protobuf_EnumDescriptorProto_EnumReservedRange* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6823 | 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] | 6824 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6825 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6826 | 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] | 6827 | 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] | 6828 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6829 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6830 | 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] | 6831 | int32_t default_val = (int32_t)0; |
| 6832 | int32_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6833 | 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] | 6834 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6835 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6836 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6837 | 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] | 6838 | 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] | 6839 | return _upb_Message_HasNonExtensionField(msg, &field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6840 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6841 | |
| 6842 | 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] | 6843 | 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] | 6844 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6845 | } |
| 6846 | 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] | 6847 | 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] | 6848 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6849 | } |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6850 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6851 | /* google.protobuf.EnumValueDescriptorProto */ |
| 6852 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6853 | UPB_INLINE google_protobuf_EnumValueDescriptorProto* google_protobuf_EnumValueDescriptorProto_new(upb_Arena* arena) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6854 | 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] | 6855 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6856 | UPB_INLINE google_protobuf_EnumValueDescriptorProto* google_protobuf_EnumValueDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 6857 | google_protobuf_EnumValueDescriptorProto* ret = google_protobuf_EnumValueDescriptorProto_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 6858 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6859 | 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] | 6860 | return NULL; |
| 6861 | } |
| 6862 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6863 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6864 | UPB_INLINE google_protobuf_EnumValueDescriptorProto* google_protobuf_EnumValueDescriptorProto_parse_ex(const char* buf, size_t size, |
| 6865 | const upb_ExtensionRegistry* extreg, |
| 6866 | int options, upb_Arena* arena) { |
| 6867 | google_protobuf_EnumValueDescriptorProto* ret = google_protobuf_EnumValueDescriptorProto_new(arena); |
| 6868 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6869 | 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] | 6870 | kUpb_DecodeStatus_Ok) { |
| 6871 | return NULL; |
| 6872 | } |
| 6873 | return ret; |
| 6874 | } |
| 6875 | 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] | 6876 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6877 | (void)upb_Encode(msg, &google__protobuf__EnumValueDescriptorProto_msg_init, 0, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6878 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6879 | } |
| 6880 | UPB_INLINE char* google_protobuf_EnumValueDescriptorProto_serialize_ex(const google_protobuf_EnumValueDescriptorProto* msg, int options, |
| 6881 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6882 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6883 | (void)upb_Encode(msg, &google__protobuf__EnumValueDescriptorProto_msg_init, options, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6884 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6885 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6886 | UPB_INLINE void google_protobuf_EnumValueDescriptorProto_clear_name(google_protobuf_EnumValueDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6887 | 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] | 6888 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6889 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6890 | 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] | 6891 | upb_StringView default_val = upb_StringView_FromString(""); |
| 6892 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6893 | 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] | 6894 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6895 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6896 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6897 | 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] | 6898 | 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] | 6899 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6900 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6901 | UPB_INLINE void google_protobuf_EnumValueDescriptorProto_clear_number(google_protobuf_EnumValueDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6902 | 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] | 6903 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6904 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6905 | 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] | 6906 | int32_t default_val = (int32_t)0; |
| 6907 | int32_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6908 | 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] | 6909 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6910 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6911 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6912 | 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] | 6913 | 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] | 6914 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6915 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6916 | UPB_INLINE void google_protobuf_EnumValueDescriptorProto_clear_options(google_protobuf_EnumValueDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6917 | 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] | 6918 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6919 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6920 | 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] | 6921 | const google_protobuf_EnumValueOptions* default_val = NULL; |
| 6922 | const google_protobuf_EnumValueOptions* ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6923 | 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] | 6924 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6925 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6926 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6927 | 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] | 6928 | 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] | 6929 | return _upb_Message_HasNonExtensionField(msg, &field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6930 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6931 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6932 | 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] | 6933 | const upb_MiniTableField field = {1, UPB_SIZE(12, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 6934 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6935 | } |
| 6936 | 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] | 6937 | 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] | 6938 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6939 | } |
| 6940 | 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] | 6941 | 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] | 6942 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6943 | } |
| 6944 | 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] | 6945 | struct google_protobuf_EnumValueOptions* sub = (struct google_protobuf_EnumValueOptions*)google_protobuf_EnumValueDescriptorProto_options(msg); |
| 6946 | if (sub == NULL) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6947 | 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] | 6948 | if (sub) google_protobuf_EnumValueDescriptorProto_set_options(msg, sub); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6949 | } |
| 6950 | return sub; |
| 6951 | } |
| 6952 | |
| 6953 | /* google.protobuf.ServiceDescriptorProto */ |
| 6954 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6955 | UPB_INLINE google_protobuf_ServiceDescriptorProto* google_protobuf_ServiceDescriptorProto_new(upb_Arena* arena) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6956 | 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] | 6957 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6958 | UPB_INLINE google_protobuf_ServiceDescriptorProto* google_protobuf_ServiceDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 6959 | google_protobuf_ServiceDescriptorProto* ret = google_protobuf_ServiceDescriptorProto_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 6960 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6961 | 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] | 6962 | return NULL; |
| 6963 | } |
| 6964 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6965 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6966 | UPB_INLINE google_protobuf_ServiceDescriptorProto* google_protobuf_ServiceDescriptorProto_parse_ex(const char* buf, size_t size, |
| 6967 | const upb_ExtensionRegistry* extreg, |
| 6968 | int options, upb_Arena* arena) { |
| 6969 | google_protobuf_ServiceDescriptorProto* ret = google_protobuf_ServiceDescriptorProto_new(arena); |
| 6970 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6971 | 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] | 6972 | kUpb_DecodeStatus_Ok) { |
| 6973 | return NULL; |
| 6974 | } |
| 6975 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6976 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6977 | 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] | 6978 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6979 | (void)upb_Encode(msg, &google__protobuf__ServiceDescriptorProto_msg_init, 0, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6980 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6981 | } |
| 6982 | UPB_INLINE char* google_protobuf_ServiceDescriptorProto_serialize_ex(const google_protobuf_ServiceDescriptorProto* msg, int options, |
| 6983 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6984 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 6985 | (void)upb_Encode(msg, &google__protobuf__ServiceDescriptorProto_msg_init, options, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6986 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6987 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6988 | UPB_INLINE void google_protobuf_ServiceDescriptorProto_clear_name(google_protobuf_ServiceDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6989 | 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] | 6990 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6991 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6992 | 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] | 6993 | upb_StringView default_val = upb_StringView_FromString(""); |
| 6994 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6995 | 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] | 6996 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6997 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6998 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6999 | 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] | 7000 | 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] | 7001 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7002 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7003 | UPB_INLINE void google_protobuf_ServiceDescriptorProto_clear_method(google_protobuf_ServiceDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7004 | 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] | 7005 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7006 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 7007 | 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] | 7008 | 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] | 7009 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 7010 | if (arr) { |
| 7011 | if (size) *size = arr->size; |
| 7012 | return (const google_protobuf_MethodDescriptorProto* const*)_upb_array_constptr(arr); |
| 7013 | } else { |
| 7014 | if (size) *size = 0; |
| 7015 | return NULL; |
| 7016 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7017 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 7018 | 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] | 7019 | 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] | 7020 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 7021 | if (size) { |
| 7022 | *size = arr ? arr->size : 0; |
| 7023 | } |
| 7024 | return arr; |
| 7025 | } |
| 7026 | 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] | 7027 | 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] | 7028 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 7029 | (upb_Message*)msg, &field, arena); |
| 7030 | if (size) { |
| 7031 | *size = arr ? arr->size : 0; |
| 7032 | } |
| 7033 | return arr; |
| 7034 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7035 | UPB_INLINE bool google_protobuf_ServiceDescriptorProto_has_method(const google_protobuf_ServiceDescriptorProto* msg) { |
| 7036 | size_t size; |
| 7037 | google_protobuf_ServiceDescriptorProto_method(msg, &size); |
| 7038 | return size != 0; |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7039 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7040 | UPB_INLINE void google_protobuf_ServiceDescriptorProto_clear_options(google_protobuf_ServiceDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7041 | 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] | 7042 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7043 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7044 | 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] | 7045 | const google_protobuf_ServiceOptions* default_val = NULL; |
| 7046 | const google_protobuf_ServiceOptions* ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7047 | 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] | 7048 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7049 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7050 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7051 | 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] | 7052 | 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] | 7053 | return _upb_Message_HasNonExtensionField(msg, &field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7054 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7055 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7056 | 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] | 7057 | 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] | 7058 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7059 | } |
| 7060 | 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] | 7061 | 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] | 7062 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 7063 | if (arr) { |
| 7064 | if (size) *size = arr->size; |
| 7065 | return (google_protobuf_MethodDescriptorProto**)_upb_array_ptr(arr); |
| 7066 | } else { |
| 7067 | if (size) *size = 0; |
| 7068 | return NULL; |
| 7069 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7070 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 7071 | 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] | 7072 | 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] | 7073 | return (google_protobuf_MethodDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7074 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7075 | 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] | 7076 | 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] | 7077 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 7078 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 7079 | return NULL; |
| 7080 | } |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 7081 | 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] | 7082 | if (!arr || !sub) return NULL; |
| 7083 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7084 | return sub; |
| 7085 | } |
| 7086 | 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] | 7087 | const upb_MiniTableField field = {3, UPB_SIZE(8, 32), 2, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 7088 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7089 | } |
| 7090 | 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] | 7091 | struct google_protobuf_ServiceOptions* sub = (struct google_protobuf_ServiceOptions*)google_protobuf_ServiceDescriptorProto_options(msg); |
| 7092 | if (sub == NULL) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 7093 | 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] | 7094 | if (sub) google_protobuf_ServiceDescriptorProto_set_options(msg, sub); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7095 | } |
| 7096 | return sub; |
| 7097 | } |
| 7098 | |
| 7099 | /* google.protobuf.MethodDescriptorProto */ |
| 7100 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7101 | UPB_INLINE google_protobuf_MethodDescriptorProto* google_protobuf_MethodDescriptorProto_new(upb_Arena* arena) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 7102 | 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] | 7103 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7104 | UPB_INLINE google_protobuf_MethodDescriptorProto* google_protobuf_MethodDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 7105 | google_protobuf_MethodDescriptorProto* ret = google_protobuf_MethodDescriptorProto_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 7106 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 7107 | 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] | 7108 | return NULL; |
| 7109 | } |
| 7110 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7111 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7112 | UPB_INLINE google_protobuf_MethodDescriptorProto* google_protobuf_MethodDescriptorProto_parse_ex(const char* buf, size_t size, |
| 7113 | const upb_ExtensionRegistry* extreg, |
| 7114 | int options, upb_Arena* arena) { |
| 7115 | google_protobuf_MethodDescriptorProto* ret = google_protobuf_MethodDescriptorProto_new(arena); |
| 7116 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 7117 | 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] | 7118 | kUpb_DecodeStatus_Ok) { |
| 7119 | return NULL; |
| 7120 | } |
| 7121 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7122 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7123 | 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] | 7124 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 7125 | (void)upb_Encode(msg, &google__protobuf__MethodDescriptorProto_msg_init, 0, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7126 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7127 | } |
| 7128 | UPB_INLINE char* google_protobuf_MethodDescriptorProto_serialize_ex(const google_protobuf_MethodDescriptorProto* msg, int options, |
| 7129 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7130 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 7131 | (void)upb_Encode(msg, &google__protobuf__MethodDescriptorProto_msg_init, options, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7132 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7133 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7134 | UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_name(google_protobuf_MethodDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7135 | 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] | 7136 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7137 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7138 | 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] | 7139 | upb_StringView default_val = upb_StringView_FromString(""); |
| 7140 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7141 | 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] | 7142 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7143 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7144 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7145 | 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] | 7146 | 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] | 7147 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7148 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7149 | 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] | 7150 | 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] | 7151 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7152 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7153 | 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] | 7154 | upb_StringView default_val = upb_StringView_FromString(""); |
| 7155 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7156 | 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] | 7157 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7158 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7159 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7160 | 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] | 7161 | 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] | 7162 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7163 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7164 | 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] | 7165 | 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] | 7166 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7167 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7168 | 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] | 7169 | upb_StringView default_val = upb_StringView_FromString(""); |
| 7170 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7171 | 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] | 7172 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7173 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7174 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7175 | 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] | 7176 | 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] | 7177 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7178 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7179 | UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_options(google_protobuf_MethodDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7180 | 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] | 7181 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7182 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7183 | 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] | 7184 | const google_protobuf_MethodOptions* default_val = NULL; |
| 7185 | const google_protobuf_MethodOptions* ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7186 | 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] | 7187 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7188 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7189 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7190 | 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] | 7191 | 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] | 7192 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7193 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7194 | 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] | 7195 | 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] | 7196 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7197 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7198 | 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] | 7199 | bool default_val = false; |
| 7200 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7201 | 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] | 7202 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7203 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7204 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7205 | 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] | 7206 | 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] | 7207 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7208 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7209 | 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] | 7210 | 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] | 7211 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7212 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7213 | 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] | 7214 | bool default_val = false; |
| 7215 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7216 | 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] | 7217 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7218 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7219 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7220 | 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] | 7221 | 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] | 7222 | return _upb_Message_HasNonExtensionField(msg, &field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7223 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7224 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7225 | 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] | 7226 | 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] | 7227 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7228 | } |
| 7229 | 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] | 7230 | 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] | 7231 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7232 | } |
| 7233 | 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] | 7234 | 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] | 7235 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7236 | } |
| 7237 | 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] | 7238 | 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] | 7239 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7240 | } |
| 7241 | 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] | 7242 | struct google_protobuf_MethodOptions* sub = (struct google_protobuf_MethodOptions*)google_protobuf_MethodDescriptorProto_options(msg); |
| 7243 | if (sub == NULL) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 7244 | 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] | 7245 | if (sub) google_protobuf_MethodDescriptorProto_set_options(msg, sub); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7246 | } |
| 7247 | return sub; |
| 7248 | } |
| 7249 | 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] | 7250 | 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] | 7251 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7252 | } |
| 7253 | 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] | 7254 | 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] | 7255 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7256 | } |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7257 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7258 | /* google.protobuf.FileOptions */ |
| 7259 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7260 | UPB_INLINE google_protobuf_FileOptions* google_protobuf_FileOptions_new(upb_Arena* arena) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 7261 | 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] | 7262 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7263 | UPB_INLINE google_protobuf_FileOptions* google_protobuf_FileOptions_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 7264 | google_protobuf_FileOptions* ret = google_protobuf_FileOptions_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 7265 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 7266 | 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] | 7267 | return NULL; |
| 7268 | } |
| 7269 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7270 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7271 | UPB_INLINE google_protobuf_FileOptions* google_protobuf_FileOptions_parse_ex(const char* buf, size_t size, |
| 7272 | const upb_ExtensionRegistry* extreg, |
| 7273 | int options, upb_Arena* arena) { |
| 7274 | google_protobuf_FileOptions* ret = google_protobuf_FileOptions_new(arena); |
| 7275 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 7276 | 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] | 7277 | kUpb_DecodeStatus_Ok) { |
| 7278 | return NULL; |
| 7279 | } |
| 7280 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7281 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7282 | 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] | 7283 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 7284 | (void)upb_Encode(msg, &google__protobuf__FileOptions_msg_init, 0, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7285 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7286 | } |
| 7287 | UPB_INLINE char* google_protobuf_FileOptions_serialize_ex(const google_protobuf_FileOptions* msg, int options, |
| 7288 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7289 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 7290 | (void)upb_Encode(msg, &google__protobuf__FileOptions_msg_init, options, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7291 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7292 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7293 | UPB_INLINE void google_protobuf_FileOptions_clear_java_package(google_protobuf_FileOptions* msg) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7294 | 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] | 7295 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7296 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7297 | 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] | 7298 | upb_StringView default_val = upb_StringView_FromString(""); |
| 7299 | upb_StringView ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7300 | 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] | 7301 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7302 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7303 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7304 | 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] | 7305 | 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] | 7306 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7307 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7308 | 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] | 7309 | 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] | 7310 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7311 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7312 | 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] | 7313 | upb_StringView default_val = upb_StringView_FromString(""); |
| 7314 | upb_StringView ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7315 | 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] | 7316 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7317 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7318 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7319 | 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] | 7320 | 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] | 7321 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7322 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7323 | 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] | 7324 | 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] | 7325 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7326 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7327 | 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] | 7328 | int32_t default_val = 1; |
| 7329 | int32_t ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7330 | 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] | 7331 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7332 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7333 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7334 | 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] | 7335 | 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] | 7336 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7337 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7338 | 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] | 7339 | 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] | 7340 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7341 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7342 | 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] | 7343 | bool default_val = false; |
| 7344 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7345 | 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] | 7346 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7347 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7348 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7349 | 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] | 7350 | 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] | 7351 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7352 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7353 | 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] | 7354 | 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] | 7355 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7356 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7357 | 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] | 7358 | upb_StringView default_val = upb_StringView_FromString(""); |
| 7359 | upb_StringView ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7360 | 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] | 7361 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7362 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7363 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7364 | 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] | 7365 | 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] | 7366 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7367 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7368 | 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] | 7369 | 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] | 7370 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7371 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7372 | 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] | 7373 | bool default_val = false; |
| 7374 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7375 | 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] | 7376 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7377 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7378 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7379 | 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] | 7380 | 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] | 7381 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7382 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7383 | 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] | 7384 | 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] | 7385 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7386 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7387 | 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] | 7388 | bool default_val = false; |
| 7389 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7390 | 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] | 7391 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7392 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7393 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7394 | 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] | 7395 | 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] | 7396 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7397 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7398 | 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] | 7399 | 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] | 7400 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7401 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7402 | 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] | 7403 | bool default_val = false; |
| 7404 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7405 | 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] | 7406 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7407 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7408 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7409 | 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] | 7410 | 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] | 7411 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7412 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7413 | 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] | 7414 | 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] | 7415 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7416 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7417 | 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] | 7418 | bool default_val = false; |
| 7419 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7420 | 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] | 7421 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7422 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7423 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7424 | 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] | 7425 | 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] | 7426 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7427 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7428 | UPB_INLINE void google_protobuf_FileOptions_clear_deprecated(google_protobuf_FileOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7429 | 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] | 7430 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7431 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7432 | UPB_INLINE bool google_protobuf_FileOptions_deprecated(const google_protobuf_FileOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7433 | bool default_val = false; |
| 7434 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7435 | 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] | 7436 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7437 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7438 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7439 | 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] | 7440 | 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] | 7441 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7442 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7443 | 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] | 7444 | 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] | 7445 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7446 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7447 | 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] | 7448 | bool default_val = false; |
| 7449 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7450 | 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] | 7451 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7452 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7453 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7454 | 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] | 7455 | 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] | 7456 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7457 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7458 | 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] | 7459 | 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] | 7460 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7461 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7462 | 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] | 7463 | bool default_val = true; |
| 7464 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7465 | 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] | 7466 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7467 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7468 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7469 | 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] | 7470 | 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] | 7471 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7472 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7473 | 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] | 7474 | 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] | 7475 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7476 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7477 | 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] | 7478 | upb_StringView default_val = upb_StringView_FromString(""); |
| 7479 | upb_StringView ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7480 | 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] | 7481 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7482 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7483 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7484 | 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] | 7485 | 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] | 7486 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7487 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7488 | 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] | 7489 | 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] | 7490 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7491 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7492 | 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] | 7493 | upb_StringView default_val = upb_StringView_FromString(""); |
| 7494 | upb_StringView ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7495 | 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] | 7496 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7497 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7498 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7499 | 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] | 7500 | 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] | 7501 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7502 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7503 | 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] | 7504 | 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] | 7505 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7506 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7507 | 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] | 7508 | upb_StringView default_val = upb_StringView_FromString(""); |
| 7509 | upb_StringView ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7510 | 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] | 7511 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7512 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7513 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7514 | 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] | 7515 | 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] | 7516 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7517 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7518 | 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] | 7519 | 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] | 7520 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7521 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7522 | 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] | 7523 | upb_StringView default_val = upb_StringView_FromString(""); |
| 7524 | upb_StringView ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7525 | 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] | 7526 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7527 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7528 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7529 | 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] | 7530 | 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] | 7531 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7532 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7533 | 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] | 7534 | 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] | 7535 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7536 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7537 | 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] | 7538 | upb_StringView default_val = upb_StringView_FromString(""); |
| 7539 | upb_StringView ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7540 | 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] | 7541 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7542 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7543 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7544 | 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] | 7545 | 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] | 7546 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7547 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7548 | 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] | 7549 | 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] | 7550 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7551 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7552 | 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] | 7553 | bool default_val = false; |
| 7554 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7555 | 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] | 7556 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7557 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7558 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7559 | 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] | 7560 | 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] | 7561 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7562 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7563 | 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] | 7564 | 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] | 7565 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7566 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7567 | 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] | 7568 | upb_StringView default_val = upb_StringView_FromString(""); |
| 7569 | upb_StringView ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7570 | 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] | 7571 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7572 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7573 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7574 | 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] | 7575 | 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] | 7576 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7577 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7578 | 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] | 7579 | 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] | 7580 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7581 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7582 | 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] | 7583 | upb_StringView default_val = upb_StringView_FromString(""); |
| 7584 | upb_StringView ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7585 | 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] | 7586 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7587 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7588 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7589 | 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] | 7590 | 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)}; |
| 7591 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 7592 | } |
| 7593 | UPB_INLINE void google_protobuf_FileOptions_clear_features(google_protobuf_FileOptions* msg) { |
| 7594 | 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)}; |
| 7595 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 7596 | } |
| 7597 | UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_FileOptions_features(const google_protobuf_FileOptions* msg) { |
| 7598 | const google_protobuf_FeatureSet* default_val = NULL; |
| 7599 | const google_protobuf_FeatureSet* ret; |
| 7600 | 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)}; |
| 7601 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 7602 | return ret; |
| 7603 | } |
| 7604 | UPB_INLINE bool google_protobuf_FileOptions_has_features(const google_protobuf_FileOptions* msg) { |
| 7605 | 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] | 7606 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7607 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7608 | 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] | 7609 | 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] | 7610 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7611 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 7612 | 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] | 7613 | 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] | 7614 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 7615 | if (arr) { |
| 7616 | if (size) *size = arr->size; |
| 7617 | return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr); |
| 7618 | } else { |
| 7619 | if (size) *size = 0; |
| 7620 | return NULL; |
| 7621 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7622 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 7623 | 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] | 7624 | 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] | 7625 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 7626 | if (size) { |
| 7627 | *size = arr ? arr->size : 0; |
| 7628 | } |
| 7629 | return arr; |
| 7630 | } |
| 7631 | 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] | 7632 | 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] | 7633 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 7634 | (upb_Message*)msg, &field, arena); |
| 7635 | if (size) { |
| 7636 | *size = arr ? arr->size : 0; |
| 7637 | } |
| 7638 | return arr; |
| 7639 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7640 | UPB_INLINE bool google_protobuf_FileOptions_has_uninterpreted_option(const google_protobuf_FileOptions* msg) { |
| 7641 | size_t size; |
| 7642 | google_protobuf_FileOptions_uninterpreted_option(msg, &size); |
| 7643 | return size != 0; |
| 7644 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7645 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7646 | 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] | 7647 | 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] | 7648 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7649 | } |
| 7650 | 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] | 7651 | 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] | 7652 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7653 | } |
| 7654 | 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] | 7655 | 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] | 7656 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7657 | } |
| 7658 | 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] | 7659 | 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] | 7660 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7661 | } |
| 7662 | 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] | 7663 | 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] | 7664 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7665 | } |
| 7666 | 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] | 7667 | 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] | 7668 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7669 | } |
| 7670 | 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] | 7671 | 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] | 7672 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7673 | } |
| 7674 | 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] | 7675 | 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] | 7676 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7677 | } |
| 7678 | 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] | 7679 | 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] | 7680 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7681 | } |
| 7682 | 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] | 7683 | 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] | 7684 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7685 | } |
| 7686 | 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] | 7687 | 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] | 7688 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7689 | } |
| 7690 | 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] | 7691 | 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] | 7692 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7693 | } |
| 7694 | 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] | 7695 | 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] | 7696 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7697 | } |
| 7698 | 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] | 7699 | 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] | 7700 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7701 | } |
| 7702 | 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] | 7703 | 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] | 7704 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7705 | } |
| 7706 | 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] | 7707 | 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] | 7708 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7709 | } |
| 7710 | 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] | 7711 | 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] | 7712 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7713 | } |
| 7714 | 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] | 7715 | 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] | 7716 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7717 | } |
| 7718 | 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] | 7719 | 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] | 7720 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7721 | } |
| 7722 | 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] | 7723 | 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] | 7724 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7725 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7726 | UPB_INLINE void google_protobuf_FileOptions_set_features(google_protobuf_FileOptions *msg, google_protobuf_FeatureSet* value) { |
| 7727 | 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)}; |
| 7728 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 7729 | } |
| 7730 | UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_FileOptions_mutable_features(google_protobuf_FileOptions* msg, upb_Arena* arena) { |
| 7731 | struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_FileOptions_features(msg); |
| 7732 | if (sub == NULL) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 7733 | sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena); |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7734 | if (sub) google_protobuf_FileOptions_set_features(msg, sub); |
| 7735 | } |
| 7736 | return sub; |
| 7737 | } |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7738 | 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] | 7739 | 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] | 7740 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 7741 | if (arr) { |
| 7742 | if (size) *size = arr->size; |
| 7743 | return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr); |
| 7744 | } else { |
| 7745 | if (size) *size = 0; |
| 7746 | return NULL; |
| 7747 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7748 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 7749 | 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] | 7750 | 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] | 7751 | return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7752 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7753 | 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] | 7754 | 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] | 7755 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 7756 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 7757 | return NULL; |
| 7758 | } |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 7759 | 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] | 7760 | if (!arr || !sub) return NULL; |
| 7761 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7762 | return sub; |
| 7763 | } |
| 7764 | |
| 7765 | /* google.protobuf.MessageOptions */ |
| 7766 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7767 | UPB_INLINE google_protobuf_MessageOptions* google_protobuf_MessageOptions_new(upb_Arena* arena) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 7768 | 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] | 7769 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7770 | UPB_INLINE google_protobuf_MessageOptions* google_protobuf_MessageOptions_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 7771 | google_protobuf_MessageOptions* ret = google_protobuf_MessageOptions_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 7772 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 7773 | 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] | 7774 | return NULL; |
| 7775 | } |
| 7776 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7777 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7778 | UPB_INLINE google_protobuf_MessageOptions* google_protobuf_MessageOptions_parse_ex(const char* buf, size_t size, |
| 7779 | const upb_ExtensionRegistry* extreg, |
| 7780 | int options, upb_Arena* arena) { |
| 7781 | google_protobuf_MessageOptions* ret = google_protobuf_MessageOptions_new(arena); |
| 7782 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 7783 | 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] | 7784 | kUpb_DecodeStatus_Ok) { |
| 7785 | return NULL; |
| 7786 | } |
| 7787 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7788 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7789 | 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] | 7790 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 7791 | (void)upb_Encode(msg, &google__protobuf__MessageOptions_msg_init, 0, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7792 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7793 | } |
| 7794 | UPB_INLINE char* google_protobuf_MessageOptions_serialize_ex(const google_protobuf_MessageOptions* msg, int options, |
| 7795 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7796 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 7797 | (void)upb_Encode(msg, &google__protobuf__MessageOptions_msg_init, options, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7798 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7799 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7800 | 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] | 7801 | 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] | 7802 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7803 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7804 | 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] | 7805 | bool default_val = false; |
| 7806 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7807 | 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] | 7808 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7809 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7810 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7811 | 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] | 7812 | 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] | 7813 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7814 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7815 | 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] | 7816 | 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] | 7817 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7818 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7819 | 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] | 7820 | bool default_val = false; |
| 7821 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7822 | 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] | 7823 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7824 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7825 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7826 | 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] | 7827 | 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] | 7828 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7829 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7830 | UPB_INLINE void google_protobuf_MessageOptions_clear_deprecated(google_protobuf_MessageOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7831 | 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] | 7832 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7833 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7834 | UPB_INLINE bool google_protobuf_MessageOptions_deprecated(const google_protobuf_MessageOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7835 | bool default_val = false; |
| 7836 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7837 | 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] | 7838 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7839 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7840 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7841 | 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] | 7842 | 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] | 7843 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7844 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7845 | 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] | 7846 | 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] | 7847 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7848 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7849 | 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] | 7850 | bool default_val = false; |
| 7851 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7852 | 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] | 7853 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7854 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7855 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7856 | 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] | 7857 | 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] | 7858 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7859 | } |
Mike Kruskal | 6b87d6f | 2022-12-14 10:36:53 -0800 | [diff] [blame] | 7860 | 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] | 7861 | 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] | 7862 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 7863 | } |
| 7864 | UPB_INLINE bool google_protobuf_MessageOptions_deprecated_legacy_json_field_conflicts(const google_protobuf_MessageOptions* msg) { |
| 7865 | bool default_val = false; |
| 7866 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7867 | 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] | 7868 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 7869 | return ret; |
| 7870 | } |
| 7871 | 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] | 7872 | 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] | 7873 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 7874 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7875 | UPB_INLINE void google_protobuf_MessageOptions_clear_features(google_protobuf_MessageOptions* msg) { |
| 7876 | 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)}; |
| 7877 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 7878 | } |
| 7879 | UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_MessageOptions_features(const google_protobuf_MessageOptions* msg) { |
| 7880 | const google_protobuf_FeatureSet* default_val = NULL; |
| 7881 | const google_protobuf_FeatureSet* ret; |
| 7882 | 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)}; |
| 7883 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 7884 | return ret; |
| 7885 | } |
| 7886 | UPB_INLINE bool google_protobuf_MessageOptions_has_features(const google_protobuf_MessageOptions* msg) { |
| 7887 | 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)}; |
| 7888 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 7889 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7890 | 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] | 7891 | 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] | 7892 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7893 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 7894 | 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] | 7895 | 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] | 7896 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 7897 | if (arr) { |
| 7898 | if (size) *size = arr->size; |
| 7899 | return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr); |
| 7900 | } else { |
| 7901 | if (size) *size = 0; |
| 7902 | return NULL; |
| 7903 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7904 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 7905 | 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] | 7906 | 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] | 7907 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 7908 | if (size) { |
| 7909 | *size = arr ? arr->size : 0; |
| 7910 | } |
| 7911 | return arr; |
| 7912 | } |
| 7913 | 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] | 7914 | 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] | 7915 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 7916 | (upb_Message*)msg, &field, arena); |
| 7917 | if (size) { |
| 7918 | *size = arr ? arr->size : 0; |
| 7919 | } |
| 7920 | return arr; |
| 7921 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7922 | UPB_INLINE bool google_protobuf_MessageOptions_has_uninterpreted_option(const google_protobuf_MessageOptions* msg) { |
| 7923 | size_t size; |
| 7924 | google_protobuf_MessageOptions_uninterpreted_option(msg, &size); |
| 7925 | return size != 0; |
| 7926 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7927 | |
| 7928 | 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] | 7929 | 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] | 7930 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7931 | } |
| 7932 | 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] | 7933 | 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] | 7934 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7935 | } |
| 7936 | 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] | 7937 | 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] | 7938 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7939 | } |
| 7940 | 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] | 7941 | 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] | 7942 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7943 | } |
| 7944 | 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] | 7945 | 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] | 7946 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7947 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7948 | UPB_INLINE void google_protobuf_MessageOptions_set_features(google_protobuf_MessageOptions *msg, google_protobuf_FeatureSet* value) { |
| 7949 | 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)}; |
| 7950 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 7951 | } |
| 7952 | UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_MessageOptions_mutable_features(google_protobuf_MessageOptions* msg, upb_Arena* arena) { |
| 7953 | struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_MessageOptions_features(msg); |
| 7954 | if (sub == NULL) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 7955 | sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena); |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7956 | if (sub) google_protobuf_MessageOptions_set_features(msg, sub); |
| 7957 | } |
| 7958 | return sub; |
| 7959 | } |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7960 | 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] | 7961 | 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] | 7962 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 7963 | if (arr) { |
| 7964 | if (size) *size = arr->size; |
| 7965 | return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr); |
| 7966 | } else { |
| 7967 | if (size) *size = 0; |
| 7968 | return NULL; |
| 7969 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7970 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 7971 | 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] | 7972 | 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] | 7973 | return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7974 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7975 | 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] | 7976 | 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] | 7977 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 7978 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 7979 | return NULL; |
| 7980 | } |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 7981 | 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] | 7982 | if (!arr || !sub) return NULL; |
| 7983 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7984 | return sub; |
| 7985 | } |
| 7986 | |
| 7987 | /* google.protobuf.FieldOptions */ |
| 7988 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7989 | UPB_INLINE google_protobuf_FieldOptions* google_protobuf_FieldOptions_new(upb_Arena* arena) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 7990 | 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] | 7991 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7992 | UPB_INLINE google_protobuf_FieldOptions* google_protobuf_FieldOptions_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 7993 | google_protobuf_FieldOptions* ret = google_protobuf_FieldOptions_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 7994 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 7995 | 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] | 7996 | return NULL; |
| 7997 | } |
| 7998 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7999 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8000 | UPB_INLINE google_protobuf_FieldOptions* google_protobuf_FieldOptions_parse_ex(const char* buf, size_t size, |
| 8001 | const upb_ExtensionRegistry* extreg, |
| 8002 | int options, upb_Arena* arena) { |
| 8003 | google_protobuf_FieldOptions* ret = google_protobuf_FieldOptions_new(arena); |
| 8004 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 8005 | 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] | 8006 | kUpb_DecodeStatus_Ok) { |
| 8007 | return NULL; |
| 8008 | } |
| 8009 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8010 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8011 | 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] | 8012 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 8013 | (void)upb_Encode(msg, &google__protobuf__FieldOptions_msg_init, 0, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8014 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8015 | } |
| 8016 | UPB_INLINE char* google_protobuf_FieldOptions_serialize_ex(const google_protobuf_FieldOptions* msg, int options, |
| 8017 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8018 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 8019 | (void)upb_Encode(msg, &google__protobuf__FieldOptions_msg_init, options, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8020 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8021 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8022 | UPB_INLINE void google_protobuf_FieldOptions_clear_ctype(google_protobuf_FieldOptions* msg) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8023 | 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] | 8024 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8025 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8026 | 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] | 8027 | int32_t default_val = 0; |
| 8028 | int32_t ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8029 | 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] | 8030 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8031 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8032 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8033 | 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] | 8034 | 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] | 8035 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8036 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8037 | UPB_INLINE void google_protobuf_FieldOptions_clear_packed(google_protobuf_FieldOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8038 | 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] | 8039 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8040 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8041 | UPB_INLINE bool google_protobuf_FieldOptions_packed(const google_protobuf_FieldOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8042 | bool default_val = false; |
| 8043 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8044 | 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] | 8045 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8046 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8047 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8048 | 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] | 8049 | 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] | 8050 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8051 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8052 | UPB_INLINE void google_protobuf_FieldOptions_clear_deprecated(google_protobuf_FieldOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8053 | 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] | 8054 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8055 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8056 | UPB_INLINE bool google_protobuf_FieldOptions_deprecated(const google_protobuf_FieldOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8057 | bool default_val = false; |
| 8058 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8059 | 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] | 8060 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8061 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8062 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8063 | 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] | 8064 | 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] | 8065 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8066 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8067 | UPB_INLINE void google_protobuf_FieldOptions_clear_lazy(google_protobuf_FieldOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8068 | 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] | 8069 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8070 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8071 | UPB_INLINE bool google_protobuf_FieldOptions_lazy(const google_protobuf_FieldOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8072 | bool default_val = false; |
| 8073 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8074 | 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] | 8075 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8076 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8077 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8078 | 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] | 8079 | 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] | 8080 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8081 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8082 | UPB_INLINE void google_protobuf_FieldOptions_clear_jstype(google_protobuf_FieldOptions* msg) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8083 | 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] | 8084 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8085 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8086 | 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] | 8087 | int32_t default_val = 0; |
| 8088 | int32_t ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8089 | 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] | 8090 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8091 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8092 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8093 | 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] | 8094 | 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] | 8095 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8096 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8097 | UPB_INLINE void google_protobuf_FieldOptions_clear_weak(google_protobuf_FieldOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8098 | 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] | 8099 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8100 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8101 | UPB_INLINE bool google_protobuf_FieldOptions_weak(const google_protobuf_FieldOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8102 | bool default_val = false; |
| 8103 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8104 | 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] | 8105 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8106 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8107 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8108 | 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] | 8109 | 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] | 8110 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8111 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8112 | 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] | 8113 | 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] | 8114 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8115 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8116 | 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] | 8117 | bool default_val = false; |
| 8118 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8119 | 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] | 8120 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8121 | return ret; |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8122 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8123 | 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] | 8124 | 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] | 8125 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8126 | } |
Protobuf Team Bot | 9238c48 | 2022-12-16 20:01:55 -0800 | [diff] [blame] | 8127 | 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] | 8128 | 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] | 8129 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 8130 | } |
| 8131 | UPB_INLINE bool google_protobuf_FieldOptions_debug_redact(const google_protobuf_FieldOptions* msg) { |
| 8132 | bool default_val = false; |
| 8133 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8134 | 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] | 8135 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 8136 | return ret; |
| 8137 | } |
| 8138 | 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] | 8139 | 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] | 8140 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 8141 | } |
Adam Cozzette | 5a56837 | 2023-01-24 20:35:59 -0800 | [diff] [blame] | 8142 | UPB_INLINE void google_protobuf_FieldOptions_clear_retention(google_protobuf_FieldOptions* msg) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8143 | 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] | 8144 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 8145 | } |
| 8146 | UPB_INLINE int32_t google_protobuf_FieldOptions_retention(const google_protobuf_FieldOptions* msg) { |
| 8147 | int32_t default_val = 0; |
| 8148 | int32_t ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8149 | 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] | 8150 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 8151 | return ret; |
| 8152 | } |
| 8153 | 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] | 8154 | 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] | 8155 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 8156 | } |
Mike Kruskal | 0c12139 | 2023-03-18 00:05:41 -0700 | [diff] [blame] | 8157 | UPB_INLINE void google_protobuf_FieldOptions_clear_targets(google_protobuf_FieldOptions* msg) { |
Sandy Zhang | 96c601d | 2023-07-05 12:39:20 -0700 | [diff] [blame] | 8158 | 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] | 8159 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 8160 | } |
Mike Kruskal | 0c12139 | 2023-03-18 00:05:41 -0700 | [diff] [blame] | 8161 | 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] | 8162 | 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] | 8163 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 8164 | if (arr) { |
| 8165 | if (size) *size = arr->size; |
| 8166 | return (int32_t const*)_upb_array_constptr(arr); |
| 8167 | } else { |
| 8168 | if (size) *size = 0; |
| 8169 | return NULL; |
| 8170 | } |
Adam Cozzette | 5a56837 | 2023-01-24 20:35:59 -0800 | [diff] [blame] | 8171 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 8172 | 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] | 8173 | 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] | 8174 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 8175 | if (size) { |
| 8176 | *size = arr ? arr->size : 0; |
| 8177 | } |
| 8178 | return arr; |
| 8179 | } |
| 8180 | 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] | 8181 | 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] | 8182 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 8183 | (upb_Message*)msg, &field, arena); |
| 8184 | if (size) { |
| 8185 | *size = arr ? arr->size : 0; |
| 8186 | } |
| 8187 | return arr; |
| 8188 | } |
Mike Kruskal | 0c12139 | 2023-03-18 00:05:41 -0700 | [diff] [blame] | 8189 | UPB_INLINE bool google_protobuf_FieldOptions_has_targets(const google_protobuf_FieldOptions* msg) { |
| 8190 | size_t size; |
| 8191 | google_protobuf_FieldOptions_targets(msg, &size); |
| 8192 | return size != 0; |
Adam Cozzette | 5a56837 | 2023-01-24 20:35:59 -0800 | [diff] [blame] | 8193 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8194 | 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] | 8195 | 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] | 8196 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 8197 | } |
| 8198 | 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] | 8199 | 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] | 8200 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 8201 | if (arr) { |
| 8202 | if (size) *size = arr->size; |
| 8203 | return (const google_protobuf_FieldOptions_EditionDefault* const*)_upb_array_constptr(arr); |
| 8204 | } else { |
| 8205 | if (size) *size = 0; |
| 8206 | return NULL; |
| 8207 | } |
| 8208 | } |
| 8209 | 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] | 8210 | 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] | 8211 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 8212 | if (size) { |
| 8213 | *size = arr ? arr->size : 0; |
| 8214 | } |
| 8215 | return arr; |
| 8216 | } |
| 8217 | 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] | 8218 | 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] | 8219 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 8220 | (upb_Message*)msg, &field, arena); |
| 8221 | if (size) { |
| 8222 | *size = arr ? arr->size : 0; |
| 8223 | } |
| 8224 | return arr; |
| 8225 | } |
| 8226 | UPB_INLINE bool google_protobuf_FieldOptions_has_edition_defaults(const google_protobuf_FieldOptions* msg) { |
| 8227 | size_t size; |
| 8228 | google_protobuf_FieldOptions_edition_defaults(msg, &size); |
| 8229 | return size != 0; |
| 8230 | } |
| 8231 | UPB_INLINE void google_protobuf_FieldOptions_clear_features(google_protobuf_FieldOptions* msg) { |
Sandy Zhang | 96c601d | 2023-07-05 12:39:20 -0700 | [diff] [blame] | 8232 | 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] | 8233 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 8234 | } |
| 8235 | UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_FieldOptions_features(const google_protobuf_FieldOptions* msg) { |
| 8236 | const google_protobuf_FeatureSet* default_val = NULL; |
| 8237 | const google_protobuf_FeatureSet* ret; |
Sandy Zhang | 96c601d | 2023-07-05 12:39:20 -0700 | [diff] [blame] | 8238 | 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] | 8239 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 8240 | return ret; |
| 8241 | } |
| 8242 | 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] | 8243 | 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] | 8244 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 8245 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8246 | 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] | 8247 | 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] | 8248 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8249 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 8250 | 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] | 8251 | 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] | 8252 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 8253 | if (arr) { |
| 8254 | if (size) *size = arr->size; |
| 8255 | return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr); |
| 8256 | } else { |
| 8257 | if (size) *size = 0; |
| 8258 | return NULL; |
| 8259 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8260 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 8261 | 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] | 8262 | 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] | 8263 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 8264 | if (size) { |
| 8265 | *size = arr ? arr->size : 0; |
| 8266 | } |
| 8267 | return arr; |
| 8268 | } |
| 8269 | 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] | 8270 | 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] | 8271 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 8272 | (upb_Message*)msg, &field, arena); |
| 8273 | if (size) { |
| 8274 | *size = arr ? arr->size : 0; |
| 8275 | } |
| 8276 | return arr; |
| 8277 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8278 | UPB_INLINE bool google_protobuf_FieldOptions_has_uninterpreted_option(const google_protobuf_FieldOptions* msg) { |
| 8279 | size_t size; |
| 8280 | google_protobuf_FieldOptions_uninterpreted_option(msg, &size); |
| 8281 | return size != 0; |
| 8282 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8283 | |
| 8284 | 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] | 8285 | 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] | 8286 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8287 | } |
| 8288 | 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] | 8289 | 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] | 8290 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8291 | } |
| 8292 | 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] | 8293 | 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] | 8294 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8295 | } |
| 8296 | 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] | 8297 | 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] | 8298 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8299 | } |
| 8300 | 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] | 8301 | 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] | 8302 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8303 | } |
| 8304 | 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] | 8305 | 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] | 8306 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8307 | } |
| 8308 | 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] | 8309 | 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] | 8310 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8311 | } |
| 8312 | 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] | 8313 | 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] | 8314 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8315 | } |
Adam Cozzette | 5a56837 | 2023-01-24 20:35:59 -0800 | [diff] [blame] | 8316 | 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] | 8317 | 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] | 8318 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 8319 | } |
Mike Kruskal | 0c12139 | 2023-03-18 00:05:41 -0700 | [diff] [blame] | 8320 | 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] | 8321 | 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] | 8322 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 8323 | if (arr) { |
| 8324 | if (size) *size = arr->size; |
| 8325 | return (int32_t*)_upb_array_ptr(arr); |
| 8326 | } else { |
| 8327 | if (size) *size = 0; |
| 8328 | return NULL; |
| 8329 | } |
| 8330 | } |
| 8331 | 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] | 8332 | 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] | 8333 | return (int32_t*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Mike Kruskal | 0c12139 | 2023-03-18 00:05:41 -0700 | [diff] [blame] | 8334 | } |
| 8335 | 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] | 8336 | 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] | 8337 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 8338 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 8339 | return false; |
| 8340 | } |
| 8341 | _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val)); |
| 8342 | return true; |
Adam Cozzette | 5a56837 | 2023-01-24 20:35:59 -0800 | [diff] [blame] | 8343 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8344 | 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] | 8345 | 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] | 8346 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 8347 | if (arr) { |
| 8348 | if (size) *size = arr->size; |
| 8349 | return (google_protobuf_FieldOptions_EditionDefault**)_upb_array_ptr(arr); |
| 8350 | } else { |
| 8351 | if (size) *size = 0; |
| 8352 | return NULL; |
| 8353 | } |
| 8354 | } |
| 8355 | 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] | 8356 | 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] | 8357 | return (google_protobuf_FieldOptions_EditionDefault**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
| 8358 | } |
| 8359 | 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] | 8360 | 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] | 8361 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 8362 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 8363 | return NULL; |
| 8364 | } |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 8365 | struct google_protobuf_FieldOptions_EditionDefault* sub = (struct google_protobuf_FieldOptions_EditionDefault*)_upb_Message_New(&google__protobuf__FieldOptions__EditionDefault_msg_init, arena); |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8366 | if (!arr || !sub) return NULL; |
| 8367 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
| 8368 | return sub; |
| 8369 | } |
| 8370 | 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] | 8371 | 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] | 8372 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 8373 | } |
| 8374 | UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_FieldOptions_mutable_features(google_protobuf_FieldOptions* msg, upb_Arena* arena) { |
| 8375 | struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_FieldOptions_features(msg); |
| 8376 | if (sub == NULL) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 8377 | sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena); |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8378 | if (sub) google_protobuf_FieldOptions_set_features(msg, sub); |
| 8379 | } |
| 8380 | return sub; |
| 8381 | } |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8382 | 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] | 8383 | 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] | 8384 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 8385 | if (arr) { |
| 8386 | if (size) *size = arr->size; |
| 8387 | return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr); |
| 8388 | } else { |
| 8389 | if (size) *size = 0; |
| 8390 | return NULL; |
| 8391 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8392 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 8393 | 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] | 8394 | 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] | 8395 | return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8396 | } |
| 8397 | 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] | 8398 | 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] | 8399 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 8400 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 8401 | return NULL; |
| 8402 | } |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 8403 | 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] | 8404 | if (!arr || !sub) return NULL; |
| 8405 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8406 | return sub; |
| 8407 | } |
| 8408 | |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8409 | /* google.protobuf.FieldOptions.EditionDefault */ |
| 8410 | |
| 8411 | UPB_INLINE google_protobuf_FieldOptions_EditionDefault* google_protobuf_FieldOptions_EditionDefault_new(upb_Arena* arena) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 8412 | return (google_protobuf_FieldOptions_EditionDefault*)_upb_Message_New(&google__protobuf__FieldOptions__EditionDefault_msg_init, arena); |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8413 | } |
| 8414 | UPB_INLINE google_protobuf_FieldOptions_EditionDefault* google_protobuf_FieldOptions_EditionDefault_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 8415 | google_protobuf_FieldOptions_EditionDefault* ret = google_protobuf_FieldOptions_EditionDefault_new(arena); |
| 8416 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 8417 | if (upb_Decode(buf, size, ret, &google__protobuf__FieldOptions__EditionDefault_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8418 | return NULL; |
| 8419 | } |
| 8420 | return ret; |
| 8421 | } |
| 8422 | UPB_INLINE google_protobuf_FieldOptions_EditionDefault* google_protobuf_FieldOptions_EditionDefault_parse_ex(const char* buf, size_t size, |
| 8423 | const upb_ExtensionRegistry* extreg, |
| 8424 | int options, upb_Arena* arena) { |
| 8425 | google_protobuf_FieldOptions_EditionDefault* ret = google_protobuf_FieldOptions_EditionDefault_new(arena); |
| 8426 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 8427 | if (upb_Decode(buf, size, ret, &google__protobuf__FieldOptions__EditionDefault_msg_init, extreg, options, arena) != |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8428 | kUpb_DecodeStatus_Ok) { |
| 8429 | return NULL; |
| 8430 | } |
| 8431 | return ret; |
| 8432 | } |
| 8433 | UPB_INLINE char* google_protobuf_FieldOptions_EditionDefault_serialize(const google_protobuf_FieldOptions_EditionDefault* msg, upb_Arena* arena, size_t* len) { |
| 8434 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 8435 | (void)upb_Encode(msg, &google__protobuf__FieldOptions__EditionDefault_msg_init, 0, arena, &ptr, len); |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8436 | return ptr; |
| 8437 | } |
| 8438 | UPB_INLINE char* google_protobuf_FieldOptions_EditionDefault_serialize_ex(const google_protobuf_FieldOptions_EditionDefault* msg, int options, |
| 8439 | upb_Arena* arena, size_t* len) { |
| 8440 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 8441 | (void)upb_Encode(msg, &google__protobuf__FieldOptions__EditionDefault_msg_init, options, arena, &ptr, len); |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8442 | return ptr; |
| 8443 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8444 | UPB_INLINE void google_protobuf_FieldOptions_EditionDefault_clear_value(google_protobuf_FieldOptions_EditionDefault* msg) { |
Protobuf Team Bot | ab58f8f | 2023-09-26 16:14:19 +0000 | [diff] [blame] | 8445 | const upb_MiniTableField field = {2, 8, 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8446 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 8447 | } |
| 8448 | UPB_INLINE upb_StringView google_protobuf_FieldOptions_EditionDefault_value(const google_protobuf_FieldOptions_EditionDefault* msg) { |
| 8449 | upb_StringView default_val = upb_StringView_FromString(""); |
| 8450 | upb_StringView ret; |
Protobuf Team Bot | ab58f8f | 2023-09-26 16:14:19 +0000 | [diff] [blame] | 8451 | const upb_MiniTableField field = {2, 8, 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8452 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 8453 | return ret; |
| 8454 | } |
| 8455 | UPB_INLINE bool google_protobuf_FieldOptions_EditionDefault_has_value(const google_protobuf_FieldOptions_EditionDefault* msg) { |
Protobuf Team Bot | ab58f8f | 2023-09-26 16:14:19 +0000 | [diff] [blame] | 8456 | const upb_MiniTableField field = {2, 8, 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Protobuf Team Bot | fa98bb3 | 2023-09-01 18:11:09 +0000 | [diff] [blame] | 8457 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 8458 | } |
Protobuf Team Bot | ab58f8f | 2023-09-26 16:14:19 +0000 | [diff] [blame] | 8459 | UPB_INLINE void google_protobuf_FieldOptions_EditionDefault_clear_edition(google_protobuf_FieldOptions_EditionDefault* msg) { |
| 8460 | const upb_MiniTableField field = {3, 4, 2, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Protobuf Team Bot | fa98bb3 | 2023-09-01 18:11:09 +0000 | [diff] [blame] | 8461 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 8462 | } |
Protobuf Team Bot | ab58f8f | 2023-09-26 16:14:19 +0000 | [diff] [blame] | 8463 | UPB_INLINE int32_t google_protobuf_FieldOptions_EditionDefault_edition(const google_protobuf_FieldOptions_EditionDefault* msg) { |
Protobuf Team Bot | fa98bb3 | 2023-09-01 18:11:09 +0000 | [diff] [blame] | 8464 | int32_t default_val = 0; |
| 8465 | int32_t ret; |
Protobuf Team Bot | ab58f8f | 2023-09-26 16:14:19 +0000 | [diff] [blame] | 8466 | const upb_MiniTableField field = {3, 4, 2, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Protobuf Team Bot | fa98bb3 | 2023-09-01 18:11:09 +0000 | [diff] [blame] | 8467 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 8468 | return ret; |
| 8469 | } |
Protobuf Team Bot | ab58f8f | 2023-09-26 16:14:19 +0000 | [diff] [blame] | 8470 | UPB_INLINE bool google_protobuf_FieldOptions_EditionDefault_has_edition(const google_protobuf_FieldOptions_EditionDefault* msg) { |
| 8471 | const upb_MiniTableField field = {3, 4, 2, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8472 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 8473 | } |
| 8474 | |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8475 | UPB_INLINE void google_protobuf_FieldOptions_EditionDefault_set_value(google_protobuf_FieldOptions_EditionDefault *msg, upb_StringView value) { |
Protobuf Team Bot | ab58f8f | 2023-09-26 16:14:19 +0000 | [diff] [blame] | 8476 | const upb_MiniTableField field = {2, 8, 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Protobuf Team Bot | fa98bb3 | 2023-09-01 18:11:09 +0000 | [diff] [blame] | 8477 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 8478 | } |
Protobuf Team Bot | ab58f8f | 2023-09-26 16:14:19 +0000 | [diff] [blame] | 8479 | UPB_INLINE void google_protobuf_FieldOptions_EditionDefault_set_edition(google_protobuf_FieldOptions_EditionDefault *msg, int32_t value) { |
| 8480 | const upb_MiniTableField field = {3, 4, 2, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8481 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 8482 | } |
| 8483 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8484 | /* google.protobuf.OneofOptions */ |
| 8485 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8486 | UPB_INLINE google_protobuf_OneofOptions* google_protobuf_OneofOptions_new(upb_Arena* arena) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 8487 | 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] | 8488 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8489 | UPB_INLINE google_protobuf_OneofOptions* google_protobuf_OneofOptions_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 8490 | google_protobuf_OneofOptions* ret = google_protobuf_OneofOptions_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 8491 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 8492 | 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] | 8493 | return NULL; |
| 8494 | } |
| 8495 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8496 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8497 | UPB_INLINE google_protobuf_OneofOptions* google_protobuf_OneofOptions_parse_ex(const char* buf, size_t size, |
| 8498 | const upb_ExtensionRegistry* extreg, |
| 8499 | int options, upb_Arena* arena) { |
| 8500 | google_protobuf_OneofOptions* ret = google_protobuf_OneofOptions_new(arena); |
| 8501 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 8502 | 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] | 8503 | kUpb_DecodeStatus_Ok) { |
| 8504 | return NULL; |
| 8505 | } |
| 8506 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8507 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8508 | 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] | 8509 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 8510 | (void)upb_Encode(msg, &google__protobuf__OneofOptions_msg_init, 0, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8511 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8512 | } |
| 8513 | UPB_INLINE char* google_protobuf_OneofOptions_serialize_ex(const google_protobuf_OneofOptions* msg, int options, |
| 8514 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8515 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 8516 | (void)upb_Encode(msg, &google__protobuf__OneofOptions_msg_init, options, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8517 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8518 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8519 | UPB_INLINE void google_protobuf_OneofOptions_clear_features(google_protobuf_OneofOptions* msg) { |
| 8520 | 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)}; |
| 8521 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 8522 | } |
| 8523 | UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_OneofOptions_features(const google_protobuf_OneofOptions* msg) { |
| 8524 | const google_protobuf_FeatureSet* default_val = NULL; |
| 8525 | const google_protobuf_FeatureSet* ret; |
| 8526 | 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)}; |
| 8527 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 8528 | return ret; |
| 8529 | } |
| 8530 | UPB_INLINE bool google_protobuf_OneofOptions_has_features(const google_protobuf_OneofOptions* msg) { |
| 8531 | 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)}; |
| 8532 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 8533 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8534 | 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] | 8535 | 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] | 8536 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8537 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 8538 | 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] | 8539 | 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] | 8540 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 8541 | if (arr) { |
| 8542 | if (size) *size = arr->size; |
| 8543 | return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr); |
| 8544 | } else { |
| 8545 | if (size) *size = 0; |
| 8546 | return NULL; |
| 8547 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8548 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 8549 | 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] | 8550 | 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] | 8551 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 8552 | if (size) { |
| 8553 | *size = arr ? arr->size : 0; |
| 8554 | } |
| 8555 | return arr; |
| 8556 | } |
| 8557 | 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] | 8558 | 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] | 8559 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 8560 | (upb_Message*)msg, &field, arena); |
| 8561 | if (size) { |
| 8562 | *size = arr ? arr->size : 0; |
| 8563 | } |
| 8564 | return arr; |
| 8565 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8566 | UPB_INLINE bool google_protobuf_OneofOptions_has_uninterpreted_option(const google_protobuf_OneofOptions* msg) { |
| 8567 | size_t size; |
| 8568 | google_protobuf_OneofOptions_uninterpreted_option(msg, &size); |
| 8569 | return size != 0; |
| 8570 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8571 | |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8572 | UPB_INLINE void google_protobuf_OneofOptions_set_features(google_protobuf_OneofOptions *msg, google_protobuf_FeatureSet* value) { |
| 8573 | 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)}; |
| 8574 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 8575 | } |
| 8576 | UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_OneofOptions_mutable_features(google_protobuf_OneofOptions* msg, upb_Arena* arena) { |
| 8577 | struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_OneofOptions_features(msg); |
| 8578 | if (sub == NULL) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 8579 | sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena); |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8580 | if (sub) google_protobuf_OneofOptions_set_features(msg, sub); |
| 8581 | } |
| 8582 | return sub; |
| 8583 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 8584 | 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] | 8585 | upb_MiniTableField field = {999, UPB_SIZE(8, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 8586 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 8587 | if (arr) { |
| 8588 | if (size) *size = arr->size; |
| 8589 | return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr); |
| 8590 | } else { |
| 8591 | if (size) *size = 0; |
| 8592 | return NULL; |
| 8593 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8594 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 8595 | 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] | 8596 | 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] | 8597 | return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8598 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8599 | 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] | 8600 | 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] | 8601 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 8602 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 8603 | return NULL; |
| 8604 | } |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 8605 | 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] | 8606 | if (!arr || !sub) return NULL; |
| 8607 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8608 | return sub; |
| 8609 | } |
| 8610 | |
| 8611 | /* google.protobuf.EnumOptions */ |
| 8612 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8613 | UPB_INLINE google_protobuf_EnumOptions* google_protobuf_EnumOptions_new(upb_Arena* arena) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 8614 | 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] | 8615 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8616 | UPB_INLINE google_protobuf_EnumOptions* google_protobuf_EnumOptions_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 8617 | google_protobuf_EnumOptions* ret = google_protobuf_EnumOptions_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 8618 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 8619 | 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] | 8620 | return NULL; |
| 8621 | } |
| 8622 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8623 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8624 | UPB_INLINE google_protobuf_EnumOptions* google_protobuf_EnumOptions_parse_ex(const char* buf, size_t size, |
| 8625 | const upb_ExtensionRegistry* extreg, |
| 8626 | int options, upb_Arena* arena) { |
| 8627 | google_protobuf_EnumOptions* ret = google_protobuf_EnumOptions_new(arena); |
| 8628 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 8629 | 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] | 8630 | kUpb_DecodeStatus_Ok) { |
| 8631 | return NULL; |
| 8632 | } |
| 8633 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8634 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8635 | 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] | 8636 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 8637 | (void)upb_Encode(msg, &google__protobuf__EnumOptions_msg_init, 0, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8638 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8639 | } |
| 8640 | UPB_INLINE char* google_protobuf_EnumOptions_serialize_ex(const google_protobuf_EnumOptions* msg, int options, |
| 8641 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8642 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 8643 | (void)upb_Encode(msg, &google__protobuf__EnumOptions_msg_init, options, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8644 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8645 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8646 | 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] | 8647 | 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] | 8648 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8649 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8650 | 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] | 8651 | bool default_val = false; |
| 8652 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8653 | 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] | 8654 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8655 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8656 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8657 | 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] | 8658 | 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] | 8659 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8660 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8661 | UPB_INLINE void google_protobuf_EnumOptions_clear_deprecated(google_protobuf_EnumOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8662 | 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] | 8663 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8664 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8665 | UPB_INLINE bool google_protobuf_EnumOptions_deprecated(const google_protobuf_EnumOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8666 | bool default_val = false; |
| 8667 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8668 | 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] | 8669 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8670 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8671 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8672 | 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] | 8673 | 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] | 8674 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8675 | } |
Mike Kruskal | 6b87d6f | 2022-12-14 10:36:53 -0800 | [diff] [blame] | 8676 | 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] | 8677 | 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] | 8678 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 8679 | } |
| 8680 | UPB_INLINE bool google_protobuf_EnumOptions_deprecated_legacy_json_field_conflicts(const google_protobuf_EnumOptions* msg) { |
| 8681 | bool default_val = false; |
| 8682 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8683 | 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] | 8684 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 8685 | return ret; |
| 8686 | } |
| 8687 | 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] | 8688 | 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] | 8689 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 8690 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8691 | UPB_INLINE void google_protobuf_EnumOptions_clear_features(google_protobuf_EnumOptions* msg) { |
| 8692 | 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)}; |
| 8693 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 8694 | } |
| 8695 | UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_EnumOptions_features(const google_protobuf_EnumOptions* msg) { |
| 8696 | const google_protobuf_FeatureSet* default_val = NULL; |
| 8697 | const google_protobuf_FeatureSet* ret; |
| 8698 | 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)}; |
| 8699 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 8700 | return ret; |
| 8701 | } |
| 8702 | UPB_INLINE bool google_protobuf_EnumOptions_has_features(const google_protobuf_EnumOptions* msg) { |
| 8703 | 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)}; |
| 8704 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 8705 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8706 | 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] | 8707 | 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] | 8708 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8709 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 8710 | 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] | 8711 | 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] | 8712 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 8713 | if (arr) { |
| 8714 | if (size) *size = arr->size; |
| 8715 | return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr); |
| 8716 | } else { |
| 8717 | if (size) *size = 0; |
| 8718 | return NULL; |
| 8719 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8720 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 8721 | 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] | 8722 | 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] | 8723 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 8724 | if (size) { |
| 8725 | *size = arr ? arr->size : 0; |
| 8726 | } |
| 8727 | return arr; |
| 8728 | } |
| 8729 | 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] | 8730 | 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] | 8731 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 8732 | (upb_Message*)msg, &field, arena); |
| 8733 | if (size) { |
| 8734 | *size = arr ? arr->size : 0; |
| 8735 | } |
| 8736 | return arr; |
| 8737 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8738 | UPB_INLINE bool google_protobuf_EnumOptions_has_uninterpreted_option(const google_protobuf_EnumOptions* msg) { |
| 8739 | size_t size; |
| 8740 | google_protobuf_EnumOptions_uninterpreted_option(msg, &size); |
| 8741 | return size != 0; |
| 8742 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8743 | |
| 8744 | 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] | 8745 | 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] | 8746 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8747 | } |
| 8748 | 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] | 8749 | 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] | 8750 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8751 | } |
| 8752 | 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] | 8753 | 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] | 8754 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8755 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8756 | UPB_INLINE void google_protobuf_EnumOptions_set_features(google_protobuf_EnumOptions *msg, google_protobuf_FeatureSet* value) { |
| 8757 | 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)}; |
| 8758 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 8759 | } |
| 8760 | UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_EnumOptions_mutable_features(google_protobuf_EnumOptions* msg, upb_Arena* arena) { |
| 8761 | struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_EnumOptions_features(msg); |
| 8762 | if (sub == NULL) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 8763 | sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena); |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8764 | if (sub) google_protobuf_EnumOptions_set_features(msg, sub); |
| 8765 | } |
| 8766 | return sub; |
| 8767 | } |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8768 | 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] | 8769 | 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] | 8770 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 8771 | if (arr) { |
| 8772 | if (size) *size = arr->size; |
| 8773 | return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr); |
| 8774 | } else { |
| 8775 | if (size) *size = 0; |
| 8776 | return NULL; |
| 8777 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8778 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 8779 | 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] | 8780 | 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] | 8781 | return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8782 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8783 | 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] | 8784 | 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] | 8785 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 8786 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 8787 | return NULL; |
| 8788 | } |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 8789 | 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] | 8790 | if (!arr || !sub) return NULL; |
| 8791 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8792 | return sub; |
| 8793 | } |
| 8794 | |
| 8795 | /* google.protobuf.EnumValueOptions */ |
| 8796 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8797 | UPB_INLINE google_protobuf_EnumValueOptions* google_protobuf_EnumValueOptions_new(upb_Arena* arena) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 8798 | 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] | 8799 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8800 | UPB_INLINE google_protobuf_EnumValueOptions* google_protobuf_EnumValueOptions_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 8801 | google_protobuf_EnumValueOptions* ret = google_protobuf_EnumValueOptions_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 8802 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 8803 | 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] | 8804 | return NULL; |
| 8805 | } |
| 8806 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8807 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8808 | UPB_INLINE google_protobuf_EnumValueOptions* google_protobuf_EnumValueOptions_parse_ex(const char* buf, size_t size, |
| 8809 | const upb_ExtensionRegistry* extreg, |
| 8810 | int options, upb_Arena* arena) { |
| 8811 | google_protobuf_EnumValueOptions* ret = google_protobuf_EnumValueOptions_new(arena); |
| 8812 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 8813 | 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] | 8814 | kUpb_DecodeStatus_Ok) { |
| 8815 | return NULL; |
| 8816 | } |
| 8817 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8818 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8819 | 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] | 8820 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 8821 | (void)upb_Encode(msg, &google__protobuf__EnumValueOptions_msg_init, 0, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8822 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8823 | } |
| 8824 | UPB_INLINE char* google_protobuf_EnumValueOptions_serialize_ex(const google_protobuf_EnumValueOptions* msg, int options, |
| 8825 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8826 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 8827 | (void)upb_Encode(msg, &google__protobuf__EnumValueOptions_msg_init, options, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8828 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8829 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8830 | UPB_INLINE void google_protobuf_EnumValueOptions_clear_deprecated(google_protobuf_EnumValueOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8831 | 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] | 8832 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8833 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8834 | UPB_INLINE bool google_protobuf_EnumValueOptions_deprecated(const google_protobuf_EnumValueOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8835 | bool default_val = false; |
| 8836 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8837 | 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] | 8838 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8839 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8840 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8841 | 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] | 8842 | 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] | 8843 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8844 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8845 | UPB_INLINE void google_protobuf_EnumValueOptions_clear_features(google_protobuf_EnumValueOptions* msg) { |
| 8846 | 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)}; |
| 8847 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 8848 | } |
| 8849 | UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_EnumValueOptions_features(const google_protobuf_EnumValueOptions* msg) { |
| 8850 | const google_protobuf_FeatureSet* default_val = NULL; |
| 8851 | const google_protobuf_FeatureSet* ret; |
| 8852 | 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)}; |
| 8853 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 8854 | return ret; |
| 8855 | } |
| 8856 | UPB_INLINE bool google_protobuf_EnumValueOptions_has_features(const google_protobuf_EnumValueOptions* msg) { |
| 8857 | 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)}; |
| 8858 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 8859 | } |
Mike Kruskal | 12e0f1d | 2023-05-31 15:40:54 -0700 | [diff] [blame] | 8860 | 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] | 8861 | 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] | 8862 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 8863 | } |
| 8864 | UPB_INLINE bool google_protobuf_EnumValueOptions_debug_redact(const google_protobuf_EnumValueOptions* msg) { |
| 8865 | bool default_val = false; |
| 8866 | bool ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8867 | 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] | 8868 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 8869 | return ret; |
| 8870 | } |
| 8871 | 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] | 8872 | 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] | 8873 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 8874 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8875 | 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] | 8876 | 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] | 8877 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8878 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 8879 | 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] | 8880 | 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] | 8881 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 8882 | if (arr) { |
| 8883 | if (size) *size = arr->size; |
| 8884 | return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr); |
| 8885 | } else { |
| 8886 | if (size) *size = 0; |
| 8887 | return NULL; |
| 8888 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8889 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 8890 | 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] | 8891 | 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] | 8892 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 8893 | if (size) { |
| 8894 | *size = arr ? arr->size : 0; |
| 8895 | } |
| 8896 | return arr; |
| 8897 | } |
| 8898 | 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] | 8899 | 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] | 8900 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 8901 | (upb_Message*)msg, &field, arena); |
| 8902 | if (size) { |
| 8903 | *size = arr ? arr->size : 0; |
| 8904 | } |
| 8905 | return arr; |
| 8906 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8907 | UPB_INLINE bool google_protobuf_EnumValueOptions_has_uninterpreted_option(const google_protobuf_EnumValueOptions* msg) { |
| 8908 | size_t size; |
| 8909 | google_protobuf_EnumValueOptions_uninterpreted_option(msg, &size); |
| 8910 | return size != 0; |
| 8911 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8912 | |
| 8913 | 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] | 8914 | 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] | 8915 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8916 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8917 | UPB_INLINE void google_protobuf_EnumValueOptions_set_features(google_protobuf_EnumValueOptions *msg, google_protobuf_FeatureSet* value) { |
| 8918 | 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)}; |
| 8919 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 8920 | } |
| 8921 | UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_EnumValueOptions_mutable_features(google_protobuf_EnumValueOptions* msg, upb_Arena* arena) { |
| 8922 | struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_EnumValueOptions_features(msg); |
| 8923 | if (sub == NULL) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 8924 | sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena); |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8925 | if (sub) google_protobuf_EnumValueOptions_set_features(msg, sub); |
| 8926 | } |
| 8927 | return sub; |
| 8928 | } |
Mike Kruskal | 12e0f1d | 2023-05-31 15:40:54 -0700 | [diff] [blame] | 8929 | 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] | 8930 | 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] | 8931 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 8932 | } |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8933 | 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] | 8934 | 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] | 8935 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 8936 | if (arr) { |
| 8937 | if (size) *size = arr->size; |
| 8938 | return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr); |
| 8939 | } else { |
| 8940 | if (size) *size = 0; |
| 8941 | return NULL; |
| 8942 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8943 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 8944 | 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] | 8945 | 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] | 8946 | return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8947 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8948 | 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] | 8949 | 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] | 8950 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 8951 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 8952 | return NULL; |
| 8953 | } |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 8954 | 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] | 8955 | if (!arr || !sub) return NULL; |
| 8956 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8957 | return sub; |
| 8958 | } |
| 8959 | |
| 8960 | /* google.protobuf.ServiceOptions */ |
| 8961 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8962 | UPB_INLINE google_protobuf_ServiceOptions* google_protobuf_ServiceOptions_new(upb_Arena* arena) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 8963 | 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] | 8964 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8965 | UPB_INLINE google_protobuf_ServiceOptions* google_protobuf_ServiceOptions_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 8966 | google_protobuf_ServiceOptions* ret = google_protobuf_ServiceOptions_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 8967 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 8968 | 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] | 8969 | return NULL; |
| 8970 | } |
| 8971 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8972 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8973 | UPB_INLINE google_protobuf_ServiceOptions* google_protobuf_ServiceOptions_parse_ex(const char* buf, size_t size, |
| 8974 | const upb_ExtensionRegistry* extreg, |
| 8975 | int options, upb_Arena* arena) { |
| 8976 | google_protobuf_ServiceOptions* ret = google_protobuf_ServiceOptions_new(arena); |
| 8977 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 8978 | 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] | 8979 | kUpb_DecodeStatus_Ok) { |
| 8980 | return NULL; |
| 8981 | } |
| 8982 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8983 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8984 | 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] | 8985 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 8986 | (void)upb_Encode(msg, &google__protobuf__ServiceOptions_msg_init, 0, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8987 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8988 | } |
| 8989 | UPB_INLINE char* google_protobuf_ServiceOptions_serialize_ex(const google_protobuf_ServiceOptions* msg, int options, |
| 8990 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8991 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 8992 | (void)upb_Encode(msg, &google__protobuf__ServiceOptions_msg_init, options, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8993 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8994 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8995 | UPB_INLINE void google_protobuf_ServiceOptions_clear_deprecated(google_protobuf_ServiceOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8996 | 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] | 8997 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8998 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8999 | UPB_INLINE bool google_protobuf_ServiceOptions_deprecated(const google_protobuf_ServiceOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 9000 | bool default_val = false; |
| 9001 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9002 | 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] | 9003 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 9004 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9005 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9006 | 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] | 9007 | 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] | 9008 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9009 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9010 | UPB_INLINE void google_protobuf_ServiceOptions_clear_features(google_protobuf_ServiceOptions* msg) { |
| 9011 | 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)}; |
| 9012 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 9013 | } |
| 9014 | UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_ServiceOptions_features(const google_protobuf_ServiceOptions* msg) { |
| 9015 | const google_protobuf_FeatureSet* default_val = NULL; |
| 9016 | const google_protobuf_FeatureSet* ret; |
| 9017 | 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)}; |
| 9018 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 9019 | return ret; |
| 9020 | } |
| 9021 | UPB_INLINE bool google_protobuf_ServiceOptions_has_features(const google_protobuf_ServiceOptions* msg) { |
| 9022 | 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)}; |
| 9023 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 9024 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9025 | 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] | 9026 | 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] | 9027 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9028 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9029 | 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] | 9030 | 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] | 9031 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 9032 | if (arr) { |
| 9033 | if (size) *size = arr->size; |
| 9034 | return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr); |
| 9035 | } else { |
| 9036 | if (size) *size = 0; |
| 9037 | return NULL; |
| 9038 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9039 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 9040 | 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] | 9041 | 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] | 9042 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 9043 | if (size) { |
| 9044 | *size = arr ? arr->size : 0; |
| 9045 | } |
| 9046 | return arr; |
| 9047 | } |
| 9048 | 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] | 9049 | 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] | 9050 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 9051 | (upb_Message*)msg, &field, arena); |
| 9052 | if (size) { |
| 9053 | *size = arr ? arr->size : 0; |
| 9054 | } |
| 9055 | return arr; |
| 9056 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9057 | UPB_INLINE bool google_protobuf_ServiceOptions_has_uninterpreted_option(const google_protobuf_ServiceOptions* msg) { |
| 9058 | size_t size; |
| 9059 | google_protobuf_ServiceOptions_uninterpreted_option(msg, &size); |
| 9060 | return size != 0; |
| 9061 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9062 | |
| 9063 | 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] | 9064 | 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] | 9065 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 9066 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9067 | UPB_INLINE void google_protobuf_ServiceOptions_set_features(google_protobuf_ServiceOptions *msg, google_protobuf_FeatureSet* value) { |
| 9068 | const upb_MiniTableField field = {34, UPB_SIZE(4, 8), 2, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
| 9069 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 9070 | } |
| 9071 | UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_ServiceOptions_mutable_features(google_protobuf_ServiceOptions* msg, upb_Arena* arena) { |
| 9072 | struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_ServiceOptions_features(msg); |
| 9073 | if (sub == NULL) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9074 | sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena); |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9075 | if (sub) google_protobuf_ServiceOptions_set_features(msg, sub); |
| 9076 | } |
| 9077 | return sub; |
| 9078 | } |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 9079 | 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] | 9080 | 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] | 9081 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 9082 | if (arr) { |
| 9083 | if (size) *size = arr->size; |
| 9084 | return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr); |
| 9085 | } else { |
| 9086 | if (size) *size = 0; |
| 9087 | return NULL; |
| 9088 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9089 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9090 | 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] | 9091 | 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] | 9092 | return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9093 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9094 | 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] | 9095 | 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] | 9096 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 9097 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 9098 | return NULL; |
| 9099 | } |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9100 | 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] | 9101 | if (!arr || !sub) return NULL; |
| 9102 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9103 | return sub; |
| 9104 | } |
| 9105 | |
| 9106 | /* google.protobuf.MethodOptions */ |
| 9107 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9108 | UPB_INLINE google_protobuf_MethodOptions* google_protobuf_MethodOptions_new(upb_Arena* arena) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9109 | 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] | 9110 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9111 | UPB_INLINE google_protobuf_MethodOptions* google_protobuf_MethodOptions_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 9112 | google_protobuf_MethodOptions* ret = google_protobuf_MethodOptions_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 9113 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9114 | 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] | 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_MethodOptions* google_protobuf_MethodOptions_parse_ex(const char* buf, size_t size, |
| 9120 | const upb_ExtensionRegistry* extreg, |
| 9121 | int options, upb_Arena* arena) { |
| 9122 | google_protobuf_MethodOptions* ret = google_protobuf_MethodOptions_new(arena); |
| 9123 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9124 | 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] | 9125 | kUpb_DecodeStatus_Ok) { |
| 9126 | return NULL; |
| 9127 | } |
| 9128 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9129 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9130 | 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] | 9131 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9132 | (void)upb_Encode(msg, &google__protobuf__MethodOptions_msg_init, 0, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9133 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9134 | } |
| 9135 | UPB_INLINE char* google_protobuf_MethodOptions_serialize_ex(const google_protobuf_MethodOptions* 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; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9138 | (void)upb_Encode(msg, &google__protobuf__MethodOptions_msg_init, options, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 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_MethodOptions_clear_deprecated(google_protobuf_MethodOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9142 | 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] | 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 bool google_protobuf_MethodOptions_deprecated(const google_protobuf_MethodOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 9146 | bool default_val = false; |
| 9147 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9148 | 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] | 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_MethodOptions_has_deprecated(const google_protobuf_MethodOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9153 | 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] | 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_MethodOptions_clear_idempotency_level(google_protobuf_MethodOptions* msg) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9157 | 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] | 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 int32_t google_protobuf_MethodOptions_idempotency_level(const google_protobuf_MethodOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 9161 | int32_t default_val = 0; |
| 9162 | int32_t ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9163 | 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] | 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 | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9166 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9167 | 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] | 9168 | const upb_MiniTableField field = {34, 4, 2, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
| 9169 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 9170 | } |
| 9171 | UPB_INLINE void google_protobuf_MethodOptions_clear_features(google_protobuf_MethodOptions* msg) { |
| 9172 | 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)}; |
| 9173 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 9174 | } |
| 9175 | UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_MethodOptions_features(const google_protobuf_MethodOptions* msg) { |
| 9176 | const google_protobuf_FeatureSet* default_val = NULL; |
| 9177 | const google_protobuf_FeatureSet* ret; |
| 9178 | 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)}; |
| 9179 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 9180 | return ret; |
| 9181 | } |
| 9182 | UPB_INLINE bool google_protobuf_MethodOptions_has_features(const google_protobuf_MethodOptions* msg) { |
| 9183 | 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] | 9184 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9185 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9186 | 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] | 9187 | 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] | 9188 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9189 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9190 | 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] | 9191 | 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] | 9192 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 9193 | if (arr) { |
| 9194 | if (size) *size = arr->size; |
| 9195 | return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr); |
| 9196 | } else { |
| 9197 | if (size) *size = 0; |
| 9198 | return NULL; |
| 9199 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9200 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 9201 | 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] | 9202 | 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] | 9203 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 9204 | if (size) { |
| 9205 | *size = arr ? arr->size : 0; |
| 9206 | } |
| 9207 | return arr; |
| 9208 | } |
| 9209 | 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] | 9210 | 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] | 9211 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 9212 | (upb_Message*)msg, &field, arena); |
| 9213 | if (size) { |
| 9214 | *size = arr ? arr->size : 0; |
| 9215 | } |
| 9216 | return arr; |
| 9217 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9218 | UPB_INLINE bool google_protobuf_MethodOptions_has_uninterpreted_option(const google_protobuf_MethodOptions* msg) { |
| 9219 | size_t size; |
| 9220 | google_protobuf_MethodOptions_uninterpreted_option(msg, &size); |
| 9221 | return size != 0; |
| 9222 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9223 | |
| 9224 | 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] | 9225 | 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] | 9226 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 9227 | } |
| 9228 | 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] | 9229 | 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] | 9230 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 9231 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9232 | UPB_INLINE void google_protobuf_MethodOptions_set_features(google_protobuf_MethodOptions *msg, google_protobuf_FeatureSet* value) { |
| 9233 | 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)}; |
| 9234 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 9235 | } |
| 9236 | UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_MethodOptions_mutable_features(google_protobuf_MethodOptions* msg, upb_Arena* arena) { |
| 9237 | struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_MethodOptions_features(msg); |
| 9238 | if (sub == NULL) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9239 | sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena); |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9240 | if (sub) google_protobuf_MethodOptions_set_features(msg, sub); |
| 9241 | } |
| 9242 | return sub; |
| 9243 | } |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 9244 | 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] | 9245 | 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] | 9246 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 9247 | if (arr) { |
| 9248 | if (size) *size = arr->size; |
| 9249 | return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr); |
| 9250 | } else { |
| 9251 | if (size) *size = 0; |
| 9252 | return NULL; |
| 9253 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9254 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9255 | 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] | 9256 | 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] | 9257 | return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9258 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9259 | 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] | 9260 | 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] | 9261 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 9262 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 9263 | return NULL; |
| 9264 | } |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9265 | 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] | 9266 | if (!arr || !sub) return NULL; |
| 9267 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9268 | return sub; |
| 9269 | } |
| 9270 | |
| 9271 | /* google.protobuf.UninterpretedOption */ |
| 9272 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9273 | UPB_INLINE google_protobuf_UninterpretedOption* google_protobuf_UninterpretedOption_new(upb_Arena* arena) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9274 | 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] | 9275 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9276 | UPB_INLINE google_protobuf_UninterpretedOption* google_protobuf_UninterpretedOption_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 9277 | google_protobuf_UninterpretedOption* ret = google_protobuf_UninterpretedOption_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 9278 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9279 | 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] | 9280 | return NULL; |
| 9281 | } |
| 9282 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9283 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9284 | UPB_INLINE google_protobuf_UninterpretedOption* google_protobuf_UninterpretedOption_parse_ex(const char* buf, size_t size, |
| 9285 | const upb_ExtensionRegistry* extreg, |
| 9286 | int options, upb_Arena* arena) { |
| 9287 | google_protobuf_UninterpretedOption* ret = google_protobuf_UninterpretedOption_new(arena); |
| 9288 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9289 | 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] | 9290 | kUpb_DecodeStatus_Ok) { |
| 9291 | return NULL; |
| 9292 | } |
| 9293 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9294 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9295 | 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] | 9296 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9297 | (void)upb_Encode(msg, &google__protobuf__UninterpretedOption_msg_init, 0, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9298 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9299 | } |
| 9300 | UPB_INLINE char* google_protobuf_UninterpretedOption_serialize_ex(const google_protobuf_UninterpretedOption* msg, int options, |
| 9301 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9302 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9303 | (void)upb_Encode(msg, &google__protobuf__UninterpretedOption_msg_init, options, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9304 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9305 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9306 | UPB_INLINE void google_protobuf_UninterpretedOption_clear_name(google_protobuf_UninterpretedOption* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9307 | 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] | 9308 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9309 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9310 | 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] | 9311 | 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] | 9312 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 9313 | if (arr) { |
| 9314 | if (size) *size = arr->size; |
| 9315 | return (const google_protobuf_UninterpretedOption_NamePart* const*)_upb_array_constptr(arr); |
| 9316 | } else { |
| 9317 | if (size) *size = 0; |
| 9318 | return NULL; |
| 9319 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9320 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 9321 | 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] | 9322 | 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] | 9323 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 9324 | if (size) { |
| 9325 | *size = arr ? arr->size : 0; |
| 9326 | } |
| 9327 | return arr; |
| 9328 | } |
| 9329 | 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] | 9330 | 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] | 9331 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 9332 | (upb_Message*)msg, &field, arena); |
| 9333 | if (size) { |
| 9334 | *size = arr ? arr->size : 0; |
| 9335 | } |
| 9336 | return arr; |
| 9337 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9338 | UPB_INLINE bool google_protobuf_UninterpretedOption_has_name(const google_protobuf_UninterpretedOption* msg) { |
| 9339 | size_t size; |
| 9340 | google_protobuf_UninterpretedOption_name(msg, &size); |
| 9341 | return size != 0; |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9342 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9343 | 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] | 9344 | 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] | 9345 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9346 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9347 | 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] | 9348 | upb_StringView default_val = upb_StringView_FromString(""); |
| 9349 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9350 | 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] | 9351 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 9352 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9353 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9354 | 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] | 9355 | 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] | 9356 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9357 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9358 | 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] | 9359 | 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] | 9360 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9361 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9362 | 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] | 9363 | uint64_t default_val = (uint64_t)0ull; |
| 9364 | uint64_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9365 | 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] | 9366 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 9367 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9368 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9369 | 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] | 9370 | 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] | 9371 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9372 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9373 | 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] | 9374 | 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] | 9375 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9376 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9377 | 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] | 9378 | int64_t default_val = (int64_t)0ll; |
| 9379 | int64_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9380 | 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] | 9381 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 9382 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9383 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9384 | 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] | 9385 | 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] | 9386 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9387 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9388 | 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] | 9389 | 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] | 9390 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9391 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9392 | 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] | 9393 | double default_val = 0; |
| 9394 | double ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9395 | 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] | 9396 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 9397 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9398 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9399 | 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] | 9400 | 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] | 9401 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9402 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9403 | 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] | 9404 | 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] | 9405 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9406 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9407 | 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] | 9408 | upb_StringView default_val = upb_StringView_FromString(""); |
| 9409 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9410 | 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] | 9411 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 9412 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9413 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9414 | 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] | 9415 | 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] | 9416 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9417 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9418 | 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] | 9419 | 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] | 9420 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9421 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9422 | 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] | 9423 | upb_StringView default_val = upb_StringView_FromString(""); |
| 9424 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9425 | 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] | 9426 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 9427 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9428 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9429 | 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] | 9430 | 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] | 9431 | return _upb_Message_HasNonExtensionField(msg, &field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9432 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9433 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9434 | 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] | 9435 | 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] | 9436 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 9437 | if (arr) { |
| 9438 | if (size) *size = arr->size; |
| 9439 | return (google_protobuf_UninterpretedOption_NamePart**)_upb_array_ptr(arr); |
| 9440 | } else { |
| 9441 | if (size) *size = 0; |
| 9442 | return NULL; |
| 9443 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9444 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9445 | 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] | 9446 | 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] | 9447 | return (google_protobuf_UninterpretedOption_NamePart**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9448 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9449 | 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] | 9450 | 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] | 9451 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 9452 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 9453 | return NULL; |
| 9454 | } |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9455 | 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] | 9456 | if (!arr || !sub) return NULL; |
| 9457 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9458 | return sub; |
| 9459 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9460 | 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] | 9461 | 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] | 9462 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 9463 | } |
| 9464 | 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] | 9465 | 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] | 9466 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 9467 | } |
| 9468 | 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] | 9469 | 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] | 9470 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 9471 | } |
| 9472 | 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] | 9473 | 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] | 9474 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 9475 | } |
| 9476 | 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] | 9477 | 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] | 9478 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 9479 | } |
| 9480 | 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] | 9481 | 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] | 9482 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9483 | } |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 9484 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9485 | /* google.protobuf.UninterpretedOption.NamePart */ |
| 9486 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9487 | UPB_INLINE google_protobuf_UninterpretedOption_NamePart* google_protobuf_UninterpretedOption_NamePart_new(upb_Arena* arena) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9488 | 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] | 9489 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9490 | UPB_INLINE google_protobuf_UninterpretedOption_NamePart* google_protobuf_UninterpretedOption_NamePart_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 9491 | google_protobuf_UninterpretedOption_NamePart* ret = google_protobuf_UninterpretedOption_NamePart_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 9492 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9493 | 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] | 9494 | return NULL; |
| 9495 | } |
| 9496 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9497 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9498 | UPB_INLINE google_protobuf_UninterpretedOption_NamePart* google_protobuf_UninterpretedOption_NamePart_parse_ex(const char* buf, size_t size, |
| 9499 | const upb_ExtensionRegistry* extreg, |
| 9500 | int options, upb_Arena* arena) { |
| 9501 | google_protobuf_UninterpretedOption_NamePart* ret = google_protobuf_UninterpretedOption_NamePart_new(arena); |
| 9502 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9503 | 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] | 9504 | kUpb_DecodeStatus_Ok) { |
| 9505 | return NULL; |
| 9506 | } |
| 9507 | return ret; |
| 9508 | } |
| 9509 | 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] | 9510 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9511 | (void)upb_Encode(msg, &google__protobuf__UninterpretedOption__NamePart_msg_init, 0, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9512 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9513 | } |
| 9514 | UPB_INLINE char* google_protobuf_UninterpretedOption_NamePart_serialize_ex(const google_protobuf_UninterpretedOption_NamePart* msg, int options, |
| 9515 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9516 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9517 | (void)upb_Encode(msg, &google__protobuf__UninterpretedOption__NamePart_msg_init, options, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9518 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9519 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9520 | 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] | 9521 | 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] | 9522 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9523 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9524 | 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] | 9525 | upb_StringView default_val = upb_StringView_FromString(""); |
| 9526 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9527 | 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] | 9528 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 9529 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9530 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9531 | 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] | 9532 | 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] | 9533 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9534 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9535 | 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] | 9536 | 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] | 9537 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9538 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9539 | 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] | 9540 | bool default_val = false; |
| 9541 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9542 | 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] | 9543 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 9544 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9545 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9546 | 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] | 9547 | 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] | 9548 | return _upb_Message_HasNonExtensionField(msg, &field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9549 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9550 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9551 | 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] | 9552 | 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] | 9553 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 9554 | } |
| 9555 | 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] | 9556 | 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] | 9557 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9558 | } |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 9559 | |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9560 | /* google.protobuf.FeatureSet */ |
| 9561 | |
| 9562 | UPB_INLINE google_protobuf_FeatureSet* google_protobuf_FeatureSet_new(upb_Arena* arena) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9563 | return (google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena); |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9564 | } |
| 9565 | UPB_INLINE google_protobuf_FeatureSet* google_protobuf_FeatureSet_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 9566 | google_protobuf_FeatureSet* ret = google_protobuf_FeatureSet_new(arena); |
| 9567 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9568 | if (upb_Decode(buf, size, ret, &google__protobuf__FeatureSet_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9569 | return NULL; |
| 9570 | } |
| 9571 | return ret; |
| 9572 | } |
| 9573 | UPB_INLINE google_protobuf_FeatureSet* google_protobuf_FeatureSet_parse_ex(const char* buf, size_t size, |
| 9574 | const upb_ExtensionRegistry* extreg, |
| 9575 | int options, upb_Arena* arena) { |
| 9576 | google_protobuf_FeatureSet* ret = google_protobuf_FeatureSet_new(arena); |
| 9577 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9578 | if (upb_Decode(buf, size, ret, &google__protobuf__FeatureSet_msg_init, extreg, options, arena) != |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9579 | kUpb_DecodeStatus_Ok) { |
| 9580 | return NULL; |
| 9581 | } |
| 9582 | return ret; |
| 9583 | } |
| 9584 | UPB_INLINE char* google_protobuf_FeatureSet_serialize(const google_protobuf_FeatureSet* msg, upb_Arena* arena, size_t* len) { |
| 9585 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9586 | (void)upb_Encode(msg, &google__protobuf__FeatureSet_msg_init, 0, arena, &ptr, len); |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9587 | return ptr; |
| 9588 | } |
| 9589 | UPB_INLINE char* google_protobuf_FeatureSet_serialize_ex(const google_protobuf_FeatureSet* msg, int options, |
| 9590 | upb_Arena* arena, size_t* len) { |
| 9591 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9592 | (void)upb_Encode(msg, &google__protobuf__FeatureSet_msg_init, options, arena, &ptr, len); |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9593 | return ptr; |
| 9594 | } |
| 9595 | 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] | 9596 | 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] | 9597 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 9598 | } |
| 9599 | UPB_INLINE int32_t google_protobuf_FeatureSet_field_presence(const google_protobuf_FeatureSet* msg) { |
| 9600 | int32_t default_val = 0; |
| 9601 | int32_t ret; |
Mike Kruskal | 60ec7bf | 2023-08-17 16:44:12 -0700 | [diff] [blame] | 9602 | 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] | 9603 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 9604 | return ret; |
| 9605 | } |
| 9606 | 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] | 9607 | 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] | 9608 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 9609 | } |
| 9610 | 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] | 9611 | 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] | 9612 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 9613 | } |
| 9614 | UPB_INLINE int32_t google_protobuf_FeatureSet_enum_type(const google_protobuf_FeatureSet* msg) { |
| 9615 | int32_t default_val = 0; |
| 9616 | int32_t ret; |
Mike Kruskal | 60ec7bf | 2023-08-17 16:44:12 -0700 | [diff] [blame] | 9617 | 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] | 9618 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 9619 | return ret; |
| 9620 | } |
| 9621 | 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] | 9622 | 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] | 9623 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 9624 | } |
| 9625 | 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] | 9626 | 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] | 9627 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 9628 | } |
| 9629 | UPB_INLINE int32_t google_protobuf_FeatureSet_repeated_field_encoding(const google_protobuf_FeatureSet* msg) { |
| 9630 | int32_t default_val = 0; |
| 9631 | int32_t ret; |
Mike Kruskal | 60ec7bf | 2023-08-17 16:44:12 -0700 | [diff] [blame] | 9632 | 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] | 9633 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 9634 | return ret; |
| 9635 | } |
| 9636 | 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] | 9637 | 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] | 9638 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 9639 | } |
Protobuf Team Bot | 6112795 | 2023-09-26 20:07:33 +0000 | [diff] [blame] | 9640 | UPB_INLINE void google_protobuf_FeatureSet_clear_utf8_validation(google_protobuf_FeatureSet* msg) { |
| 9641 | const upb_MiniTableField field = {4, 16, 4, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
| 9642 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 9643 | } |
| 9644 | UPB_INLINE int32_t google_protobuf_FeatureSet_utf8_validation(const google_protobuf_FeatureSet* msg) { |
| 9645 | int32_t default_val = 0; |
| 9646 | int32_t ret; |
| 9647 | const upb_MiniTableField field = {4, 16, 4, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
| 9648 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 9649 | return ret; |
| 9650 | } |
| 9651 | UPB_INLINE bool google_protobuf_FeatureSet_has_utf8_validation(const google_protobuf_FeatureSet* msg) { |
| 9652 | const upb_MiniTableField field = {4, 16, 4, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
| 9653 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 9654 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9655 | UPB_INLINE void google_protobuf_FeatureSet_clear_message_encoding(google_protobuf_FeatureSet* msg) { |
Protobuf Team Bot | 6112795 | 2023-09-26 20:07:33 +0000 | [diff] [blame] | 9656 | const upb_MiniTableField field = {5, 20, 5, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9657 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 9658 | } |
| 9659 | UPB_INLINE int32_t google_protobuf_FeatureSet_message_encoding(const google_protobuf_FeatureSet* msg) { |
| 9660 | int32_t default_val = 0; |
| 9661 | int32_t ret; |
Protobuf Team Bot | 6112795 | 2023-09-26 20:07:33 +0000 | [diff] [blame] | 9662 | const upb_MiniTableField field = {5, 20, 5, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9663 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 9664 | return ret; |
| 9665 | } |
| 9666 | UPB_INLINE bool google_protobuf_FeatureSet_has_message_encoding(const google_protobuf_FeatureSet* msg) { |
Protobuf Team Bot | 6112795 | 2023-09-26 20:07:33 +0000 | [diff] [blame] | 9667 | const upb_MiniTableField field = {5, 20, 5, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9668 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 9669 | } |
| 9670 | UPB_INLINE void google_protobuf_FeatureSet_clear_json_format(google_protobuf_FeatureSet* msg) { |
Protobuf Team Bot | 6112795 | 2023-09-26 20:07:33 +0000 | [diff] [blame] | 9671 | const upb_MiniTableField field = {6, 24, 6, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9672 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 9673 | } |
| 9674 | UPB_INLINE int32_t google_protobuf_FeatureSet_json_format(const google_protobuf_FeatureSet* msg) { |
| 9675 | int32_t default_val = 0; |
| 9676 | int32_t ret; |
Protobuf Team Bot | 6112795 | 2023-09-26 20:07:33 +0000 | [diff] [blame] | 9677 | const upb_MiniTableField field = {6, 24, 6, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9678 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 9679 | return ret; |
| 9680 | } |
| 9681 | UPB_INLINE bool google_protobuf_FeatureSet_has_json_format(const google_protobuf_FeatureSet* msg) { |
Protobuf Team Bot | 6112795 | 2023-09-26 20:07:33 +0000 | [diff] [blame] | 9682 | const upb_MiniTableField field = {6, 24, 6, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9683 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 9684 | } |
| 9685 | |
| 9686 | 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] | 9687 | 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] | 9688 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 9689 | } |
| 9690 | 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] | 9691 | 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] | 9692 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 9693 | } |
| 9694 | 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] | 9695 | 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] | 9696 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 9697 | } |
Protobuf Team Bot | 6112795 | 2023-09-26 20:07:33 +0000 | [diff] [blame] | 9698 | UPB_INLINE void google_protobuf_FeatureSet_set_utf8_validation(google_protobuf_FeatureSet *msg, int32_t value) { |
| 9699 | const upb_MiniTableField field = {4, 16, 4, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
| 9700 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 9701 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9702 | UPB_INLINE void google_protobuf_FeatureSet_set_message_encoding(google_protobuf_FeatureSet *msg, int32_t value) { |
Protobuf Team Bot | 6112795 | 2023-09-26 20:07:33 +0000 | [diff] [blame] | 9703 | const upb_MiniTableField field = {5, 20, 5, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9704 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 9705 | } |
| 9706 | UPB_INLINE void google_protobuf_FeatureSet_set_json_format(google_protobuf_FeatureSet *msg, int32_t value) { |
Protobuf Team Bot | 6112795 | 2023-09-26 20:07:33 +0000 | [diff] [blame] | 9707 | const upb_MiniTableField field = {6, 24, 6, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9708 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 9709 | } |
| 9710 | |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9711 | /* google.protobuf.FeatureSetDefaults */ |
| 9712 | |
| 9713 | UPB_INLINE google_protobuf_FeatureSetDefaults* google_protobuf_FeatureSetDefaults_new(upb_Arena* arena) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9714 | return (google_protobuf_FeatureSetDefaults*)_upb_Message_New(&google__protobuf__FeatureSetDefaults_msg_init, arena); |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9715 | } |
| 9716 | UPB_INLINE google_protobuf_FeatureSetDefaults* google_protobuf_FeatureSetDefaults_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 9717 | google_protobuf_FeatureSetDefaults* ret = google_protobuf_FeatureSetDefaults_new(arena); |
| 9718 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9719 | if (upb_Decode(buf, size, ret, &google__protobuf__FeatureSetDefaults_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9720 | return NULL; |
| 9721 | } |
| 9722 | return ret; |
| 9723 | } |
| 9724 | UPB_INLINE google_protobuf_FeatureSetDefaults* google_protobuf_FeatureSetDefaults_parse_ex(const char* buf, size_t size, |
| 9725 | const upb_ExtensionRegistry* extreg, |
| 9726 | int options, upb_Arena* arena) { |
| 9727 | google_protobuf_FeatureSetDefaults* ret = google_protobuf_FeatureSetDefaults_new(arena); |
| 9728 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9729 | if (upb_Decode(buf, size, ret, &google__protobuf__FeatureSetDefaults_msg_init, extreg, options, arena) != |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9730 | kUpb_DecodeStatus_Ok) { |
| 9731 | return NULL; |
| 9732 | } |
| 9733 | return ret; |
| 9734 | } |
| 9735 | UPB_INLINE char* google_protobuf_FeatureSetDefaults_serialize(const google_protobuf_FeatureSetDefaults* msg, upb_Arena* arena, size_t* len) { |
| 9736 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9737 | (void)upb_Encode(msg, &google__protobuf__FeatureSetDefaults_msg_init, 0, arena, &ptr, len); |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9738 | return ptr; |
| 9739 | } |
| 9740 | UPB_INLINE char* google_protobuf_FeatureSetDefaults_serialize_ex(const google_protobuf_FeatureSetDefaults* msg, int options, |
| 9741 | upb_Arena* arena, size_t* len) { |
| 9742 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9743 | (void)upb_Encode(msg, &google__protobuf__FeatureSetDefaults_msg_init, options, arena, &ptr, len); |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9744 | return ptr; |
| 9745 | } |
| 9746 | 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] | 9747 | 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] | 9748 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 9749 | } |
| 9750 | 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] | 9751 | 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] | 9752 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 9753 | if (arr) { |
| 9754 | if (size) *size = arr->size; |
| 9755 | return (const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* const*)_upb_array_constptr(arr); |
| 9756 | } else { |
| 9757 | if (size) *size = 0; |
| 9758 | return NULL; |
| 9759 | } |
| 9760 | } |
| 9761 | 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] | 9762 | 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] | 9763 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 9764 | if (size) { |
| 9765 | *size = arr ? arr->size : 0; |
| 9766 | } |
| 9767 | return arr; |
| 9768 | } |
| 9769 | 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] | 9770 | 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] | 9771 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 9772 | (upb_Message*)msg, &field, arena); |
| 9773 | if (size) { |
| 9774 | *size = arr ? arr->size : 0; |
| 9775 | } |
| 9776 | return arr; |
| 9777 | } |
| 9778 | UPB_INLINE bool google_protobuf_FeatureSetDefaults_has_defaults(const google_protobuf_FeatureSetDefaults* msg) { |
| 9779 | size_t size; |
| 9780 | google_protobuf_FeatureSetDefaults_defaults(msg, &size); |
| 9781 | return size != 0; |
| 9782 | } |
| 9783 | UPB_INLINE void google_protobuf_FeatureSetDefaults_clear_minimum_edition(google_protobuf_FeatureSetDefaults* msg) { |
Protobuf Team Bot | ab58f8f | 2023-09-26 16:14:19 +0000 | [diff] [blame] | 9784 | const upb_MiniTableField field = {4, UPB_SIZE(8, 4), 1, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9785 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 9786 | } |
Protobuf Team Bot | ab58f8f | 2023-09-26 16:14:19 +0000 | [diff] [blame] | 9787 | UPB_INLINE int32_t google_protobuf_FeatureSetDefaults_minimum_edition(const google_protobuf_FeatureSetDefaults* msg) { |
| 9788 | int32_t default_val = 0; |
| 9789 | int32_t ret; |
| 9790 | const upb_MiniTableField field = {4, UPB_SIZE(8, 4), 1, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9791 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 9792 | return ret; |
| 9793 | } |
| 9794 | UPB_INLINE bool google_protobuf_FeatureSetDefaults_has_minimum_edition(const google_protobuf_FeatureSetDefaults* msg) { |
Protobuf Team Bot | ab58f8f | 2023-09-26 16:14:19 +0000 | [diff] [blame] | 9795 | const upb_MiniTableField field = {4, UPB_SIZE(8, 4), 1, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9796 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 9797 | } |
| 9798 | UPB_INLINE void google_protobuf_FeatureSetDefaults_clear_maximum_edition(google_protobuf_FeatureSetDefaults* msg) { |
Protobuf Team Bot | ab58f8f | 2023-09-26 16:14:19 +0000 | [diff] [blame] | 9799 | const upb_MiniTableField field = {5, UPB_SIZE(12, 8), 2, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9800 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 9801 | } |
Protobuf Team Bot | ab58f8f | 2023-09-26 16:14:19 +0000 | [diff] [blame] | 9802 | UPB_INLINE int32_t google_protobuf_FeatureSetDefaults_maximum_edition(const google_protobuf_FeatureSetDefaults* msg) { |
| 9803 | int32_t default_val = 0; |
| 9804 | int32_t ret; |
| 9805 | const upb_MiniTableField field = {5, UPB_SIZE(12, 8), 2, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9806 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 9807 | return ret; |
| 9808 | } |
| 9809 | UPB_INLINE bool google_protobuf_FeatureSetDefaults_has_maximum_edition(const google_protobuf_FeatureSetDefaults* msg) { |
Protobuf Team Bot | ab58f8f | 2023-09-26 16:14:19 +0000 | [diff] [blame] | 9810 | const upb_MiniTableField field = {5, UPB_SIZE(12, 8), 2, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9811 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 9812 | } |
| 9813 | |
| 9814 | 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] | 9815 | 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] | 9816 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 9817 | if (arr) { |
| 9818 | if (size) *size = arr->size; |
| 9819 | return (google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault**)_upb_array_ptr(arr); |
| 9820 | } else { |
| 9821 | if (size) *size = 0; |
| 9822 | return NULL; |
| 9823 | } |
| 9824 | } |
| 9825 | 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] | 9826 | 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] | 9827 | return (google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
| 9828 | } |
| 9829 | 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] | 9830 | 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] | 9831 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 9832 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 9833 | return NULL; |
| 9834 | } |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9835 | struct google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* sub = (struct google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault*)_upb_Message_New(&google__protobuf__FeatureSetDefaults__FeatureSetEditionDefault_msg_init, arena); |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9836 | if (!arr || !sub) return NULL; |
| 9837 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
| 9838 | return sub; |
| 9839 | } |
Protobuf Team Bot | ab58f8f | 2023-09-26 16:14:19 +0000 | [diff] [blame] | 9840 | UPB_INLINE void google_protobuf_FeatureSetDefaults_set_minimum_edition(google_protobuf_FeatureSetDefaults *msg, int32_t value) { |
| 9841 | const upb_MiniTableField field = {4, UPB_SIZE(8, 4), 1, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9842 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 9843 | } |
Protobuf Team Bot | ab58f8f | 2023-09-26 16:14:19 +0000 | [diff] [blame] | 9844 | UPB_INLINE void google_protobuf_FeatureSetDefaults_set_maximum_edition(google_protobuf_FeatureSetDefaults *msg, int32_t value) { |
| 9845 | const upb_MiniTableField field = {5, UPB_SIZE(12, 8), 2, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9846 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 9847 | } |
| 9848 | |
| 9849 | /* google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault */ |
| 9850 | |
| 9851 | UPB_INLINE google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_new(upb_Arena* arena) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9852 | return (google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault*)_upb_Message_New(&google__protobuf__FeatureSetDefaults__FeatureSetEditionDefault_msg_init, arena); |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9853 | } |
| 9854 | UPB_INLINE google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 9855 | google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* ret = google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_new(arena); |
| 9856 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9857 | if (upb_Decode(buf, size, ret, &google__protobuf__FeatureSetDefaults__FeatureSetEditionDefault_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9858 | return NULL; |
| 9859 | } |
| 9860 | return ret; |
| 9861 | } |
| 9862 | UPB_INLINE google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_parse_ex(const char* buf, size_t size, |
| 9863 | const upb_ExtensionRegistry* extreg, |
| 9864 | int options, upb_Arena* arena) { |
| 9865 | google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* ret = google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_new(arena); |
| 9866 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9867 | if (upb_Decode(buf, size, ret, &google__protobuf__FeatureSetDefaults__FeatureSetEditionDefault_msg_init, extreg, options, arena) != |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9868 | kUpb_DecodeStatus_Ok) { |
| 9869 | return NULL; |
| 9870 | } |
| 9871 | return ret; |
| 9872 | } |
| 9873 | UPB_INLINE char* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_serialize(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg, upb_Arena* arena, size_t* len) { |
| 9874 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9875 | (void)upb_Encode(msg, &google__protobuf__FeatureSetDefaults__FeatureSetEditionDefault_msg_init, 0, arena, &ptr, len); |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9876 | return ptr; |
| 9877 | } |
| 9878 | UPB_INLINE char* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_serialize_ex(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg, int options, |
| 9879 | upb_Arena* arena, size_t* len) { |
| 9880 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9881 | (void)upb_Encode(msg, &google__protobuf__FeatureSetDefaults__FeatureSetEditionDefault_msg_init, options, arena, &ptr, len); |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9882 | return ptr; |
| 9883 | } |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9884 | UPB_INLINE void google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_clear_features(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) { |
Protobuf Team Bot | ab58f8f | 2023-09-26 16:14:19 +0000 | [diff] [blame] | 9885 | const upb_MiniTableField field = {2, UPB_SIZE(4, 8), 1, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9886 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 9887 | } |
| 9888 | UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_features(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) { |
| 9889 | const google_protobuf_FeatureSet* default_val = NULL; |
| 9890 | const google_protobuf_FeatureSet* ret; |
Protobuf Team Bot | ab58f8f | 2023-09-26 16:14:19 +0000 | [diff] [blame] | 9891 | const upb_MiniTableField field = {2, UPB_SIZE(4, 8), 1, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9892 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 9893 | return ret; |
| 9894 | } |
| 9895 | UPB_INLINE bool google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_has_features(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) { |
Protobuf Team Bot | ab58f8f | 2023-09-26 16:14:19 +0000 | [diff] [blame] | 9896 | const upb_MiniTableField field = {2, UPB_SIZE(4, 8), 1, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9897 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 9898 | } |
Protobuf Team Bot | ab58f8f | 2023-09-26 16:14:19 +0000 | [diff] [blame] | 9899 | UPB_INLINE void google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_clear_edition(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) { |
| 9900 | const upb_MiniTableField field = {3, UPB_SIZE(8, 4), 2, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Protobuf Team Bot | fa98bb3 | 2023-09-01 18:11:09 +0000 | [diff] [blame] | 9901 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 9902 | } |
Protobuf Team Bot | ab58f8f | 2023-09-26 16:14:19 +0000 | [diff] [blame] | 9903 | UPB_INLINE int32_t google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_edition(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) { |
Protobuf Team Bot | fa98bb3 | 2023-09-01 18:11:09 +0000 | [diff] [blame] | 9904 | int32_t default_val = 0; |
| 9905 | int32_t ret; |
Protobuf Team Bot | ab58f8f | 2023-09-26 16:14:19 +0000 | [diff] [blame] | 9906 | const upb_MiniTableField field = {3, UPB_SIZE(8, 4), 2, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Protobuf Team Bot | fa98bb3 | 2023-09-01 18:11:09 +0000 | [diff] [blame] | 9907 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 9908 | return ret; |
| 9909 | } |
Protobuf Team Bot | ab58f8f | 2023-09-26 16:14:19 +0000 | [diff] [blame] | 9910 | UPB_INLINE bool google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_has_edition(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) { |
| 9911 | const upb_MiniTableField field = {3, UPB_SIZE(8, 4), 2, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Protobuf Team Bot | fa98bb3 | 2023-09-01 18:11:09 +0000 | [diff] [blame] | 9912 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 9913 | } |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9914 | |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9915 | UPB_INLINE void google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_set_features(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault *msg, google_protobuf_FeatureSet* value) { |
Protobuf Team Bot | ab58f8f | 2023-09-26 16:14:19 +0000 | [diff] [blame] | 9916 | const upb_MiniTableField field = {2, UPB_SIZE(4, 8), 1, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9917 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 9918 | } |
| 9919 | UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_mutable_features(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg, upb_Arena* arena) { |
| 9920 | struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_features(msg); |
| 9921 | if (sub == NULL) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9922 | sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena); |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9923 | if (sub) google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_set_features(msg, sub); |
| 9924 | } |
| 9925 | return sub; |
| 9926 | } |
Protobuf Team Bot | ab58f8f | 2023-09-26 16:14:19 +0000 | [diff] [blame] | 9927 | UPB_INLINE void google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_set_edition(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault *msg, int32_t value) { |
| 9928 | const upb_MiniTableField field = {3, UPB_SIZE(8, 4), 2, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Protobuf Team Bot | fa98bb3 | 2023-09-01 18:11:09 +0000 | [diff] [blame] | 9929 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 9930 | } |
Mike Kruskal | ba96470 | 2023-08-22 17:37:48 -0700 | [diff] [blame] | 9931 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9932 | /* google.protobuf.SourceCodeInfo */ |
| 9933 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9934 | UPB_INLINE google_protobuf_SourceCodeInfo* google_protobuf_SourceCodeInfo_new(upb_Arena* arena) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9935 | 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] | 9936 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9937 | UPB_INLINE google_protobuf_SourceCodeInfo* google_protobuf_SourceCodeInfo_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 9938 | google_protobuf_SourceCodeInfo* ret = google_protobuf_SourceCodeInfo_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 9939 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9940 | 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] | 9941 | return NULL; |
| 9942 | } |
| 9943 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9944 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9945 | UPB_INLINE google_protobuf_SourceCodeInfo* google_protobuf_SourceCodeInfo_parse_ex(const char* buf, size_t size, |
| 9946 | const upb_ExtensionRegistry* extreg, |
| 9947 | int options, upb_Arena* arena) { |
| 9948 | google_protobuf_SourceCodeInfo* ret = google_protobuf_SourceCodeInfo_new(arena); |
| 9949 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9950 | 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] | 9951 | kUpb_DecodeStatus_Ok) { |
| 9952 | return NULL; |
| 9953 | } |
| 9954 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9955 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9956 | 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] | 9957 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9958 | (void)upb_Encode(msg, &google__protobuf__SourceCodeInfo_msg_init, 0, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9959 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9960 | } |
| 9961 | UPB_INLINE char* google_protobuf_SourceCodeInfo_serialize_ex(const google_protobuf_SourceCodeInfo* msg, int options, |
| 9962 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9963 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 9964 | (void)upb_Encode(msg, &google__protobuf__SourceCodeInfo_msg_init, options, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9965 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9966 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9967 | UPB_INLINE void google_protobuf_SourceCodeInfo_clear_location(google_protobuf_SourceCodeInfo* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9968 | 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] | 9969 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9970 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9971 | 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] | 9972 | 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] | 9973 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 9974 | if (arr) { |
| 9975 | if (size) *size = arr->size; |
| 9976 | return (const google_protobuf_SourceCodeInfo_Location* const*)_upb_array_constptr(arr); |
| 9977 | } else { |
| 9978 | if (size) *size = 0; |
| 9979 | return NULL; |
| 9980 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9981 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 9982 | 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] | 9983 | 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] | 9984 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 9985 | if (size) { |
| 9986 | *size = arr ? arr->size : 0; |
| 9987 | } |
| 9988 | return arr; |
| 9989 | } |
| 9990 | 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] | 9991 | 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] | 9992 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 9993 | (upb_Message*)msg, &field, arena); |
| 9994 | if (size) { |
| 9995 | *size = arr ? arr->size : 0; |
| 9996 | } |
| 9997 | return arr; |
| 9998 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9999 | UPB_INLINE bool google_protobuf_SourceCodeInfo_has_location(const google_protobuf_SourceCodeInfo* msg) { |
| 10000 | size_t size; |
| 10001 | google_protobuf_SourceCodeInfo_location(msg, &size); |
| 10002 | return size != 0; |
| 10003 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10004 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10005 | 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] | 10006 | 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] | 10007 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 10008 | if (arr) { |
| 10009 | if (size) *size = arr->size; |
| 10010 | return (google_protobuf_SourceCodeInfo_Location**)_upb_array_ptr(arr); |
| 10011 | } else { |
| 10012 | if (size) *size = 0; |
| 10013 | return NULL; |
| 10014 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10015 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10016 | 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] | 10017 | 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] | 10018 | return (google_protobuf_SourceCodeInfo_Location**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10019 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 10020 | 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] | 10021 | 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] | 10022 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 10023 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 10024 | return NULL; |
| 10025 | } |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 10026 | 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] | 10027 | if (!arr || !sub) return NULL; |
| 10028 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10029 | return sub; |
| 10030 | } |
| 10031 | |
| 10032 | /* google.protobuf.SourceCodeInfo.Location */ |
| 10033 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10034 | UPB_INLINE google_protobuf_SourceCodeInfo_Location* google_protobuf_SourceCodeInfo_Location_new(upb_Arena* arena) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 10035 | 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] | 10036 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10037 | UPB_INLINE google_protobuf_SourceCodeInfo_Location* google_protobuf_SourceCodeInfo_Location_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 10038 | google_protobuf_SourceCodeInfo_Location* ret = google_protobuf_SourceCodeInfo_Location_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 10039 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 10040 | 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] | 10041 | return NULL; |
| 10042 | } |
| 10043 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10044 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10045 | UPB_INLINE google_protobuf_SourceCodeInfo_Location* google_protobuf_SourceCodeInfo_Location_parse_ex(const char* buf, size_t size, |
| 10046 | const upb_ExtensionRegistry* extreg, |
| 10047 | int options, upb_Arena* arena) { |
| 10048 | google_protobuf_SourceCodeInfo_Location* ret = google_protobuf_SourceCodeInfo_Location_new(arena); |
| 10049 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 10050 | 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] | 10051 | kUpb_DecodeStatus_Ok) { |
| 10052 | return NULL; |
| 10053 | } |
| 10054 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10055 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10056 | 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] | 10057 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 10058 | (void)upb_Encode(msg, &google__protobuf__SourceCodeInfo__Location_msg_init, 0, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10059 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10060 | } |
| 10061 | UPB_INLINE char* google_protobuf_SourceCodeInfo_Location_serialize_ex(const google_protobuf_SourceCodeInfo_Location* msg, int options, |
| 10062 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10063 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 10064 | (void)upb_Encode(msg, &google__protobuf__SourceCodeInfo__Location_msg_init, options, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10065 | return ptr; |
| 10066 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10067 | 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] | 10068 | 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] | 10069 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10070 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10071 | 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] | 10072 | 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] | 10073 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 10074 | if (arr) { |
| 10075 | if (size) *size = arr->size; |
| 10076 | return (int32_t const*)_upb_array_constptr(arr); |
| 10077 | } else { |
| 10078 | if (size) *size = 0; |
| 10079 | return NULL; |
| 10080 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10081 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 10082 | 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] | 10083 | 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] | 10084 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 10085 | if (size) { |
| 10086 | *size = arr ? arr->size : 0; |
| 10087 | } |
| 10088 | return arr; |
| 10089 | } |
| 10090 | 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] | 10091 | 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] | 10092 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 10093 | (upb_Message*)msg, &field, arena); |
| 10094 | if (size) { |
| 10095 | *size = arr ? arr->size : 0; |
| 10096 | } |
| 10097 | return arr; |
| 10098 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10099 | UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_has_path(const google_protobuf_SourceCodeInfo_Location* msg) { |
| 10100 | size_t size; |
| 10101 | google_protobuf_SourceCodeInfo_Location_path(msg, &size); |
| 10102 | return size != 0; |
| 10103 | } |
| 10104 | 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] | 10105 | 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] | 10106 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 10107 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10108 | 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] | 10109 | 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] | 10110 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 10111 | if (arr) { |
| 10112 | if (size) *size = arr->size; |
| 10113 | return (int32_t const*)_upb_array_constptr(arr); |
| 10114 | } else { |
| 10115 | if (size) *size = 0; |
| 10116 | return NULL; |
| 10117 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 10118 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 10119 | 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] | 10120 | 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] | 10121 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 10122 | if (size) { |
| 10123 | *size = arr ? arr->size : 0; |
| 10124 | } |
| 10125 | return arr; |
| 10126 | } |
| 10127 | 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] | 10128 | 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] | 10129 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 10130 | (upb_Message*)msg, &field, arena); |
| 10131 | if (size) { |
| 10132 | *size = arr ? arr->size : 0; |
| 10133 | } |
| 10134 | return arr; |
| 10135 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10136 | UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_has_span(const google_protobuf_SourceCodeInfo_Location* msg) { |
| 10137 | size_t size; |
| 10138 | google_protobuf_SourceCodeInfo_Location_span(msg, &size); |
| 10139 | return size != 0; |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 10140 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10141 | 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] | 10142 | 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] | 10143 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10144 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10145 | 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] | 10146 | upb_StringView default_val = upb_StringView_FromString(""); |
| 10147 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10148 | 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] | 10149 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10150 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10151 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10152 | 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] | 10153 | 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] | 10154 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 10155 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10156 | 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] | 10157 | 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] | 10158 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10159 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10160 | 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] | 10161 | upb_StringView default_val = upb_StringView_FromString(""); |
| 10162 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10163 | 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] | 10164 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10165 | return ret; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10166 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10167 | 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] | 10168 | 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] | 10169 | return _upb_Message_HasNonExtensionField(msg, &field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10170 | } |
| 10171 | 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] | 10172 | 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] | 10173 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10174 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10175 | 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] | 10176 | 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] | 10177 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 10178 | if (arr) { |
| 10179 | if (size) *size = arr->size; |
| 10180 | return (upb_StringView const*)_upb_array_constptr(arr); |
| 10181 | } else { |
| 10182 | if (size) *size = 0; |
| 10183 | return NULL; |
| 10184 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 10185 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 10186 | 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] | 10187 | 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] | 10188 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 10189 | if (size) { |
| 10190 | *size = arr ? arr->size : 0; |
| 10191 | } |
| 10192 | return arr; |
| 10193 | } |
| 10194 | 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] | 10195 | 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] | 10196 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 10197 | (upb_Message*)msg, &field, arena); |
| 10198 | if (size) { |
| 10199 | *size = arr ? arr->size : 0; |
| 10200 | } |
| 10201 | return arr; |
| 10202 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10203 | UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_has_leading_detached_comments(const google_protobuf_SourceCodeInfo_Location* msg) { |
| 10204 | size_t size; |
| 10205 | google_protobuf_SourceCodeInfo_Location_leading_detached_comments(msg, &size); |
| 10206 | return size != 0; |
| 10207 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10208 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10209 | 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] | 10210 | 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] | 10211 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 10212 | if (arr) { |
| 10213 | if (size) *size = arr->size; |
| 10214 | return (int32_t*)_upb_array_ptr(arr); |
| 10215 | } else { |
| 10216 | if (size) *size = 0; |
| 10217 | return NULL; |
| 10218 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10219 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10220 | 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] | 10221 | 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] | 10222 | return (int32_t*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10223 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 10224 | 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] | 10225 | 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] | 10226 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 10227 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 10228 | return false; |
| 10229 | } |
| 10230 | _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val)); |
| 10231 | return true; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10232 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10233 | 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] | 10234 | 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] | 10235 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 10236 | if (arr) { |
| 10237 | if (size) *size = arr->size; |
| 10238 | return (int32_t*)_upb_array_ptr(arr); |
| 10239 | } else { |
| 10240 | if (size) *size = 0; |
| 10241 | return NULL; |
| 10242 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10243 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10244 | 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] | 10245 | 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] | 10246 | return (int32_t*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10247 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 10248 | 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] | 10249 | 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] | 10250 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 10251 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 10252 | return false; |
| 10253 | } |
| 10254 | _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val)); |
| 10255 | return true; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10256 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10257 | 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] | 10258 | 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] | 10259 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 10260 | } |
| 10261 | 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] | 10262 | 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] | 10263 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 10264 | } |
| 10265 | 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] | 10266 | 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] | 10267 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 10268 | if (arr) { |
| 10269 | if (size) *size = arr->size; |
| 10270 | return (upb_StringView*)_upb_array_ptr(arr); |
| 10271 | } else { |
| 10272 | if (size) *size = 0; |
| 10273 | return NULL; |
| 10274 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10275 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10276 | 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] | 10277 | 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] | 10278 | return (upb_StringView*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10279 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 10280 | 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] | 10281 | 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] | 10282 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 10283 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 10284 | return false; |
| 10285 | } |
| 10286 | _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val)); |
| 10287 | return true; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10288 | } |
| 10289 | |
| 10290 | /* google.protobuf.GeneratedCodeInfo */ |
| 10291 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10292 | UPB_INLINE google_protobuf_GeneratedCodeInfo* google_protobuf_GeneratedCodeInfo_new(upb_Arena* arena) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 10293 | 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] | 10294 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10295 | UPB_INLINE google_protobuf_GeneratedCodeInfo* google_protobuf_GeneratedCodeInfo_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 10296 | google_protobuf_GeneratedCodeInfo* ret = google_protobuf_GeneratedCodeInfo_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 10297 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 10298 | 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] | 10299 | return NULL; |
| 10300 | } |
| 10301 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10302 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10303 | UPB_INLINE google_protobuf_GeneratedCodeInfo* google_protobuf_GeneratedCodeInfo_parse_ex(const char* buf, size_t size, |
| 10304 | const upb_ExtensionRegistry* extreg, |
| 10305 | int options, upb_Arena* arena) { |
| 10306 | google_protobuf_GeneratedCodeInfo* ret = google_protobuf_GeneratedCodeInfo_new(arena); |
| 10307 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 10308 | 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] | 10309 | kUpb_DecodeStatus_Ok) { |
| 10310 | return NULL; |
| 10311 | } |
| 10312 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10313 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10314 | 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] | 10315 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 10316 | (void)upb_Encode(msg, &google__protobuf__GeneratedCodeInfo_msg_init, 0, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10317 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10318 | } |
| 10319 | UPB_INLINE char* google_protobuf_GeneratedCodeInfo_serialize_ex(const google_protobuf_GeneratedCodeInfo* msg, int options, |
| 10320 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10321 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 10322 | (void)upb_Encode(msg, &google__protobuf__GeneratedCodeInfo_msg_init, options, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10323 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10324 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10325 | UPB_INLINE void google_protobuf_GeneratedCodeInfo_clear_annotation(google_protobuf_GeneratedCodeInfo* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10326 | 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] | 10327 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10328 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10329 | 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] | 10330 | 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] | 10331 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 10332 | if (arr) { |
| 10333 | if (size) *size = arr->size; |
| 10334 | return (const google_protobuf_GeneratedCodeInfo_Annotation* const*)_upb_array_constptr(arr); |
| 10335 | } else { |
| 10336 | if (size) *size = 0; |
| 10337 | return NULL; |
| 10338 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 10339 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 10340 | 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] | 10341 | 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] | 10342 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 10343 | if (size) { |
| 10344 | *size = arr ? arr->size : 0; |
| 10345 | } |
| 10346 | return arr; |
| 10347 | } |
| 10348 | 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] | 10349 | 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] | 10350 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 10351 | (upb_Message*)msg, &field, arena); |
| 10352 | if (size) { |
| 10353 | *size = arr ? arr->size : 0; |
| 10354 | } |
| 10355 | return arr; |
| 10356 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10357 | UPB_INLINE bool google_protobuf_GeneratedCodeInfo_has_annotation(const google_protobuf_GeneratedCodeInfo* msg) { |
| 10358 | size_t size; |
| 10359 | google_protobuf_GeneratedCodeInfo_annotation(msg, &size); |
| 10360 | return size != 0; |
| 10361 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10362 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10363 | 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] | 10364 | 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] | 10365 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 10366 | if (arr) { |
| 10367 | if (size) *size = arr->size; |
| 10368 | return (google_protobuf_GeneratedCodeInfo_Annotation**)_upb_array_ptr(arr); |
| 10369 | } else { |
| 10370 | if (size) *size = 0; |
| 10371 | return NULL; |
| 10372 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10373 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10374 | 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] | 10375 | 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] | 10376 | return (google_protobuf_GeneratedCodeInfo_Annotation**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10377 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 10378 | 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] | 10379 | 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] | 10380 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 10381 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 10382 | return NULL; |
| 10383 | } |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 10384 | 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] | 10385 | if (!arr || !sub) return NULL; |
| 10386 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10387 | return sub; |
| 10388 | } |
| 10389 | |
| 10390 | /* google.protobuf.GeneratedCodeInfo.Annotation */ |
| 10391 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10392 | UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation* google_protobuf_GeneratedCodeInfo_Annotation_new(upb_Arena* arena) { |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 10393 | 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] | 10394 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10395 | UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation* google_protobuf_GeneratedCodeInfo_Annotation_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 10396 | google_protobuf_GeneratedCodeInfo_Annotation* ret = google_protobuf_GeneratedCodeInfo_Annotation_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 10397 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 10398 | 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] | 10399 | return NULL; |
| 10400 | } |
| 10401 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10402 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10403 | UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation* google_protobuf_GeneratedCodeInfo_Annotation_parse_ex(const char* buf, size_t size, |
| 10404 | const upb_ExtensionRegistry* extreg, |
| 10405 | int options, upb_Arena* arena) { |
| 10406 | google_protobuf_GeneratedCodeInfo_Annotation* ret = google_protobuf_GeneratedCodeInfo_Annotation_new(arena); |
| 10407 | if (!ret) return NULL; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 10408 | 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] | 10409 | kUpb_DecodeStatus_Ok) { |
| 10410 | return NULL; |
| 10411 | } |
| 10412 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10413 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10414 | 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] | 10415 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 10416 | (void)upb_Encode(msg, &google__protobuf__GeneratedCodeInfo__Annotation_msg_init, 0, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10417 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10418 | } |
| 10419 | UPB_INLINE char* google_protobuf_GeneratedCodeInfo_Annotation_serialize_ex(const google_protobuf_GeneratedCodeInfo_Annotation* msg, int options, |
| 10420 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10421 | char* ptr; |
Protobuf Team Bot | d14a336 | 2023-10-07 23:51:34 +0000 | [diff] [blame] | 10422 | (void)upb_Encode(msg, &google__protobuf__GeneratedCodeInfo__Annotation_msg_init, options, arena, &ptr, len); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10423 | return ptr; |
| 10424 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10425 | 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] | 10426 | 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] | 10427 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10428 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10429 | 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] | 10430 | 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] | 10431 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 10432 | if (arr) { |
| 10433 | if (size) *size = arr->size; |
| 10434 | return (int32_t const*)_upb_array_constptr(arr); |
| 10435 | } else { |
| 10436 | if (size) *size = 0; |
| 10437 | return NULL; |
| 10438 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 10439 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 10440 | 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] | 10441 | 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] | 10442 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 10443 | if (size) { |
| 10444 | *size = arr ? arr->size : 0; |
| 10445 | } |
| 10446 | return arr; |
| 10447 | } |
| 10448 | 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] | 10449 | 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] | 10450 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 10451 | (upb_Message*)msg, &field, arena); |
| 10452 | if (size) { |
| 10453 | *size = arr ? arr->size : 0; |
| 10454 | } |
| 10455 | return arr; |
| 10456 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10457 | UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_path(const google_protobuf_GeneratedCodeInfo_Annotation* msg) { |
| 10458 | size_t size; |
| 10459 | google_protobuf_GeneratedCodeInfo_Annotation_path(msg, &size); |
| 10460 | return size != 0; |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 10461 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10462 | 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] | 10463 | 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] | 10464 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10465 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10466 | 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] | 10467 | upb_StringView default_val = upb_StringView_FromString(""); |
| 10468 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10469 | 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] | 10470 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10471 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10472 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10473 | 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] | 10474 | 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] | 10475 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 10476 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10477 | 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] | 10478 | 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] | 10479 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10480 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10481 | 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] | 10482 | int32_t default_val = (int32_t)0; |
| 10483 | int32_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10484 | 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] | 10485 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10486 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10487 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10488 | 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] | 10489 | 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] | 10490 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 10491 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10492 | 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] | 10493 | 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] | 10494 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10495 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10496 | 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] | 10497 | int32_t default_val = (int32_t)0; |
| 10498 | int32_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10499 | 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] | 10500 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10501 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10502 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10503 | 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] | 10504 | 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] | 10505 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10506 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10507 | 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] | 10508 | 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] | 10509 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10510 | } |
| 10511 | 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] | 10512 | int32_t default_val = 0; |
| 10513 | int32_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 10514 | 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] | 10515 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10516 | return ret; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10517 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10518 | 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] | 10519 | 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] | 10520 | return _upb_Message_HasNonExtensionField(msg, &field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 10521 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10522 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10523 | 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] | 10524 | 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] | 10525 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 10526 | if (arr) { |
| 10527 | if (size) *size = arr->size; |
| 10528 | return (int32_t*)_upb_array_ptr(arr); |
| 10529 | } else { |
| 10530 | if (size) *size = 0; |
| 10531 | return NULL; |
| 10532 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10533 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 10534 | 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] | 10535 | 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] | 10536 | return (int32_t*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10537 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 10538 | 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] | 10539 | 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] | 10540 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 10541 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 10542 | return false; |
| 10543 | } |
| 10544 | _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val)); |
| 10545 | return true; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10546 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10547 | 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] | 10548 | 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] | 10549 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 10550 | } |
| 10551 | 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] | 10552 | 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] | 10553 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 10554 | } |
| 10555 | 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] | 10556 | 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] | 10557 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 10558 | } |
| 10559 | 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] | 10560 | const upb_MiniTableField field = {5, UPB_SIZE(16, 12), 4, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 10561 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10562 | } |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 10563 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10564 | /* Max size 32 is google.protobuf.FileOptions */ |
| 10565 | /* Max size 64 is google.protobuf.FileOptions */ |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 10566 | #define _UPB_MAXOPT_SIZE UPB_SIZE(112, 200) |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 10567 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10568 | #ifdef __cplusplus |
| 10569 | } /* extern "C" */ |
| 10570 | #endif |
| 10571 | |
| 10572 | |
| 10573 | #endif /* GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_H_ */ |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 10574 | // end:github_only |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10575 | |
Protobuf Team Bot | 7dabac9 | 2023-09-07 18:35:50 +0000 | [diff] [blame] | 10576 | typedef enum { |
| 10577 | kUpb_Syntax_Proto2 = 2, |
| 10578 | kUpb_Syntax_Proto3 = 3, |
| 10579 | kUpb_Syntax_Editions = 99 |
| 10580 | } upb_Syntax; |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10581 | |
| 10582 | // Forward declarations for circular references. |
| 10583 | typedef struct upb_DefPool upb_DefPool; |
| 10584 | typedef struct upb_EnumDef upb_EnumDef; |
| 10585 | typedef struct upb_EnumReservedRange upb_EnumReservedRange; |
| 10586 | typedef struct upb_EnumValueDef upb_EnumValueDef; |
| 10587 | typedef struct upb_ExtensionRange upb_ExtensionRange; |
| 10588 | typedef struct upb_FieldDef upb_FieldDef; |
| 10589 | typedef struct upb_FileDef upb_FileDef; |
| 10590 | typedef struct upb_MessageDef upb_MessageDef; |
| 10591 | typedef struct upb_MessageReservedRange upb_MessageReservedRange; |
| 10592 | typedef struct upb_MethodDef upb_MethodDef; |
| 10593 | typedef struct upb_OneofDef upb_OneofDef; |
| 10594 | typedef struct upb_ServiceDef upb_ServiceDef; |
| 10595 | |
| 10596 | // EVERYTHING BELOW THIS LINE IS INTERNAL - DO NOT USE ///////////////////////// |
| 10597 | |
| 10598 | typedef struct upb_DefBuilder upb_DefBuilder; |
| 10599 | |
| 10600 | #endif /* UPB_REFLECTION_COMMON_H_ */ |
| 10601 | |
| 10602 | #ifndef UPB_REFLECTION_DEF_TYPE_H_ |
| 10603 | #define UPB_REFLECTION_DEF_TYPE_H_ |
| 10604 | |
| 10605 | |
| 10606 | // Must be last. |
| 10607 | |
| 10608 | // Inside a symtab we store tagged pointers to specific def types. |
| 10609 | typedef enum { |
| 10610 | UPB_DEFTYPE_MASK = 7, |
| 10611 | |
| 10612 | // Only inside symtab table. |
| 10613 | UPB_DEFTYPE_EXT = 0, |
| 10614 | UPB_DEFTYPE_MSG = 1, |
| 10615 | UPB_DEFTYPE_ENUM = 2, |
| 10616 | UPB_DEFTYPE_ENUMVAL = 3, |
| 10617 | UPB_DEFTYPE_SERVICE = 4, |
| 10618 | |
| 10619 | // Only inside message table. |
| 10620 | UPB_DEFTYPE_FIELD = 0, |
| 10621 | UPB_DEFTYPE_ONEOF = 1, |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10622 | } upb_deftype_t; |
| 10623 | |
| 10624 | #ifdef __cplusplus |
| 10625 | extern "C" { |
| 10626 | #endif |
| 10627 | |
| 10628 | // Our 3-bit pointer tagging requires all pointers to be multiples of 8. |
| 10629 | // The arena will always yield 8-byte-aligned addresses, however we put |
| 10630 | // the defs into arrays. For each element in the array to be 8-byte-aligned, |
| 10631 | // the sizes of each def type must also be a multiple of 8. |
| 10632 | // |
| 10633 | // If any of these asserts fail, we need to add or remove padding on 32-bit |
| 10634 | // machines (64-bit machines will have 8-byte alignment already due to |
| 10635 | // pointers, which all of these structs have). |
| 10636 | UPB_INLINE void _upb_DefType_CheckPadding(size_t size) { |
| 10637 | UPB_ASSERT((size & UPB_DEFTYPE_MASK) == 0); |
| 10638 | } |
| 10639 | |
| 10640 | upb_deftype_t _upb_DefType_Type(upb_value v); |
| 10641 | |
| 10642 | upb_value _upb_DefType_Pack(const void* ptr, upb_deftype_t type); |
| 10643 | |
| 10644 | const void* _upb_DefType_Unpack(upb_value v, upb_deftype_t type); |
| 10645 | |
| 10646 | #ifdef __cplusplus |
| 10647 | } /* extern "C" */ |
| 10648 | #endif |
| 10649 | |
| 10650 | |
| 10651 | #endif /* UPB_REFLECTION_DEF_TYPE_H_ */ |
| 10652 | |
| 10653 | // Must be last. |
| 10654 | |
| 10655 | #ifdef __cplusplus |
| 10656 | extern "C" { |
| 10657 | #endif |
| 10658 | |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 10659 | UPB_API void upb_DefPool_Free(upb_DefPool* s); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10660 | |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 10661 | UPB_API upb_DefPool* upb_DefPool_New(void); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10662 | |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 10663 | UPB_API const upb_MessageDef* upb_DefPool_FindMessageByName( |
| 10664 | const upb_DefPool* s, const char* sym); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10665 | |
| 10666 | const upb_MessageDef* upb_DefPool_FindMessageByNameWithSize( |
| 10667 | const upb_DefPool* s, const char* sym, size_t len); |
| 10668 | |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 10669 | UPB_API const upb_EnumDef* upb_DefPool_FindEnumByName(const upb_DefPool* s, |
| 10670 | const char* sym); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10671 | |
| 10672 | const upb_EnumValueDef* upb_DefPool_FindEnumByNameval(const upb_DefPool* s, |
| 10673 | const char* sym); |
| 10674 | |
| 10675 | const upb_FileDef* upb_DefPool_FindFileByName(const upb_DefPool* s, |
| 10676 | const char* name); |
| 10677 | |
| 10678 | const upb_FileDef* upb_DefPool_FindFileByNameWithSize(const upb_DefPool* s, |
| 10679 | const char* name, |
| 10680 | size_t len); |
| 10681 | |
| 10682 | const upb_FieldDef* upb_DefPool_FindExtensionByMiniTable( |
| 10683 | const upb_DefPool* s, const upb_MiniTableExtension* ext); |
| 10684 | |
| 10685 | const upb_FieldDef* upb_DefPool_FindExtensionByName(const upb_DefPool* s, |
| 10686 | const char* sym); |
| 10687 | |
| 10688 | const upb_FieldDef* upb_DefPool_FindExtensionByNameWithSize( |
| 10689 | const upb_DefPool* s, const char* name, size_t size); |
| 10690 | |
| 10691 | const upb_FieldDef* upb_DefPool_FindExtensionByNumber(const upb_DefPool* s, |
| 10692 | const upb_MessageDef* m, |
| 10693 | int32_t fieldnum); |
| 10694 | |
| 10695 | const upb_ServiceDef* upb_DefPool_FindServiceByName(const upb_DefPool* s, |
| 10696 | const char* name); |
| 10697 | |
| 10698 | const upb_ServiceDef* upb_DefPool_FindServiceByNameWithSize( |
| 10699 | const upb_DefPool* s, const char* name, size_t size); |
| 10700 | |
| 10701 | const upb_FileDef* upb_DefPool_FindFileContainingSymbol(const upb_DefPool* s, |
| 10702 | const char* name); |
| 10703 | |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 10704 | UPB_API const upb_FileDef* upb_DefPool_AddFile( |
| 10705 | upb_DefPool* s, const UPB_DESC(FileDescriptorProto) * file_proto, |
| 10706 | upb_Status* status); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10707 | |
| 10708 | const upb_ExtensionRegistry* upb_DefPool_ExtensionRegistry( |
| 10709 | const upb_DefPool* s); |
| 10710 | |
| 10711 | const upb_FieldDef** upb_DefPool_GetAllExtensions(const upb_DefPool* s, |
| 10712 | const upb_MessageDef* m, |
| 10713 | size_t* count); |
| 10714 | |
| 10715 | #ifdef __cplusplus |
| 10716 | } /* extern "C" */ |
| 10717 | #endif |
| 10718 | |
| 10719 | |
| 10720 | #endif /* UPB_REFLECTION_DEF_POOL_H_ */ |
| 10721 | |
Protobuf Team Bot | 0631035 | 2023-09-26 21:54:58 +0000 | [diff] [blame] | 10722 | // IWYU pragma: private, include "upb/reflection/def.h" |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10723 | |
| 10724 | #ifndef UPB_REFLECTION_ENUM_DEF_H_ |
| 10725 | #define UPB_REFLECTION_ENUM_DEF_H_ |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10726 | |
| 10727 | |
| 10728 | // Must be last. |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10729 | |
| 10730 | #ifdef __cplusplus |
| 10731 | extern "C" { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10732 | #endif |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10733 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10734 | bool upb_EnumDef_CheckNumber(const upb_EnumDef* e, int32_t num); |
| 10735 | const upb_MessageDef* upb_EnumDef_ContainingType(const upb_EnumDef* e); |
| 10736 | int32_t upb_EnumDef_Default(const upb_EnumDef* e); |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 10737 | UPB_API const upb_FileDef* upb_EnumDef_File(const upb_EnumDef* e); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10738 | const upb_EnumValueDef* upb_EnumDef_FindValueByName(const upb_EnumDef* e, |
| 10739 | const char* name); |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 10740 | UPB_API const upb_EnumValueDef* upb_EnumDef_FindValueByNameWithSize( |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10741 | const upb_EnumDef* e, const char* name, size_t size); |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 10742 | UPB_API const upb_EnumValueDef* upb_EnumDef_FindValueByNumber( |
| 10743 | const upb_EnumDef* e, int32_t num); |
| 10744 | UPB_API const char* upb_EnumDef_FullName(const upb_EnumDef* e); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10745 | bool upb_EnumDef_HasOptions(const upb_EnumDef* e); |
| 10746 | bool upb_EnumDef_IsClosed(const upb_EnumDef* e); |
| 10747 | |
| 10748 | // Creates a mini descriptor string for an enum, returns true on success. |
| 10749 | bool upb_EnumDef_MiniDescriptorEncode(const upb_EnumDef* e, upb_Arena* a, |
| 10750 | upb_StringView* out); |
| 10751 | |
| 10752 | const char* upb_EnumDef_Name(const upb_EnumDef* e); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 10753 | const UPB_DESC(EnumOptions) * upb_EnumDef_Options(const upb_EnumDef* e); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10754 | |
| 10755 | upb_StringView upb_EnumDef_ReservedName(const upb_EnumDef* e, int i); |
| 10756 | int upb_EnumDef_ReservedNameCount(const upb_EnumDef* e); |
| 10757 | |
| 10758 | const upb_EnumReservedRange* upb_EnumDef_ReservedRange(const upb_EnumDef* e, |
| 10759 | int i); |
| 10760 | int upb_EnumDef_ReservedRangeCount(const upb_EnumDef* e); |
| 10761 | |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 10762 | UPB_API const upb_EnumValueDef* upb_EnumDef_Value(const upb_EnumDef* e, int i); |
| 10763 | UPB_API int upb_EnumDef_ValueCount(const upb_EnumDef* e); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10764 | |
| 10765 | #ifdef __cplusplus |
| 10766 | } /* extern "C" */ |
| 10767 | #endif |
| 10768 | |
| 10769 | |
| 10770 | #endif /* UPB_REFLECTION_ENUM_DEF_H_ */ |
| 10771 | |
Protobuf Team Bot | 0631035 | 2023-09-26 21:54:58 +0000 | [diff] [blame] | 10772 | // IWYU pragma: private, include "upb/reflection/def.h" |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10773 | |
| 10774 | #ifndef UPB_REFLECTION_ENUM_VALUE_DEF_H_ |
| 10775 | #define UPB_REFLECTION_ENUM_VALUE_DEF_H_ |
| 10776 | |
| 10777 | |
| 10778 | // Must be last. |
| 10779 | |
| 10780 | #ifdef __cplusplus |
| 10781 | extern "C" { |
| 10782 | #endif |
| 10783 | |
| 10784 | const upb_EnumDef* upb_EnumValueDef_Enum(const upb_EnumValueDef* v); |
| 10785 | const char* upb_EnumValueDef_FullName(const upb_EnumValueDef* v); |
| 10786 | bool upb_EnumValueDef_HasOptions(const upb_EnumValueDef* v); |
| 10787 | uint32_t upb_EnumValueDef_Index(const upb_EnumValueDef* v); |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 10788 | UPB_API const char* upb_EnumValueDef_Name(const upb_EnumValueDef* v); |
| 10789 | UPB_API int32_t upb_EnumValueDef_Number(const upb_EnumValueDef* v); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 10790 | const UPB_DESC(EnumValueOptions) * |
| 10791 | upb_EnumValueDef_Options(const upb_EnumValueDef* v); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10792 | |
| 10793 | #ifdef __cplusplus |
| 10794 | } /* extern "C" */ |
| 10795 | #endif |
| 10796 | |
| 10797 | |
| 10798 | #endif /* UPB_REFLECTION_ENUM_VALUE_DEF_H_ */ |
| 10799 | |
Protobuf Team Bot | 0631035 | 2023-09-26 21:54:58 +0000 | [diff] [blame] | 10800 | // IWYU pragma: private, include "upb/reflection/def.h" |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10801 | |
| 10802 | #ifndef UPB_REFLECTION_EXTENSION_RANGE_H_ |
| 10803 | #define UPB_REFLECTION_EXTENSION_RANGE_H_ |
| 10804 | |
| 10805 | |
| 10806 | // Must be last. |
| 10807 | |
| 10808 | #ifdef __cplusplus |
| 10809 | extern "C" { |
| 10810 | #endif |
| 10811 | |
| 10812 | int32_t upb_ExtensionRange_Start(const upb_ExtensionRange* r); |
| 10813 | int32_t upb_ExtensionRange_End(const upb_ExtensionRange* r); |
| 10814 | |
| 10815 | bool upb_ExtensionRange_HasOptions(const upb_ExtensionRange* r); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 10816 | const UPB_DESC(ExtensionRangeOptions) * |
| 10817 | upb_ExtensionRange_Options(const upb_ExtensionRange* r); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10818 | |
| 10819 | #ifdef __cplusplus |
| 10820 | } /* extern "C" */ |
| 10821 | #endif |
| 10822 | |
| 10823 | |
| 10824 | #endif /* UPB_REFLECTION_EXTENSION_RANGE_H_ */ |
| 10825 | |
Protobuf Team Bot | 0631035 | 2023-09-26 21:54:58 +0000 | [diff] [blame] | 10826 | // IWYU pragma: private, include "upb/reflection/def.h" |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10827 | |
| 10828 | #ifndef UPB_REFLECTION_FIELD_DEF_H_ |
| 10829 | #define UPB_REFLECTION_FIELD_DEF_H_ |
| 10830 | |
| 10831 | |
| 10832 | // Must be last. |
| 10833 | |
| 10834 | // Maximum field number allowed for FieldDefs. |
| 10835 | // This is an inherent limit of the protobuf wire format. |
| 10836 | #define kUpb_MaxFieldNumber ((1 << 29) - 1) |
| 10837 | |
| 10838 | #ifdef __cplusplus |
| 10839 | extern "C" { |
| 10840 | #endif |
| 10841 | |
| 10842 | const upb_OneofDef* upb_FieldDef_ContainingOneof(const upb_FieldDef* f); |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 10843 | UPB_API const upb_MessageDef* upb_FieldDef_ContainingType( |
| 10844 | const upb_FieldDef* f); |
| 10845 | UPB_API upb_CType upb_FieldDef_CType(const upb_FieldDef* f); |
| 10846 | UPB_API upb_MessageValue upb_FieldDef_Default(const upb_FieldDef* f); |
| 10847 | UPB_API const upb_EnumDef* upb_FieldDef_EnumSubDef(const upb_FieldDef* f); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10848 | const upb_MessageDef* upb_FieldDef_ExtensionScope(const upb_FieldDef* f); |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 10849 | UPB_API const upb_FileDef* upb_FieldDef_File(const upb_FieldDef* f); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10850 | const char* upb_FieldDef_FullName(const upb_FieldDef* f); |
| 10851 | bool upb_FieldDef_HasDefault(const upb_FieldDef* f); |
| 10852 | bool upb_FieldDef_HasJsonName(const upb_FieldDef* f); |
| 10853 | bool upb_FieldDef_HasOptions(const upb_FieldDef* f); |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 10854 | UPB_API bool upb_FieldDef_HasPresence(const upb_FieldDef* f); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10855 | bool upb_FieldDef_HasSubDef(const upb_FieldDef* f); |
| 10856 | uint32_t upb_FieldDef_Index(const upb_FieldDef* f); |
| 10857 | bool upb_FieldDef_IsExtension(const upb_FieldDef* f); |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 10858 | UPB_API bool upb_FieldDef_IsMap(const upb_FieldDef* f); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10859 | bool upb_FieldDef_IsOptional(const upb_FieldDef* f); |
| 10860 | bool upb_FieldDef_IsPacked(const upb_FieldDef* f); |
| 10861 | bool upb_FieldDef_IsPrimitive(const upb_FieldDef* f); |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 10862 | UPB_API bool upb_FieldDef_IsRepeated(const upb_FieldDef* f); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10863 | bool upb_FieldDef_IsRequired(const upb_FieldDef* f); |
| 10864 | bool upb_FieldDef_IsString(const upb_FieldDef* f); |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 10865 | UPB_API bool upb_FieldDef_IsSubMessage(const upb_FieldDef* f); |
| 10866 | UPB_API const char* upb_FieldDef_JsonName(const upb_FieldDef* f); |
| 10867 | UPB_API upb_Label upb_FieldDef_Label(const upb_FieldDef* f); |
| 10868 | UPB_API const upb_MessageDef* upb_FieldDef_MessageSubDef(const upb_FieldDef* f); |
Protobuf Team Bot | b58bd40 | 2023-09-19 15:42:34 +0000 | [diff] [blame] | 10869 | bool _upb_FieldDef_ValidateUtf8(const upb_FieldDef* f); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10870 | |
| 10871 | // Creates a mini descriptor string for a field, returns true on success. |
| 10872 | bool upb_FieldDef_MiniDescriptorEncode(const upb_FieldDef* f, upb_Arena* a, |
| 10873 | upb_StringView* out); |
| 10874 | |
| 10875 | const upb_MiniTableField* upb_FieldDef_MiniTable(const upb_FieldDef* f); |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 10876 | UPB_API const char* upb_FieldDef_Name(const upb_FieldDef* f); |
| 10877 | UPB_API uint32_t upb_FieldDef_Number(const upb_FieldDef* f); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 10878 | const UPB_DESC(FieldOptions) * upb_FieldDef_Options(const upb_FieldDef* f); |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 10879 | UPB_API const upb_OneofDef* upb_FieldDef_RealContainingOneof( |
| 10880 | const upb_FieldDef* f); |
| 10881 | UPB_API upb_FieldType upb_FieldDef_Type(const upb_FieldDef* f); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10882 | |
| 10883 | #ifdef __cplusplus |
| 10884 | } /* extern "C" */ |
| 10885 | #endif |
| 10886 | |
| 10887 | |
| 10888 | #endif /* UPB_REFLECTION_FIELD_DEF_H_ */ |
| 10889 | |
Protobuf Team Bot | 0631035 | 2023-09-26 21:54:58 +0000 | [diff] [blame] | 10890 | // IWYU pragma: private, include "upb/reflection/def.h" |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10891 | |
| 10892 | #ifndef UPB_REFLECTION_FILE_DEF_H_ |
| 10893 | #define UPB_REFLECTION_FILE_DEF_H_ |
| 10894 | |
| 10895 | |
| 10896 | // Must be last. |
| 10897 | |
| 10898 | #ifdef __cplusplus |
| 10899 | extern "C" { |
| 10900 | #endif |
| 10901 | |
| 10902 | const upb_FileDef* upb_FileDef_Dependency(const upb_FileDef* f, int i); |
| 10903 | int upb_FileDef_DependencyCount(const upb_FileDef* f); |
| 10904 | bool upb_FileDef_HasOptions(const upb_FileDef* f); |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 10905 | UPB_API const char* upb_FileDef_Name(const upb_FileDef* f); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 10906 | const UPB_DESC(FileOptions) * upb_FileDef_Options(const upb_FileDef* f); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10907 | const char* upb_FileDef_Package(const upb_FileDef* f); |
Protobuf Team Bot | 7dabac9 | 2023-09-07 18:35:50 +0000 | [diff] [blame] | 10908 | UPB_DESC(Edition) upb_FileDef_Edition(const upb_FileDef* f); |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 10909 | UPB_API const upb_DefPool* upb_FileDef_Pool(const upb_FileDef* f); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10910 | |
| 10911 | const upb_FileDef* upb_FileDef_PublicDependency(const upb_FileDef* f, int i); |
| 10912 | int upb_FileDef_PublicDependencyCount(const upb_FileDef* f); |
| 10913 | |
| 10914 | const upb_ServiceDef* upb_FileDef_Service(const upb_FileDef* f, int i); |
| 10915 | int upb_FileDef_ServiceCount(const upb_FileDef* f); |
| 10916 | |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 10917 | UPB_API upb_Syntax upb_FileDef_Syntax(const upb_FileDef* f); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10918 | |
| 10919 | const upb_EnumDef* upb_FileDef_TopLevelEnum(const upb_FileDef* f, int i); |
| 10920 | int upb_FileDef_TopLevelEnumCount(const upb_FileDef* f); |
| 10921 | |
| 10922 | const upb_FieldDef* upb_FileDef_TopLevelExtension(const upb_FileDef* f, int i); |
| 10923 | int upb_FileDef_TopLevelExtensionCount(const upb_FileDef* f); |
| 10924 | |
| 10925 | const upb_MessageDef* upb_FileDef_TopLevelMessage(const upb_FileDef* f, int i); |
| 10926 | int upb_FileDef_TopLevelMessageCount(const upb_FileDef* f); |
| 10927 | |
| 10928 | const upb_FileDef* upb_FileDef_WeakDependency(const upb_FileDef* f, int i); |
| 10929 | int upb_FileDef_WeakDependencyCount(const upb_FileDef* f); |
| 10930 | |
| 10931 | #ifdef __cplusplus |
| 10932 | } /* extern "C" */ |
| 10933 | #endif |
| 10934 | |
| 10935 | |
| 10936 | #endif /* UPB_REFLECTION_FILE_DEF_H_ */ |
| 10937 | |
Protobuf Team Bot | 0631035 | 2023-09-26 21:54:58 +0000 | [diff] [blame] | 10938 | // IWYU pragma: private, include "upb/reflection/def.h" |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10939 | |
| 10940 | #ifndef UPB_REFLECTION_MESSAGE_DEF_H_ |
| 10941 | #define UPB_REFLECTION_MESSAGE_DEF_H_ |
| 10942 | |
| 10943 | |
| 10944 | // Must be last. |
| 10945 | |
| 10946 | // Well-known field tag numbers for map-entry messages. |
| 10947 | #define kUpb_MapEntry_KeyFieldNumber 1 |
| 10948 | #define kUpb_MapEntry_ValueFieldNumber 2 |
| 10949 | |
| 10950 | // Well-known field tag numbers for Any messages. |
| 10951 | #define kUpb_Any_TypeFieldNumber 1 |
| 10952 | #define kUpb_Any_ValueFieldNumber 2 |
| 10953 | |
| 10954 | // Well-known field tag numbers for duration messages. |
| 10955 | #define kUpb_Duration_SecondsFieldNumber 1 |
| 10956 | #define kUpb_Duration_NanosFieldNumber 2 |
| 10957 | |
| 10958 | // Well-known field tag numbers for timestamp messages. |
| 10959 | #define kUpb_Timestamp_SecondsFieldNumber 1 |
| 10960 | #define kUpb_Timestamp_NanosFieldNumber 2 |
| 10961 | |
| 10962 | // All the different kind of well known type messages. For simplicity of check, |
| 10963 | // number wrappers and string wrappers are grouped together. Make sure the |
| 10964 | // order and number of these groups are not changed. |
| 10965 | typedef enum { |
| 10966 | kUpb_WellKnown_Unspecified, |
| 10967 | kUpb_WellKnown_Any, |
| 10968 | kUpb_WellKnown_FieldMask, |
| 10969 | kUpb_WellKnown_Duration, |
| 10970 | kUpb_WellKnown_Timestamp, |
| 10971 | |
| 10972 | // number wrappers |
| 10973 | kUpb_WellKnown_DoubleValue, |
| 10974 | kUpb_WellKnown_FloatValue, |
| 10975 | kUpb_WellKnown_Int64Value, |
| 10976 | kUpb_WellKnown_UInt64Value, |
| 10977 | kUpb_WellKnown_Int32Value, |
| 10978 | kUpb_WellKnown_UInt32Value, |
| 10979 | |
| 10980 | // string wrappers |
| 10981 | kUpb_WellKnown_StringValue, |
| 10982 | kUpb_WellKnown_BytesValue, |
| 10983 | kUpb_WellKnown_BoolValue, |
| 10984 | kUpb_WellKnown_Value, |
| 10985 | kUpb_WellKnown_ListValue, |
| 10986 | kUpb_WellKnown_Struct, |
| 10987 | } upb_WellKnown; |
| 10988 | |
| 10989 | #ifdef __cplusplus |
| 10990 | extern "C" { |
| 10991 | #endif |
| 10992 | |
| 10993 | const upb_MessageDef* upb_MessageDef_ContainingType(const upb_MessageDef* m); |
| 10994 | |
| 10995 | const upb_ExtensionRange* upb_MessageDef_ExtensionRange(const upb_MessageDef* m, |
| 10996 | int i); |
| 10997 | int upb_MessageDef_ExtensionRangeCount(const upb_MessageDef* m); |
| 10998 | |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 10999 | UPB_API const upb_FieldDef* upb_MessageDef_Field(const upb_MessageDef* m, |
| 11000 | int i); |
| 11001 | UPB_API int upb_MessageDef_FieldCount(const upb_MessageDef* m); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11002 | |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11003 | UPB_API const upb_FileDef* upb_MessageDef_File(const upb_MessageDef* m); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11004 | |
| 11005 | // Returns a field by either JSON name or regular proto name. |
| 11006 | const upb_FieldDef* upb_MessageDef_FindByJsonNameWithSize( |
| 11007 | const upb_MessageDef* m, const char* name, size_t size); |
| 11008 | UPB_INLINE const upb_FieldDef* upb_MessageDef_FindByJsonName( |
| 11009 | const upb_MessageDef* m, const char* name) { |
| 11010 | return upb_MessageDef_FindByJsonNameWithSize(m, name, strlen(name)); |
| 11011 | } |
| 11012 | |
| 11013 | // Lookup of either field or oneof by name. Returns whether either was found. |
| 11014 | // If the return is true, then the found def will be set, and the non-found |
| 11015 | // one set to NULL. |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11016 | UPB_API bool upb_MessageDef_FindByNameWithSize(const upb_MessageDef* m, |
| 11017 | const char* name, size_t size, |
| 11018 | const upb_FieldDef** f, |
| 11019 | const upb_OneofDef** o); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11020 | UPB_INLINE bool upb_MessageDef_FindByName(const upb_MessageDef* m, |
| 11021 | const char* name, |
| 11022 | const upb_FieldDef** f, |
| 11023 | const upb_OneofDef** o) { |
| 11024 | return upb_MessageDef_FindByNameWithSize(m, name, strlen(name), f, o); |
| 11025 | } |
| 11026 | |
| 11027 | const upb_FieldDef* upb_MessageDef_FindFieldByName(const upb_MessageDef* m, |
| 11028 | const char* name); |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11029 | UPB_API const upb_FieldDef* upb_MessageDef_FindFieldByNameWithSize( |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11030 | const upb_MessageDef* m, const char* name, size_t size); |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11031 | UPB_API const upb_FieldDef* upb_MessageDef_FindFieldByNumber( |
| 11032 | const upb_MessageDef* m, uint32_t i); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11033 | const upb_OneofDef* upb_MessageDef_FindOneofByName(const upb_MessageDef* m, |
| 11034 | const char* name); |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11035 | UPB_API const upb_OneofDef* upb_MessageDef_FindOneofByNameWithSize( |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11036 | const upb_MessageDef* m, const char* name, size_t size); |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11037 | UPB_API const char* upb_MessageDef_FullName(const upb_MessageDef* m); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11038 | bool upb_MessageDef_HasOptions(const upb_MessageDef* m); |
| 11039 | bool upb_MessageDef_IsMapEntry(const upb_MessageDef* m); |
| 11040 | bool upb_MessageDef_IsMessageSet(const upb_MessageDef* m); |
| 11041 | |
| 11042 | // Creates a mini descriptor string for a message, returns true on success. |
| 11043 | bool upb_MessageDef_MiniDescriptorEncode(const upb_MessageDef* m, upb_Arena* a, |
| 11044 | upb_StringView* out); |
| 11045 | |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11046 | UPB_API const upb_MiniTable* upb_MessageDef_MiniTable(const upb_MessageDef* m); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11047 | const char* upb_MessageDef_Name(const upb_MessageDef* m); |
| 11048 | |
| 11049 | const upb_EnumDef* upb_MessageDef_NestedEnum(const upb_MessageDef* m, int i); |
| 11050 | const upb_FieldDef* upb_MessageDef_NestedExtension(const upb_MessageDef* m, |
| 11051 | int i); |
| 11052 | const upb_MessageDef* upb_MessageDef_NestedMessage(const upb_MessageDef* m, |
| 11053 | int i); |
| 11054 | |
| 11055 | int upb_MessageDef_NestedEnumCount(const upb_MessageDef* m); |
| 11056 | int upb_MessageDef_NestedExtensionCount(const upb_MessageDef* m); |
| 11057 | int upb_MessageDef_NestedMessageCount(const upb_MessageDef* m); |
| 11058 | |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11059 | UPB_API const upb_OneofDef* upb_MessageDef_Oneof(const upb_MessageDef* m, |
| 11060 | int i); |
| 11061 | UPB_API int upb_MessageDef_OneofCount(const upb_MessageDef* m); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 11062 | int upb_MessageDef_RealOneofCount(const upb_MessageDef* m); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11063 | |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 11064 | const UPB_DESC(MessageOptions) * |
| 11065 | upb_MessageDef_Options(const upb_MessageDef* m); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11066 | |
| 11067 | upb_StringView upb_MessageDef_ReservedName(const upb_MessageDef* m, int i); |
| 11068 | int upb_MessageDef_ReservedNameCount(const upb_MessageDef* m); |
| 11069 | |
| 11070 | const upb_MessageReservedRange* upb_MessageDef_ReservedRange( |
| 11071 | const upb_MessageDef* m, int i); |
| 11072 | int upb_MessageDef_ReservedRangeCount(const upb_MessageDef* m); |
| 11073 | |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11074 | UPB_API upb_Syntax upb_MessageDef_Syntax(const upb_MessageDef* m); |
| 11075 | UPB_API upb_WellKnown upb_MessageDef_WellKnownType(const upb_MessageDef* m); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11076 | |
| 11077 | #ifdef __cplusplus |
| 11078 | } /* extern "C" */ |
| 11079 | #endif |
| 11080 | |
| 11081 | |
| 11082 | #endif /* UPB_REFLECTION_MESSAGE_DEF_H_ */ |
| 11083 | |
Protobuf Team Bot | 0631035 | 2023-09-26 21:54:58 +0000 | [diff] [blame] | 11084 | // IWYU pragma: private, include "upb/reflection/def.h" |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11085 | |
| 11086 | #ifndef UPB_REFLECTION_METHOD_DEF_H_ |
| 11087 | #define UPB_REFLECTION_METHOD_DEF_H_ |
| 11088 | |
| 11089 | |
| 11090 | // Must be last. |
| 11091 | |
| 11092 | #ifdef __cplusplus |
| 11093 | extern "C" { |
| 11094 | #endif |
| 11095 | |
| 11096 | bool upb_MethodDef_ClientStreaming(const upb_MethodDef* m); |
| 11097 | const char* upb_MethodDef_FullName(const upb_MethodDef* m); |
| 11098 | bool upb_MethodDef_HasOptions(const upb_MethodDef* m); |
| 11099 | int upb_MethodDef_Index(const upb_MethodDef* m); |
| 11100 | const upb_MessageDef* upb_MethodDef_InputType(const upb_MethodDef* m); |
| 11101 | const char* upb_MethodDef_Name(const upb_MethodDef* m); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 11102 | const UPB_DESC(MethodOptions) * upb_MethodDef_Options(const upb_MethodDef* m); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11103 | const upb_MessageDef* upb_MethodDef_OutputType(const upb_MethodDef* m); |
| 11104 | bool upb_MethodDef_ServerStreaming(const upb_MethodDef* m); |
| 11105 | const upb_ServiceDef* upb_MethodDef_Service(const upb_MethodDef* m); |
| 11106 | |
| 11107 | #ifdef __cplusplus |
| 11108 | } /* extern "C" */ |
| 11109 | #endif |
| 11110 | |
| 11111 | |
| 11112 | #endif /* UPB_REFLECTION_METHOD_DEF_H_ */ |
| 11113 | |
Protobuf Team Bot | 0631035 | 2023-09-26 21:54:58 +0000 | [diff] [blame] | 11114 | // IWYU pragma: private, include "upb/reflection/def.h" |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11115 | |
| 11116 | #ifndef UPB_REFLECTION_ONEOF_DEF_H_ |
| 11117 | #define UPB_REFLECTION_ONEOF_DEF_H_ |
| 11118 | |
| 11119 | |
| 11120 | // Must be last. |
| 11121 | |
| 11122 | #ifdef __cplusplus |
| 11123 | extern "C" { |
| 11124 | #endif |
| 11125 | |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11126 | UPB_API const upb_MessageDef* upb_OneofDef_ContainingType( |
| 11127 | const upb_OneofDef* o); |
| 11128 | UPB_API const upb_FieldDef* upb_OneofDef_Field(const upb_OneofDef* o, int i); |
| 11129 | UPB_API int upb_OneofDef_FieldCount(const upb_OneofDef* o); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11130 | const char* upb_OneofDef_FullName(const upb_OneofDef* o); |
| 11131 | bool upb_OneofDef_HasOptions(const upb_OneofDef* o); |
| 11132 | uint32_t upb_OneofDef_Index(const upb_OneofDef* o); |
| 11133 | bool upb_OneofDef_IsSynthetic(const upb_OneofDef* o); |
| 11134 | const upb_FieldDef* upb_OneofDef_LookupName(const upb_OneofDef* o, |
| 11135 | const char* name); |
| 11136 | const upb_FieldDef* upb_OneofDef_LookupNameWithSize(const upb_OneofDef* o, |
| 11137 | const char* name, |
| 11138 | size_t size); |
| 11139 | const upb_FieldDef* upb_OneofDef_LookupNumber(const upb_OneofDef* o, |
| 11140 | uint32_t num); |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11141 | UPB_API const char* upb_OneofDef_Name(const upb_OneofDef* o); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11142 | int upb_OneofDef_numfields(const upb_OneofDef* o); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 11143 | const UPB_DESC(OneofOptions) * upb_OneofDef_Options(const upb_OneofDef* o); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11144 | |
| 11145 | #ifdef __cplusplus |
| 11146 | } /* extern "C" */ |
| 11147 | #endif |
| 11148 | |
| 11149 | |
| 11150 | #endif /* UPB_REFLECTION_ONEOF_DEF_H_ */ |
| 11151 | |
Protobuf Team Bot | 0631035 | 2023-09-26 21:54:58 +0000 | [diff] [blame] | 11152 | // IWYU pragma: private, include "upb/reflection/def.h" |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11153 | |
| 11154 | #ifndef UPB_REFLECTION_SERVICE_DEF_H_ |
| 11155 | #define UPB_REFLECTION_SERVICE_DEF_H_ |
| 11156 | |
| 11157 | |
| 11158 | // Must be last. |
| 11159 | |
| 11160 | #ifdef __cplusplus |
| 11161 | extern "C" { |
| 11162 | #endif |
| 11163 | |
| 11164 | const upb_FileDef* upb_ServiceDef_File(const upb_ServiceDef* s); |
| 11165 | const upb_MethodDef* upb_ServiceDef_FindMethodByName(const upb_ServiceDef* s, |
| 11166 | const char* name); |
| 11167 | const char* upb_ServiceDef_FullName(const upb_ServiceDef* s); |
| 11168 | bool upb_ServiceDef_HasOptions(const upb_ServiceDef* s); |
| 11169 | int upb_ServiceDef_Index(const upb_ServiceDef* s); |
| 11170 | const upb_MethodDef* upb_ServiceDef_Method(const upb_ServiceDef* s, int i); |
| 11171 | int upb_ServiceDef_MethodCount(const upb_ServiceDef* s); |
| 11172 | const char* upb_ServiceDef_Name(const upb_ServiceDef* s); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 11173 | const UPB_DESC(ServiceOptions) * |
| 11174 | upb_ServiceDef_Options(const upb_ServiceDef* s); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11175 | |
| 11176 | #ifdef __cplusplus |
| 11177 | } /* extern "C" */ |
| 11178 | #endif |
| 11179 | |
| 11180 | |
| 11181 | #endif /* UPB_REFLECTION_SERVICE_DEF_H_ */ |
Protobuf Team Bot | ffc56ba | 2023-09-08 15:29:06 +0000 | [diff] [blame] | 11182 | // IWYU pragma: end_exports |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11183 | |
| 11184 | #endif /* UPB_REFLECTION_DEF_H_ */ |
| 11185 | |
| 11186 | // Must be last. |
| 11187 | |
| 11188 | #ifdef __cplusplus |
| 11189 | extern "C" { |
| 11190 | #endif |
| 11191 | |
| 11192 | enum { upb_JsonDecode_IgnoreUnknown = 1 }; |
| 11193 | |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11194 | UPB_API bool upb_JsonDecode(const char* buf, size_t size, upb_Message* msg, |
| 11195 | const upb_MessageDef* m, const upb_DefPool* symtab, |
| 11196 | int options, upb_Arena* arena, upb_Status* status); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11197 | |
| 11198 | #ifdef __cplusplus |
| 11199 | } /* extern "C" */ |
| 11200 | #endif |
| 11201 | |
| 11202 | |
| 11203 | #endif /* UPB_JSONDECODE_H_ */ |
| 11204 | |
| 11205 | #ifndef UPB_LEX_ATOI_H_ |
| 11206 | #define UPB_LEX_ATOI_H_ |
| 11207 | |
Adam Cozzette | 7d5592e | 2023-08-23 12:15:26 -0700 | [diff] [blame] | 11208 | #include <stdint.h> |
| 11209 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11210 | // Must be last. |
| 11211 | |
| 11212 | #ifdef __cplusplus |
| 11213 | extern "C" { |
| 11214 | #endif |
| 11215 | |
| 11216 | // We use these hand-written routines instead of strto[u]l() because the "long |
| 11217 | // long" variants aren't in c89. Also our version allows setting a ptr limit. |
| 11218 | // Return the new position of the pointer after parsing the int, or NULL on |
| 11219 | // integer overflow. |
| 11220 | |
| 11221 | const char* upb_BufToUint64(const char* ptr, const char* end, uint64_t* val); |
| 11222 | const char* upb_BufToInt64(const char* ptr, const char* end, int64_t* val, |
| 11223 | bool* is_neg); |
| 11224 | |
| 11225 | #ifdef __cplusplus |
| 11226 | } /* extern "C" */ |
| 11227 | #endif |
| 11228 | |
| 11229 | |
| 11230 | #endif /* UPB_LEX_ATOI_H_ */ |
| 11231 | |
| 11232 | #ifndef UPB_LEX_UNICODE_H_ |
| 11233 | #define UPB_LEX_UNICODE_H_ |
| 11234 | |
Adam Cozzette | 7d5592e | 2023-08-23 12:15:26 -0700 | [diff] [blame] | 11235 | #include <stdint.h> |
| 11236 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11237 | // Must be last. |
| 11238 | |
| 11239 | #ifdef __cplusplus |
| 11240 | extern "C" { |
| 11241 | #endif |
| 11242 | |
| 11243 | // Returns true iff a codepoint is the value for a high surrogate. |
| 11244 | UPB_INLINE bool upb_Unicode_IsHigh(uint32_t cp) { |
| 11245 | return (cp >= 0xd800 && cp <= 0xdbff); |
| 11246 | } |
| 11247 | |
| 11248 | // Returns true iff a codepoint is the value for a low surrogate. |
| 11249 | UPB_INLINE bool upb_Unicode_IsLow(uint32_t cp) { |
| 11250 | return (cp >= 0xdc00 && cp <= 0xdfff); |
| 11251 | } |
| 11252 | |
| 11253 | // Returns the high 16-bit surrogate value for a supplementary codepoint. |
| 11254 | // Does not sanity-check the input. |
| 11255 | UPB_INLINE uint16_t upb_Unicode_ToHigh(uint32_t cp) { |
| 11256 | return (cp >> 10) + 0xd7c0; |
| 11257 | } |
| 11258 | |
| 11259 | // Returns the low 16-bit surrogate value for a supplementary codepoint. |
| 11260 | // Does not sanity-check the input. |
| 11261 | UPB_INLINE uint16_t upb_Unicode_ToLow(uint32_t cp) { |
| 11262 | return (cp & 0x3ff) | 0xdc00; |
| 11263 | } |
| 11264 | |
| 11265 | // Returns the 32-bit value corresponding to a pair of 16-bit surrogates. |
| 11266 | // Does not sanity-check the input. |
| 11267 | UPB_INLINE uint32_t upb_Unicode_FromPair(uint32_t high, uint32_t low) { |
| 11268 | return ((high & 0x3ff) << 10) + (low & 0x3ff) + 0x10000; |
| 11269 | } |
| 11270 | |
| 11271 | // Outputs a codepoint as UTF8. |
| 11272 | // Returns the number of bytes written (1-4 on success, 0 on error). |
| 11273 | // Does not sanity-check the input. Specifically does not check for surrogates. |
| 11274 | int upb_Unicode_ToUTF8(uint32_t cp, char* out); |
| 11275 | |
| 11276 | #ifdef __cplusplus |
| 11277 | } /* extern "C" */ |
| 11278 | #endif |
| 11279 | |
| 11280 | |
| 11281 | #endif /* UPB_LEX_UNICODE_H_ */ |
| 11282 | |
| 11283 | #ifndef UPB_REFLECTION_MESSAGE_H_ |
| 11284 | #define UPB_REFLECTION_MESSAGE_H_ |
| 11285 | |
Protobuf Team Bot | 473d20d | 2023-09-15 22:27:16 +0000 | [diff] [blame] | 11286 | #include <stddef.h> |
| 11287 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11288 | |
| 11289 | // Must be last. |
| 11290 | |
| 11291 | #ifdef __cplusplus |
| 11292 | extern "C" { |
| 11293 | #endif |
| 11294 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 11295 | // Returns a mutable pointer to a map, array, or submessage value. If the given |
| 11296 | // arena is non-NULL this will construct a new object if it was not previously |
| 11297 | // present. May not be called for primitive fields. |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11298 | UPB_API upb_MutableMessageValue upb_Message_Mutable(upb_Message* msg, |
| 11299 | const upb_FieldDef* f, |
| 11300 | upb_Arena* a); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11301 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 11302 | // 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] | 11303 | UPB_API const upb_FieldDef* upb_Message_WhichOneof(const upb_Message* msg, |
| 11304 | const upb_OneofDef* o); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11305 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 11306 | // Clear all data and unknown fields. |
| 11307 | void upb_Message_ClearByDef(upb_Message* msg, const upb_MessageDef* m); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11308 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 11309 | // Clears any field presence and sets the value back to its default. |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11310 | UPB_API void upb_Message_ClearFieldByDef(upb_Message* msg, |
| 11311 | const upb_FieldDef* f); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11312 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 11313 | // May only be called for fields where upb_FieldDef_HasPresence(f) == true. |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11314 | UPB_API bool upb_Message_HasFieldByDef(const upb_Message* msg, |
| 11315 | const upb_FieldDef* f); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11316 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 11317 | // Returns the value in the message associated with this field def. |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11318 | UPB_API upb_MessageValue upb_Message_GetFieldByDef(const upb_Message* msg, |
| 11319 | const upb_FieldDef* f); |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 11320 | |
| 11321 | // Sets the given field to the given value. For a msg/array/map/string, the |
| 11322 | // caller must ensure that the target data outlives |msg| (by living either in |
| 11323 | // the same arena or a different arena that outlives it). |
| 11324 | // |
| 11325 | // Returns false if allocation fails. |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11326 | UPB_API bool upb_Message_SetFieldByDef(upb_Message* msg, const upb_FieldDef* f, |
| 11327 | upb_MessageValue val, upb_Arena* a); |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 11328 | |
| 11329 | // Iterate over present fields. |
| 11330 | // |
| 11331 | // size_t iter = kUpb_Message_Begin; |
| 11332 | // const upb_FieldDef *f; |
| 11333 | // upb_MessageValue val; |
| 11334 | // while (upb_Message_Next(msg, m, ext_pool, &f, &val, &iter)) { |
| 11335 | // process_field(f, val); |
| 11336 | // } |
| 11337 | // |
| 11338 | // If ext_pool is NULL, no extensions will be returned. If the given symtab |
| 11339 | // returns extensions that don't match what is in this message, those extensions |
| 11340 | // will be skipped. |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11341 | |
| 11342 | #define kUpb_Message_Begin -1 |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 11343 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11344 | bool upb_Message_Next(const upb_Message* msg, const upb_MessageDef* m, |
| 11345 | const upb_DefPool* ext_pool, const upb_FieldDef** f, |
| 11346 | upb_MessageValue* val, size_t* iter); |
| 11347 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 11348 | // Clears all unknown field data from this message and all submessages. |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11349 | UPB_API bool upb_Message_DiscardUnknown(upb_Message* msg, |
| 11350 | const upb_MessageDef* m, int maxdepth); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11351 | |
| 11352 | #ifdef __cplusplus |
| 11353 | } /* extern "C" */ |
| 11354 | #endif |
| 11355 | |
| 11356 | |
| 11357 | #endif /* UPB_REFLECTION_MESSAGE_H_ */ |
| 11358 | |
| 11359 | #ifndef UPB_JSON_ENCODE_H_ |
| 11360 | #define UPB_JSON_ENCODE_H_ |
| 11361 | |
| 11362 | |
| 11363 | // Must be last. |
| 11364 | |
| 11365 | #ifdef __cplusplus |
| 11366 | extern "C" { |
| 11367 | #endif |
| 11368 | |
| 11369 | enum { |
Protobuf Team Bot | 986cbb6 | 2023-09-19 15:03:51 +0000 | [diff] [blame] | 11370 | /* When set, emits 0/default values. TODO: proto3 only? */ |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11371 | upb_JsonEncode_EmitDefaults = 1 << 0, |
| 11372 | |
| 11373 | /* When set, use normal (snake_case) field names instead of JSON (camelCase) |
| 11374 | names. */ |
| 11375 | upb_JsonEncode_UseProtoNames = 1 << 1, |
| 11376 | |
| 11377 | /* When set, emits enums as their integer values instead of as their names. */ |
| 11378 | upb_JsonEncode_FormatEnumsAsIntegers = 1 << 2 |
| 11379 | }; |
| 11380 | |
| 11381 | /* 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] | 11382 | * |m|. The DefPool in |ext_pool| is used to find extensions (if NULL, |
| 11383 | * extensions will not be printed). |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11384 | * |
| 11385 | * Output is placed in the given buffer, and always NULL-terminated. The output |
| 11386 | * size (excluding NULL) is returned. This means that a return value >= |size| |
| 11387 | * implies that the output was truncated. (These are the same semantics as |
| 11388 | * snprintf()). */ |
Jason Lunn | 67dee29 | 2023-07-13 13:15:26 -0700 | [diff] [blame] | 11389 | UPB_API size_t upb_JsonEncode(const upb_Message* msg, const upb_MessageDef* m, |
| 11390 | const upb_DefPool* ext_pool, int options, |
| 11391 | char* buf, size_t size, upb_Status* status); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11392 | |
| 11393 | #ifdef __cplusplus |
| 11394 | } /* extern "C" */ |
| 11395 | #endif |
| 11396 | |
| 11397 | |
| 11398 | #endif /* UPB_JSONENCODE_H_ */ |
| 11399 | |
| 11400 | #ifndef UPB_LEX_ROUND_TRIP_H_ |
| 11401 | #define UPB_LEX_ROUND_TRIP_H_ |
| 11402 | |
| 11403 | // Must be last. |
| 11404 | |
| 11405 | // Encodes a float or double that is round-trippable, but as short as possible. |
| 11406 | // These routines are not fully optimal (not guaranteed to be shortest), but are |
| 11407 | // short-ish and match the implementation that has been used in protobuf since |
| 11408 | // the beginning. |
| 11409 | |
| 11410 | // The given buffer size must be at least kUpb_RoundTripBufferSize. |
| 11411 | enum { kUpb_RoundTripBufferSize = 32 }; |
| 11412 | |
| 11413 | #ifdef __cplusplus |
| 11414 | extern "C" { |
| 11415 | #endif |
| 11416 | |
| 11417 | void _upb_EncodeRoundTripDouble(double val, char* buf, size_t size); |
| 11418 | void _upb_EncodeRoundTripFloat(float val, char* buf, size_t size); |
| 11419 | |
| 11420 | #ifdef __cplusplus |
| 11421 | } /* extern "C" */ |
| 11422 | #endif |
| 11423 | |
| 11424 | |
| 11425 | #endif /* UPB_LEX_ROUND_TRIP_H_ */ |
| 11426 | |
| 11427 | #ifndef UPB_PORT_VSNPRINTF_COMPAT_H_ |
| 11428 | #define UPB_PORT_VSNPRINTF_COMPAT_H_ |
| 11429 | |
| 11430 | // Must be last. |
| 11431 | |
| 11432 | UPB_INLINE int _upb_vsnprintf(char* buf, size_t size, const char* fmt, |
| 11433 | va_list ap) { |
| 11434 | #if defined(__MINGW64__) || defined(__MINGW32__) || defined(_MSC_VER) |
| 11435 | // The msvc runtime has a non-conforming vsnprintf() that requires the |
| 11436 | // following compatibility code to become conformant. |
| 11437 | int n = -1; |
| 11438 | if (size != 0) n = _vsnprintf_s(buf, size, _TRUNCATE, fmt, ap); |
| 11439 | if (n == -1) n = _vscprintf(fmt, ap); |
| 11440 | return n; |
| 11441 | #else |
| 11442 | return vsnprintf(buf, size, fmt, ap); |
| 11443 | #endif |
| 11444 | } |
| 11445 | |
| 11446 | |
| 11447 | #endif // UPB_PORT_VSNPRINTF_COMPAT_H_ |
| 11448 | |
| 11449 | #ifndef UPB_LEX_STRTOD_H_ |
| 11450 | #define UPB_LEX_STRTOD_H_ |
| 11451 | |
| 11452 | // Must be last. |
| 11453 | |
| 11454 | #ifdef __cplusplus |
| 11455 | extern "C" { |
| 11456 | #endif |
| 11457 | |
| 11458 | double _upb_NoLocaleStrtod(const char *str, char **endptr); |
| 11459 | |
| 11460 | #ifdef __cplusplus |
| 11461 | } /* extern "C" */ |
| 11462 | #endif |
| 11463 | |
| 11464 | |
| 11465 | #endif /* UPB_LEX_STRTOD_H_ */ |
| 11466 | |
Sandy Zhang | e3b0943 | 2023-08-07 09:30:02 -0700 | [diff] [blame] | 11467 | #ifndef UPB_MEM_INTERNAL_ARENA_H_ |
| 11468 | #define UPB_MEM_INTERNAL_ARENA_H_ |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11469 | |
| 11470 | |
| 11471 | // Must be last. |
| 11472 | |
| 11473 | typedef struct _upb_MemBlock _upb_MemBlock; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 11474 | |
| 11475 | struct upb_Arena { |
| 11476 | _upb_ArenaHead head; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 11477 | |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 11478 | // upb_alloc* together with a low bit which signals if there is an initial |
| 11479 | // block. |
| 11480 | uintptr_t block_alloc; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 11481 | |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 11482 | // When multiple arenas are fused together, each arena points to a parent |
| 11483 | // arena (root points to itself). The root tracks how many live arenas |
| 11484 | // reference it. |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 11485 | |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 11486 | // The low bit is tagged: |
| 11487 | // 0: pointer to parent |
| 11488 | // 1: count, left shifted by one |
| 11489 | UPB_ATOMIC(uintptr_t) parent_or_count; |
| 11490 | |
| 11491 | // All nodes that are fused together are in a singly-linked list. |
| 11492 | UPB_ATOMIC(upb_Arena*) next; // NULL at end of list. |
| 11493 | |
| 11494 | // The last element of the linked list. This is present only as an |
| 11495 | // optimization, so that we do not have to iterate over all members for every |
| 11496 | // fuse. Only significant for an arena root. In other cases it is ignored. |
| 11497 | UPB_ATOMIC(upb_Arena*) tail; // == self when no other list members. |
| 11498 | |
| 11499 | // Linked list of blocks to free/cleanup. Atomic only for the benefit of |
| 11500 | // upb_Arena_SpaceAllocated(). |
| 11501 | UPB_ATOMIC(_upb_MemBlock*) blocks; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 11502 | }; |
| 11503 | |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 11504 | UPB_INLINE bool _upb_Arena_IsTaggedRefcount(uintptr_t parent_or_count) { |
| 11505 | return (parent_or_count & 1) == 1; |
| 11506 | } |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11507 | |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 11508 | UPB_INLINE bool _upb_Arena_IsTaggedPointer(uintptr_t parent_or_count) { |
| 11509 | return (parent_or_count & 1) == 0; |
| 11510 | } |
| 11511 | |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 11512 | UPB_INLINE uintptr_t _upb_Arena_RefCountFromTagged(uintptr_t parent_or_count) { |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 11513 | UPB_ASSERT(_upb_Arena_IsTaggedRefcount(parent_or_count)); |
| 11514 | return parent_or_count >> 1; |
| 11515 | } |
| 11516 | |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 11517 | UPB_INLINE uintptr_t _upb_Arena_TaggedFromRefcount(uintptr_t refcount) { |
| 11518 | uintptr_t parent_or_count = (refcount << 1) | 1; |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 11519 | UPB_ASSERT(_upb_Arena_IsTaggedRefcount(parent_or_count)); |
| 11520 | return parent_or_count; |
| 11521 | } |
| 11522 | |
| 11523 | UPB_INLINE upb_Arena* _upb_Arena_PointerFromTagged(uintptr_t parent_or_count) { |
| 11524 | UPB_ASSERT(_upb_Arena_IsTaggedPointer(parent_or_count)); |
| 11525 | return (upb_Arena*)parent_or_count; |
| 11526 | } |
| 11527 | |
| 11528 | UPB_INLINE uintptr_t _upb_Arena_TaggedFromPointer(upb_Arena* a) { |
| 11529 | uintptr_t parent_or_count = (uintptr_t)a; |
| 11530 | UPB_ASSERT(_upb_Arena_IsTaggedPointer(parent_or_count)); |
| 11531 | return parent_or_count; |
| 11532 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 11533 | |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 11534 | UPB_INLINE upb_alloc* upb_Arena_BlockAlloc(upb_Arena* arena) { |
| 11535 | return (upb_alloc*)(arena->block_alloc & ~0x1); |
| 11536 | } |
| 11537 | |
| 11538 | UPB_INLINE uintptr_t upb_Arena_MakeBlockAlloc(upb_alloc* alloc, |
| 11539 | bool has_initial) { |
| 11540 | uintptr_t alloc_uint = (uintptr_t)alloc; |
| 11541 | UPB_ASSERT((alloc_uint & 1) == 0); |
| 11542 | return alloc_uint | (has_initial ? 1 : 0); |
| 11543 | } |
| 11544 | |
| 11545 | UPB_INLINE bool upb_Arena_HasInitialBlock(upb_Arena* arena) { |
| 11546 | return arena->block_alloc & 0x1; |
| 11547 | } |
| 11548 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 11549 | |
Sandy Zhang | e3b0943 | 2023-08-07 09:30:02 -0700 | [diff] [blame] | 11550 | #endif /* UPB_MEM_INTERNAL_ARENA_H_ */ |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11551 | |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 11552 | #ifndef UPB_PORT_ATOMIC_H_ |
| 11553 | #define UPB_PORT_ATOMIC_H_ |
| 11554 | |
| 11555 | |
| 11556 | #ifdef UPB_USE_C11_ATOMICS |
| 11557 | |
Protobuf Team Bot | 743bf92 | 2023-09-14 01:12:11 +0000 | [diff] [blame] | 11558 | // IWYU pragma: begin_exports |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 11559 | #include <stdatomic.h> |
| 11560 | #include <stdbool.h> |
Protobuf Team Bot | 743bf92 | 2023-09-14 01:12:11 +0000 | [diff] [blame] | 11561 | // IWYU pragma: end_exports |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 11562 | |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 11563 | #define upb_Atomic_Init(addr, val) atomic_init(addr, val) |
| 11564 | #define upb_Atomic_Load(addr, order) atomic_load_explicit(addr, order) |
| 11565 | #define upb_Atomic_Store(addr, val, order) \ |
| 11566 | atomic_store_explicit(addr, val, order) |
| 11567 | #define upb_Atomic_Add(addr, val, order) \ |
| 11568 | atomic_fetch_add_explicit(addr, val, order) |
| 11569 | #define upb_Atomic_Sub(addr, val, order) \ |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 11570 | atomic_fetch_sub_explicit(addr, val, order) |
| 11571 | #define upb_Atomic_Exchange(addr, val, order) \ |
| 11572 | atomic_exchange_explicit(addr, val, order) |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 11573 | #define upb_Atomic_CompareExchangeStrong(addr, expected, desired, \ |
| 11574 | success_order, failure_order) \ |
| 11575 | atomic_compare_exchange_strong_explicit(addr, expected, desired, \ |
| 11576 | success_order, failure_order) |
| 11577 | #define upb_Atomic_CompareExchangeWeak(addr, expected, desired, success_order, \ |
| 11578 | failure_order) \ |
| 11579 | atomic_compare_exchange_weak_explicit(addr, expected, desired, \ |
| 11580 | success_order, failure_order) |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 11581 | |
| 11582 | #else // !UPB_USE_C11_ATOMICS |
| 11583 | |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 11584 | #include <string.h> |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 11585 | |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 11586 | #define upb_Atomic_Init(addr, val) (*addr = val) |
| 11587 | #define upb_Atomic_Load(addr, order) (*addr) |
| 11588 | #define upb_Atomic_Store(addr, val, order) (*(addr) = val) |
| 11589 | #define upb_Atomic_Add(addr, val, order) (*(addr) += val) |
| 11590 | #define upb_Atomic_Sub(addr, val, order) (*(addr) -= val) |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 11591 | |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 11592 | UPB_INLINE void* _upb_NonAtomic_Exchange(void* addr, void* value) { |
| 11593 | void* old; |
| 11594 | memcpy(&old, addr, sizeof(value)); |
| 11595 | memcpy(addr, &value, sizeof(value)); |
| 11596 | return old; |
| 11597 | } |
| 11598 | |
| 11599 | #define upb_Atomic_Exchange(addr, val, order) _upb_NonAtomic_Exchange(addr, val) |
| 11600 | |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 11601 | // `addr` and `expected` are logically double pointers. |
| 11602 | UPB_INLINE bool _upb_NonAtomic_CompareExchangeStrongP(void* addr, |
| 11603 | void* expected, |
| 11604 | void* desired) { |
| 11605 | if (memcmp(addr, expected, sizeof(desired)) == 0) { |
| 11606 | memcpy(addr, &desired, sizeof(desired)); |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 11607 | return true; |
| 11608 | } else { |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 11609 | memcpy(expected, addr, sizeof(desired)); |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 11610 | return false; |
| 11611 | } |
| 11612 | } |
| 11613 | |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 11614 | #define upb_Atomic_CompareExchangeStrong(addr, expected, desired, \ |
| 11615 | success_order, failure_order) \ |
| 11616 | _upb_NonAtomic_CompareExchangeStrongP((void*)addr, (void*)expected, \ |
| 11617 | (void*)desired) |
| 11618 | #define upb_Atomic_CompareExchangeWeak(addr, expected, desired, success_order, \ |
| 11619 | failure_order) \ |
| 11620 | upb_Atomic_CompareExchangeStrong(addr, expected, desired, 0, 0) |
| 11621 | |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 11622 | #endif |
| 11623 | |
| 11624 | |
| 11625 | #endif // UPB_PORT_ATOMIC_H_ |
| 11626 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 11627 | #ifndef UPB_WIRE_READER_H_ |
| 11628 | #define UPB_WIRE_READER_H_ |
| 11629 | |
| 11630 | |
Sandy Zhang | e3b0943 | 2023-08-07 09:30:02 -0700 | [diff] [blame] | 11631 | #ifndef UPB_WIRE_INTERNAL_SWAP_H_ |
| 11632 | #define UPB_WIRE_INTERNAL_SWAP_H_ |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 11633 | |
Adam Cozzette | 7d5592e | 2023-08-23 12:15:26 -0700 | [diff] [blame] | 11634 | #include <stdint.h> |
| 11635 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 11636 | // Must be last. |
| 11637 | |
| 11638 | #ifdef __cplusplus |
| 11639 | extern "C" { |
| 11640 | #endif |
| 11641 | |
| 11642 | UPB_INLINE bool _upb_IsLittleEndian(void) { |
| 11643 | int x = 1; |
| 11644 | return *(char*)&x == 1; |
| 11645 | } |
| 11646 | |
| 11647 | UPB_INLINE uint32_t _upb_BigEndian_Swap32(uint32_t val) { |
| 11648 | if (_upb_IsLittleEndian()) return val; |
| 11649 | |
| 11650 | return ((val & 0xff) << 24) | ((val & 0xff00) << 8) | |
| 11651 | ((val & 0xff0000) >> 8) | ((val & 0xff000000) >> 24); |
| 11652 | } |
| 11653 | |
| 11654 | UPB_INLINE uint64_t _upb_BigEndian_Swap64(uint64_t val) { |
| 11655 | if (_upb_IsLittleEndian()) return val; |
| 11656 | |
| 11657 | return ((uint64_t)_upb_BigEndian_Swap32((uint32_t)val) << 32) | |
| 11658 | _upb_BigEndian_Swap32((uint32_t)(val >> 32)); |
| 11659 | } |
| 11660 | |
| 11661 | #ifdef __cplusplus |
| 11662 | } /* extern "C" */ |
| 11663 | #endif |
| 11664 | |
| 11665 | |
Sandy Zhang | e3b0943 | 2023-08-07 09:30:02 -0700 | [diff] [blame] | 11666 | #endif /* UPB_WIRE_INTERNAL_SWAP_H_ */ |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 11667 | |
Protobuf Team Bot | 743bf92 | 2023-09-14 01:12:11 +0000 | [diff] [blame] | 11668 | #ifndef UPB_WIRE_TYPES_H_ |
| 11669 | #define UPB_WIRE_TYPES_H_ |
| 11670 | |
| 11671 | // A list of types as they are encoded on the wire. |
| 11672 | typedef enum { |
| 11673 | kUpb_WireType_Varint = 0, |
| 11674 | kUpb_WireType_64Bit = 1, |
| 11675 | kUpb_WireType_Delimited = 2, |
| 11676 | kUpb_WireType_StartGroup = 3, |
| 11677 | kUpb_WireType_EndGroup = 4, |
| 11678 | kUpb_WireType_32Bit = 5 |
| 11679 | } upb_WireType; |
| 11680 | |
| 11681 | #endif /* UPB_WIRE_TYPES_H_ */ |
| 11682 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 11683 | // Must be last. |
| 11684 | |
| 11685 | #ifdef __cplusplus |
| 11686 | extern "C" { |
| 11687 | #endif |
| 11688 | |
| 11689 | // The upb_WireReader interface is suitable for general-purpose parsing of |
| 11690 | // protobuf binary wire format. It is designed to be used along with |
| 11691 | // upb_EpsCopyInputStream for buffering, and all parsing routines in this file |
| 11692 | // assume that at least kUpb_EpsCopyInputStream_SlopBytes worth of data is |
| 11693 | // available to read without any bounds checks. |
| 11694 | |
| 11695 | #define kUpb_WireReader_WireTypeMask 7 |
| 11696 | #define kUpb_WireReader_WireTypeBits 3 |
| 11697 | |
| 11698 | typedef struct { |
| 11699 | const char* ptr; |
| 11700 | uint64_t val; |
| 11701 | } _upb_WireReader_ReadLongVarintRet; |
| 11702 | |
| 11703 | _upb_WireReader_ReadLongVarintRet _upb_WireReader_ReadLongVarint( |
| 11704 | const char* ptr, uint64_t val); |
| 11705 | |
| 11706 | static UPB_FORCEINLINE const char* _upb_WireReader_ReadVarint(const char* ptr, |
| 11707 | uint64_t* val, |
| 11708 | int maxlen, |
| 11709 | uint64_t maxval) { |
| 11710 | uint64_t byte = (uint8_t)*ptr; |
| 11711 | if (UPB_LIKELY((byte & 0x80) == 0)) { |
| 11712 | *val = (uint32_t)byte; |
| 11713 | return ptr + 1; |
| 11714 | } |
| 11715 | const char* start = ptr; |
| 11716 | _upb_WireReader_ReadLongVarintRet res = |
| 11717 | _upb_WireReader_ReadLongVarint(ptr, byte); |
| 11718 | if (!res.ptr || (maxlen < 10 && res.ptr - start > maxlen) || |
| 11719 | res.val > maxval) { |
| 11720 | return NULL; // Malformed. |
| 11721 | } |
| 11722 | *val = res.val; |
| 11723 | return res.ptr; |
| 11724 | } |
| 11725 | |
| 11726 | // Parses a tag into `tag`, and returns a pointer past the end of the tag, or |
| 11727 | // NULL if there was an error in the tag data. |
| 11728 | // |
| 11729 | // REQUIRES: there must be at least 10 bytes of data available at `ptr`. |
| 11730 | // Bounds checks must be performed before calling this function, preferably |
| 11731 | // by calling upb_EpsCopyInputStream_IsDone(). |
| 11732 | static UPB_FORCEINLINE const char* upb_WireReader_ReadTag(const char* ptr, |
| 11733 | uint32_t* tag) { |
| 11734 | uint64_t val; |
| 11735 | ptr = _upb_WireReader_ReadVarint(ptr, &val, 5, UINT32_MAX); |
| 11736 | if (!ptr) return NULL; |
| 11737 | *tag = val; |
| 11738 | return ptr; |
| 11739 | } |
| 11740 | |
| 11741 | // Given a tag, returns the field number. |
| 11742 | UPB_INLINE uint32_t upb_WireReader_GetFieldNumber(uint32_t tag) { |
| 11743 | return tag >> kUpb_WireReader_WireTypeBits; |
| 11744 | } |
| 11745 | |
| 11746 | // Given a tag, returns the wire type. |
| 11747 | UPB_INLINE uint8_t upb_WireReader_GetWireType(uint32_t tag) { |
| 11748 | return tag & kUpb_WireReader_WireTypeMask; |
| 11749 | } |
| 11750 | |
| 11751 | UPB_INLINE const char* upb_WireReader_ReadVarint(const char* ptr, |
| 11752 | uint64_t* val) { |
| 11753 | return _upb_WireReader_ReadVarint(ptr, val, 10, UINT64_MAX); |
| 11754 | } |
| 11755 | |
| 11756 | // Skips data for a varint, returning a pointer past the end of the varint, or |
| 11757 | // NULL if there was an error in the varint data. |
| 11758 | // |
| 11759 | // REQUIRES: there must be at least 10 bytes of data available at `ptr`. |
| 11760 | // Bounds checks must be performed before calling this function, preferably |
| 11761 | // by calling upb_EpsCopyInputStream_IsDone(). |
| 11762 | UPB_INLINE const char* upb_WireReader_SkipVarint(const char* ptr) { |
| 11763 | uint64_t val; |
| 11764 | return upb_WireReader_ReadVarint(ptr, &val); |
| 11765 | } |
| 11766 | |
| 11767 | // Reads a varint indicating the size of a delimited field into `size`, or |
| 11768 | // NULL if there was an error in the varint data. |
| 11769 | // |
| 11770 | // REQUIRES: there must be at least 10 bytes of data available at `ptr`. |
| 11771 | // Bounds checks must be performed before calling this function, preferably |
| 11772 | // by calling upb_EpsCopyInputStream_IsDone(). |
| 11773 | UPB_INLINE const char* upb_WireReader_ReadSize(const char* ptr, int* size) { |
| 11774 | uint64_t size64; |
| 11775 | ptr = upb_WireReader_ReadVarint(ptr, &size64); |
| 11776 | if (!ptr || size64 >= INT32_MAX) return NULL; |
| 11777 | *size = size64; |
| 11778 | return ptr; |
| 11779 | } |
| 11780 | |
| 11781 | // Reads a fixed32 field, performing byte swapping if necessary. |
| 11782 | // |
| 11783 | // REQUIRES: there must be at least 4 bytes of data available at `ptr`. |
| 11784 | // Bounds checks must be performed before calling this function, preferably |
| 11785 | // by calling upb_EpsCopyInputStream_IsDone(). |
| 11786 | UPB_INLINE const char* upb_WireReader_ReadFixed32(const char* ptr, void* val) { |
| 11787 | uint32_t uval; |
| 11788 | memcpy(&uval, ptr, 4); |
| 11789 | uval = _upb_BigEndian_Swap32(uval); |
| 11790 | memcpy(val, &uval, 4); |
| 11791 | return ptr + 4; |
| 11792 | } |
| 11793 | |
| 11794 | // Reads a fixed64 field, performing byte swapping if necessary. |
| 11795 | // |
| 11796 | // REQUIRES: there must be at least 4 bytes of data available at `ptr`. |
| 11797 | // Bounds checks must be performed before calling this function, preferably |
| 11798 | // by calling upb_EpsCopyInputStream_IsDone(). |
| 11799 | UPB_INLINE const char* upb_WireReader_ReadFixed64(const char* ptr, void* val) { |
| 11800 | uint64_t uval; |
| 11801 | memcpy(&uval, ptr, 8); |
| 11802 | uval = _upb_BigEndian_Swap64(uval); |
| 11803 | memcpy(val, &uval, 8); |
| 11804 | return ptr + 8; |
| 11805 | } |
| 11806 | |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 11807 | const char* _upb_WireReader_SkipGroup(const char* ptr, uint32_t tag, |
| 11808 | int depth_limit, |
| 11809 | upb_EpsCopyInputStream* stream); |
| 11810 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 11811 | // Skips data for a group, returning a pointer past the end of the group, or |
| 11812 | // NULL if there was an error parsing the group. The `tag` argument should be |
| 11813 | // the start group tag that begins the group. The `depth_limit` argument |
| 11814 | // indicates how many levels of recursion the group is allowed to have before |
| 11815 | // reporting a parse error (this limit exists to protect against stack |
| 11816 | // overflow). |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 11817 | // |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 11818 | // TODO: evaluate how the depth_limit should be specified. Do users need |
| 11819 | // control over this? |
| 11820 | UPB_INLINE const char* upb_WireReader_SkipGroup( |
| 11821 | const char* ptr, uint32_t tag, upb_EpsCopyInputStream* stream) { |
| 11822 | return _upb_WireReader_SkipGroup(ptr, tag, 100, stream); |
| 11823 | } |
| 11824 | |
| 11825 | UPB_INLINE const char* _upb_WireReader_SkipValue( |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 11826 | const char* ptr, uint32_t tag, int depth_limit, |
| 11827 | upb_EpsCopyInputStream* stream) { |
| 11828 | switch (upb_WireReader_GetWireType(tag)) { |
| 11829 | case kUpb_WireType_Varint: |
| 11830 | return upb_WireReader_SkipVarint(ptr); |
| 11831 | case kUpb_WireType_32Bit: |
| 11832 | return ptr + 4; |
| 11833 | case kUpb_WireType_64Bit: |
| 11834 | return ptr + 8; |
| 11835 | case kUpb_WireType_Delimited: { |
| 11836 | int size; |
| 11837 | ptr = upb_WireReader_ReadSize(ptr, &size); |
| 11838 | if (!ptr) return NULL; |
| 11839 | ptr += size; |
| 11840 | return ptr; |
| 11841 | } |
| 11842 | case kUpb_WireType_StartGroup: |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 11843 | return _upb_WireReader_SkipGroup(ptr, tag, depth_limit, stream); |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 11844 | case kUpb_WireType_EndGroup: |
| 11845 | return NULL; // Should be handled before now. |
| 11846 | default: |
| 11847 | return NULL; // Unknown wire type. |
| 11848 | } |
| 11849 | } |
| 11850 | |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 11851 | // Skips data for a wire value of any type, returning a pointer past the end of |
| 11852 | // the data, or NULL if there was an error parsing the group. The `tag` argument |
| 11853 | // should be the tag that was just parsed. The `depth_limit` argument indicates |
| 11854 | // how many levels of recursion a group is allowed to have before reporting a |
| 11855 | // parse error (this limit exists to protect against stack overflow). |
| 11856 | // |
| 11857 | // REQUIRES: there must be at least 10 bytes of data available at `ptr`. |
| 11858 | // Bounds checks must be performed before calling this function, preferably |
| 11859 | // by calling upb_EpsCopyInputStream_IsDone(). |
| 11860 | // |
| 11861 | // TODO: evaluate how the depth_limit should be specified. Do users need |
| 11862 | // control over this? |
| 11863 | UPB_INLINE const char* upb_WireReader_SkipValue( |
| 11864 | const char* ptr, uint32_t tag, upb_EpsCopyInputStream* stream) { |
| 11865 | return _upb_WireReader_SkipValue(ptr, tag, 100, stream); |
| 11866 | } |
| 11867 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 11868 | #ifdef __cplusplus |
| 11869 | } /* extern "C" */ |
| 11870 | #endif |
| 11871 | |
| 11872 | |
| 11873 | #endif // UPB_WIRE_READER_H_ |
| 11874 | |
Protobuf Team Bot | 376ba2f | 2023-09-29 22:17:43 +0000 | [diff] [blame] | 11875 | // EVERYTHING BELOW THIS LINE IS INTERNAL - DO NOT USE ///////////////////////// |
| 11876 | |
| 11877 | #ifndef UPB_COLLECTIONS_INTERNAL_MAP_SORTER_H_ |
| 11878 | #define UPB_COLLECTIONS_INTERNAL_MAP_SORTER_H_ |
| 11879 | |
| 11880 | #include <stdlib.h> |
| 11881 | |
| 11882 | |
| 11883 | #ifndef UPB_COLLECTIONS_INTERNAL_MAP_ENTRY_H_ |
| 11884 | #define UPB_COLLECTIONS_INTERNAL_MAP_ENTRY_H_ |
| 11885 | |
| 11886 | |
| 11887 | // Map entries aren't actually stored for map fields, they are only used during |
| 11888 | // parsing. For parsing, it helps a lot if all map entry messages have the same |
| 11889 | // layout. The layout code in mini_table/decode.c will ensure that all map |
| 11890 | // entries have this layout. |
| 11891 | // |
| 11892 | // Note that users can and do create map entries directly, which will also use |
| 11893 | // this layout. |
| 11894 | // |
| 11895 | // NOTE: sync with wire/decode.c. |
| 11896 | typedef struct { |
| 11897 | // We only need 2 hasbits max, but due to alignment we'll use 8 bytes here, |
| 11898 | // and the uint64_t helps make this clear. |
| 11899 | uint64_t hasbits; |
| 11900 | union { |
| 11901 | upb_StringView str; // For str/bytes. |
| 11902 | upb_value val; // For all other types. |
| 11903 | } k; |
| 11904 | union { |
| 11905 | upb_StringView str; // For str/bytes. |
| 11906 | upb_value val; // For all other types. |
| 11907 | } v; |
| 11908 | } upb_MapEntryData; |
| 11909 | |
| 11910 | typedef struct { |
| 11911 | upb_Message_Internal internal; |
| 11912 | upb_MapEntryData data; |
| 11913 | } upb_MapEntry; |
| 11914 | |
| 11915 | #endif // UPB_COLLECTIONS_INTERNAL_MAP_ENTRY_H_ |
| 11916 | |
| 11917 | // Must be last. |
| 11918 | |
| 11919 | #ifdef __cplusplus |
| 11920 | extern "C" { |
| 11921 | #endif |
| 11922 | |
| 11923 | // _upb_mapsorter sorts maps and provides ordered iteration over the entries. |
| 11924 | // Since maps can be recursive (map values can be messages which contain other |
| 11925 | // maps), _upb_mapsorter can contain a stack of maps. |
| 11926 | |
| 11927 | typedef struct { |
| 11928 | void const** entries; |
| 11929 | int size; |
| 11930 | int cap; |
| 11931 | } _upb_mapsorter; |
| 11932 | |
| 11933 | typedef struct { |
| 11934 | int start; |
| 11935 | int pos; |
| 11936 | int end; |
| 11937 | } _upb_sortedmap; |
| 11938 | |
| 11939 | UPB_INLINE void _upb_mapsorter_init(_upb_mapsorter* s) { |
| 11940 | s->entries = NULL; |
| 11941 | s->size = 0; |
| 11942 | s->cap = 0; |
| 11943 | } |
| 11944 | |
| 11945 | UPB_INLINE void _upb_mapsorter_destroy(_upb_mapsorter* s) { |
| 11946 | if (s->entries) free(s->entries); |
| 11947 | } |
| 11948 | |
| 11949 | UPB_INLINE bool _upb_sortedmap_next(_upb_mapsorter* s, const upb_Map* map, |
| 11950 | _upb_sortedmap* sorted, upb_MapEntry* ent) { |
| 11951 | if (sorted->pos == sorted->end) return false; |
| 11952 | const upb_tabent* tabent = (const upb_tabent*)s->entries[sorted->pos++]; |
| 11953 | upb_StringView key = upb_tabstrview(tabent->key); |
| 11954 | _upb_map_fromkey(key, &ent->data.k, map->key_size); |
| 11955 | upb_value val = {tabent->val.val}; |
| 11956 | _upb_map_fromvalue(val, &ent->data.v, map->val_size); |
| 11957 | return true; |
| 11958 | } |
| 11959 | |
| 11960 | UPB_INLINE bool _upb_sortedmap_nextext(_upb_mapsorter* s, |
| 11961 | _upb_sortedmap* sorted, |
| 11962 | const upb_Message_Extension** ext) { |
| 11963 | if (sorted->pos == sorted->end) return false; |
| 11964 | *ext = (const upb_Message_Extension*)s->entries[sorted->pos++]; |
| 11965 | return true; |
| 11966 | } |
| 11967 | |
| 11968 | UPB_INLINE void _upb_mapsorter_popmap(_upb_mapsorter* s, |
| 11969 | _upb_sortedmap* sorted) { |
| 11970 | s->size = sorted->start; |
| 11971 | } |
| 11972 | |
| 11973 | bool _upb_mapsorter_pushmap(_upb_mapsorter* s, upb_FieldType key_type, |
| 11974 | const upb_Map* map, _upb_sortedmap* sorted); |
| 11975 | |
| 11976 | bool _upb_mapsorter_pushexts(_upb_mapsorter* s, |
| 11977 | const upb_Message_Extension* exts, size_t count, |
| 11978 | _upb_sortedmap* sorted); |
| 11979 | |
| 11980 | #ifdef __cplusplus |
| 11981 | } /* extern "C" */ |
| 11982 | #endif |
| 11983 | |
| 11984 | |
| 11985 | #endif /* UPB_COLLECTIONS_INTERNAL_MAP_SORTER_H_ */ |
| 11986 | |
Adam Cozzette | 8059da2 | 2023-08-16 07:57:14 -0700 | [diff] [blame] | 11987 | #ifndef UPB_MINI_DESCRIPTOR_INTERNAL_DECODER_H_ |
| 11988 | #define UPB_MINI_DESCRIPTOR_INTERNAL_DECODER_H_ |
| 11989 | |
| 11990 | |
| 11991 | #ifndef UPB_MINI_DESCRIPTOR_INTERNAL_BASE92_H_ |
| 11992 | #define UPB_MINI_DESCRIPTOR_INTERNAL_BASE92_H_ |
| 11993 | |
Adam Cozzette | 7d5592e | 2023-08-23 12:15:26 -0700 | [diff] [blame] | 11994 | #include <stdint.h> |
| 11995 | |
Adam Cozzette | 8059da2 | 2023-08-16 07:57:14 -0700 | [diff] [blame] | 11996 | |
| 11997 | // Must be last. |
| 11998 | |
| 11999 | #ifdef __cplusplus |
| 12000 | extern "C" { |
| 12001 | #endif |
| 12002 | |
| 12003 | UPB_INLINE char _upb_ToBase92(int8_t ch) { |
| 12004 | extern const char _kUpb_ToBase92[]; |
| 12005 | UPB_ASSERT(0 <= ch && ch < 92); |
| 12006 | return _kUpb_ToBase92[ch]; |
| 12007 | } |
| 12008 | |
| 12009 | UPB_INLINE char _upb_FromBase92(uint8_t ch) { |
| 12010 | extern const int8_t _kUpb_FromBase92[]; |
| 12011 | if (' ' > ch || ch > '~') return -1; |
| 12012 | return _kUpb_FromBase92[ch - ' ']; |
| 12013 | } |
| 12014 | |
| 12015 | UPB_INLINE const char* _upb_Base92_DecodeVarint(const char* ptr, |
| 12016 | const char* end, char first_ch, |
| 12017 | uint8_t min, uint8_t max, |
| 12018 | uint32_t* out_val) { |
| 12019 | uint32_t val = 0; |
| 12020 | uint32_t shift = 0; |
| 12021 | const int bits_per_char = |
| 12022 | upb_Log2Ceiling(_upb_FromBase92(max) - _upb_FromBase92(min)); |
| 12023 | char ch = first_ch; |
| 12024 | while (1) { |
| 12025 | uint32_t bits = _upb_FromBase92(ch) - _upb_FromBase92(min); |
| 12026 | val |= bits << shift; |
| 12027 | if (ptr == end || *ptr < min || max < *ptr) { |
| 12028 | *out_val = val; |
| 12029 | UPB_ASSUME(ptr != NULL); |
| 12030 | return ptr; |
| 12031 | } |
| 12032 | ch = *ptr++; |
| 12033 | shift += bits_per_char; |
| 12034 | if (shift >= 32) return NULL; |
| 12035 | } |
| 12036 | } |
| 12037 | |
| 12038 | #ifdef __cplusplus |
| 12039 | } /* extern "C" */ |
| 12040 | #endif |
| 12041 | |
| 12042 | |
| 12043 | #endif // UPB_MINI_DESCRIPTOR_INTERNAL_BASE92_H_ |
| 12044 | |
| 12045 | // Must be last. |
| 12046 | |
| 12047 | // upb_MdDecoder: used internally for decoding MiniDescriptors for messages, |
| 12048 | // extensions, and enums. |
| 12049 | typedef struct { |
| 12050 | const char* end; |
| 12051 | upb_Status* status; |
| 12052 | jmp_buf err; |
| 12053 | } upb_MdDecoder; |
| 12054 | |
| 12055 | UPB_PRINTF(2, 3) |
| 12056 | UPB_NORETURN UPB_INLINE void upb_MdDecoder_ErrorJmp(upb_MdDecoder* d, |
| 12057 | const char* fmt, ...) { |
| 12058 | if (d->status) { |
| 12059 | va_list argp; |
| 12060 | upb_Status_SetErrorMessage(d->status, "Error building mini table: "); |
| 12061 | va_start(argp, fmt); |
| 12062 | upb_Status_VAppendErrorFormat(d->status, fmt, argp); |
| 12063 | va_end(argp); |
| 12064 | } |
| 12065 | UPB_LONGJMP(d->err, 1); |
| 12066 | } |
| 12067 | |
| 12068 | UPB_INLINE void upb_MdDecoder_CheckOutOfMemory(upb_MdDecoder* d, |
| 12069 | const void* ptr) { |
| 12070 | if (!ptr) upb_MdDecoder_ErrorJmp(d, "Out of memory"); |
| 12071 | } |
| 12072 | |
| 12073 | UPB_INLINE const char* upb_MdDecoder_DecodeBase92Varint( |
| 12074 | upb_MdDecoder* d, const char* ptr, char first_ch, uint8_t min, uint8_t max, |
| 12075 | uint32_t* out_val) { |
| 12076 | ptr = _upb_Base92_DecodeVarint(ptr, d->end, first_ch, min, max, out_val); |
| 12077 | if (!ptr) upb_MdDecoder_ErrorJmp(d, "Overlong varint"); |
| 12078 | return ptr; |
| 12079 | } |
| 12080 | |
| 12081 | |
| 12082 | #endif // UPB_MINI_DESCRIPTOR_INTERNAL_DECODER_H_ |
| 12083 | |
| 12084 | #ifndef UPB_MINI_DESCRIPTOR_INTERNAL_WIRE_CONSTANTS_H_ |
| 12085 | #define UPB_MINI_DESCRIPTOR_INTERNAL_WIRE_CONSTANTS_H_ |
| 12086 | |
| 12087 | |
| 12088 | // Must be last. |
| 12089 | |
| 12090 | typedef enum { |
| 12091 | kUpb_EncodedType_Double = 0, |
| 12092 | kUpb_EncodedType_Float = 1, |
| 12093 | kUpb_EncodedType_Fixed32 = 2, |
| 12094 | kUpb_EncodedType_Fixed64 = 3, |
| 12095 | kUpb_EncodedType_SFixed32 = 4, |
| 12096 | kUpb_EncodedType_SFixed64 = 5, |
| 12097 | kUpb_EncodedType_Int32 = 6, |
| 12098 | kUpb_EncodedType_UInt32 = 7, |
| 12099 | kUpb_EncodedType_SInt32 = 8, |
| 12100 | kUpb_EncodedType_Int64 = 9, |
| 12101 | kUpb_EncodedType_UInt64 = 10, |
| 12102 | kUpb_EncodedType_SInt64 = 11, |
| 12103 | kUpb_EncodedType_OpenEnum = 12, |
| 12104 | kUpb_EncodedType_Bool = 13, |
| 12105 | kUpb_EncodedType_Bytes = 14, |
| 12106 | kUpb_EncodedType_String = 15, |
| 12107 | kUpb_EncodedType_Group = 16, |
| 12108 | kUpb_EncodedType_Message = 17, |
| 12109 | kUpb_EncodedType_ClosedEnum = 18, |
| 12110 | |
| 12111 | kUpb_EncodedType_RepeatedBase = 20, |
| 12112 | } upb_EncodedType; |
| 12113 | |
| 12114 | typedef enum { |
| 12115 | kUpb_EncodedFieldModifier_FlipPacked = 1 << 0, |
| 12116 | kUpb_EncodedFieldModifier_IsRequired = 1 << 1, |
| 12117 | kUpb_EncodedFieldModifier_IsProto3Singular = 1 << 2, |
Protobuf Team Bot | b58bd40 | 2023-09-19 15:42:34 +0000 | [diff] [blame] | 12118 | kUpb_EncodedFieldModifier_FlipValidateUtf8 = 1 << 3, |
Adam Cozzette | 8059da2 | 2023-08-16 07:57:14 -0700 | [diff] [blame] | 12119 | } upb_EncodedFieldModifier; |
| 12120 | |
| 12121 | enum { |
| 12122 | kUpb_EncodedValue_MinField = ' ', |
| 12123 | kUpb_EncodedValue_MaxField = 'I', |
| 12124 | kUpb_EncodedValue_MinModifier = 'L', |
| 12125 | kUpb_EncodedValue_MaxModifier = '[', |
| 12126 | kUpb_EncodedValue_End = '^', |
| 12127 | kUpb_EncodedValue_MinSkip = '_', |
| 12128 | kUpb_EncodedValue_MaxSkip = '~', |
| 12129 | kUpb_EncodedValue_OneofSeparator = '~', |
| 12130 | kUpb_EncodedValue_FieldSeparator = '|', |
| 12131 | kUpb_EncodedValue_MinOneofField = ' ', |
| 12132 | kUpb_EncodedValue_MaxOneofField = 'b', |
| 12133 | kUpb_EncodedValue_MaxEnumMask = 'A', |
| 12134 | }; |
| 12135 | |
| 12136 | enum { |
| 12137 | kUpb_EncodedVersion_EnumV1 = '!', |
| 12138 | kUpb_EncodedVersion_ExtensionV1 = '#', |
| 12139 | kUpb_EncodedVersion_MapV1 = '%', |
| 12140 | kUpb_EncodedVersion_MessageV1 = '$', |
| 12141 | kUpb_EncodedVersion_MessageSetV1 = '&', |
| 12142 | }; |
| 12143 | |
| 12144 | |
| 12145 | #endif // UPB_MINI_DESCRIPTOR_INTERNAL_WIRE_CONSTANTS_H_ |
| 12146 | |
| 12147 | #ifndef UPB_MINI_DESCRIPTOR_INTERNAL_MODIFIERS_H_ |
| 12148 | #define UPB_MINI_DESCRIPTOR_INTERNAL_MODIFIERS_H_ |
| 12149 | |
| 12150 | // Must be last. |
| 12151 | |
| 12152 | typedef enum { |
| 12153 | kUpb_FieldModifier_IsRepeated = 1 << 0, |
| 12154 | kUpb_FieldModifier_IsPacked = 1 << 1, |
| 12155 | kUpb_FieldModifier_IsClosedEnum = 1 << 2, |
| 12156 | kUpb_FieldModifier_IsProto3Singular = 1 << 3, |
| 12157 | kUpb_FieldModifier_IsRequired = 1 << 4, |
Protobuf Team Bot | b58bd40 | 2023-09-19 15:42:34 +0000 | [diff] [blame] | 12158 | kUpb_FieldModifier_ValidateUtf8 = 1 << 5, |
Adam Cozzette | 8059da2 | 2023-08-16 07:57:14 -0700 | [diff] [blame] | 12159 | } kUpb_FieldModifier; |
| 12160 | |
Protobuf Team Bot | b58bd40 | 2023-09-19 15:42:34 +0000 | [diff] [blame] | 12161 | // These modifiers are also used on the wire. |
Adam Cozzette | 8059da2 | 2023-08-16 07:57:14 -0700 | [diff] [blame] | 12162 | typedef enum { |
| 12163 | kUpb_MessageModifier_ValidateUtf8 = 1 << 0, |
| 12164 | kUpb_MessageModifier_DefaultIsPacked = 1 << 1, |
| 12165 | kUpb_MessageModifier_IsExtendable = 1 << 2, |
| 12166 | } kUpb_MessageModifier; |
| 12167 | |
| 12168 | |
| 12169 | #endif // UPB_MINI_DESCRIPTOR_INTERNAL_MODIFIERS_H_ |
| 12170 | |
| 12171 | #ifndef UPB_MINI_DESCRIPTOR_INTERNAL_ENCODE_H_ |
| 12172 | #define UPB_MINI_DESCRIPTOR_INTERNAL_ENCODE_H_ |
| 12173 | |
Adam Cozzette | 7d5592e | 2023-08-23 12:15:26 -0700 | [diff] [blame] | 12174 | #include <stdint.h> |
| 12175 | |
Adam Cozzette | 8059da2 | 2023-08-16 07:57:14 -0700 | [diff] [blame] | 12176 | |
| 12177 | // Must be last. |
| 12178 | |
| 12179 | // If the input buffer has at least this many bytes available, the encoder call |
| 12180 | // is guaranteed to succeed (as long as field number order is maintained). |
| 12181 | #define kUpb_MtDataEncoder_MinSize 16 |
| 12182 | |
| 12183 | typedef struct { |
| 12184 | char* end; // Limit of the buffer passed as a parameter. |
| 12185 | // Aliased to internal-only members in .cc. |
| 12186 | char internal[32]; |
| 12187 | } upb_MtDataEncoder; |
| 12188 | |
| 12189 | #ifdef __cplusplus |
| 12190 | extern "C" { |
| 12191 | #endif |
| 12192 | |
| 12193 | // Encodes field/oneof information for a given message. The sequence of calls |
| 12194 | // should look like: |
| 12195 | // |
| 12196 | // upb_MtDataEncoder e; |
| 12197 | // char buf[256]; |
| 12198 | // char* ptr = buf; |
| 12199 | // e.end = ptr + sizeof(buf); |
| 12200 | // unit64_t msg_mod = ...; // bitwise & of kUpb_MessageModifiers or zero |
| 12201 | // ptr = upb_MtDataEncoder_StartMessage(&e, ptr, msg_mod); |
| 12202 | // // Fields *must* be in field number order. |
| 12203 | // ptr = upb_MtDataEncoder_PutField(&e, ptr, ...); |
| 12204 | // ptr = upb_MtDataEncoder_PutField(&e, ptr, ...); |
| 12205 | // ptr = upb_MtDataEncoder_PutField(&e, ptr, ...); |
| 12206 | // |
| 12207 | // // If oneofs are present. Oneofs must be encoded after regular fields. |
| 12208 | // ptr = upb_MiniTable_StartOneof(&e, ptr) |
| 12209 | // ptr = upb_MiniTable_PutOneofField(&e, ptr, ...); |
| 12210 | // ptr = upb_MiniTable_PutOneofField(&e, ptr, ...); |
| 12211 | // |
| 12212 | // ptr = upb_MiniTable_StartOneof(&e, ptr); |
| 12213 | // ptr = upb_MiniTable_PutOneofField(&e, ptr, ...); |
| 12214 | // ptr = upb_MiniTable_PutOneofField(&e, ptr, ...); |
| 12215 | // |
| 12216 | // Oneofs must be encoded after all regular fields. |
| 12217 | char* upb_MtDataEncoder_StartMessage(upb_MtDataEncoder* e, char* ptr, |
| 12218 | uint64_t msg_mod); |
| 12219 | char* upb_MtDataEncoder_PutField(upb_MtDataEncoder* e, char* ptr, |
| 12220 | upb_FieldType type, uint32_t field_num, |
| 12221 | uint64_t field_mod); |
| 12222 | char* upb_MtDataEncoder_StartOneof(upb_MtDataEncoder* e, char* ptr); |
| 12223 | char* upb_MtDataEncoder_PutOneofField(upb_MtDataEncoder* e, char* ptr, |
| 12224 | uint32_t field_num); |
| 12225 | |
| 12226 | // Encodes the set of values for a given enum. The values must be given in |
| 12227 | // order (after casting to uint32_t), and repeats are not allowed. |
| 12228 | char* upb_MtDataEncoder_StartEnum(upb_MtDataEncoder* e, char* ptr); |
| 12229 | char* upb_MtDataEncoder_PutEnumValue(upb_MtDataEncoder* e, char* ptr, |
| 12230 | uint32_t val); |
| 12231 | char* upb_MtDataEncoder_EndEnum(upb_MtDataEncoder* e, char* ptr); |
| 12232 | |
| 12233 | // Encodes an entire mini descriptor for an extension. |
| 12234 | char* upb_MtDataEncoder_EncodeExtension(upb_MtDataEncoder* e, char* ptr, |
| 12235 | upb_FieldType type, uint32_t field_num, |
| 12236 | uint64_t field_mod); |
| 12237 | |
| 12238 | // Encodes an entire mini descriptor for a map. |
| 12239 | char* upb_MtDataEncoder_EncodeMap(upb_MtDataEncoder* e, char* ptr, |
| 12240 | upb_FieldType key_type, |
| 12241 | upb_FieldType value_type, uint64_t key_mod, |
| 12242 | uint64_t value_mod); |
| 12243 | |
| 12244 | // Encodes an entire mini descriptor for a message set. |
| 12245 | char* upb_MtDataEncoder_EncodeMessageSet(upb_MtDataEncoder* e, char* ptr); |
| 12246 | |
| 12247 | #ifdef __cplusplus |
| 12248 | } /* extern "C" */ |
| 12249 | #endif |
| 12250 | |
| 12251 | |
| 12252 | #endif /* UPB_MINI_DESCRIPTOR_INTERNAL_ENCODE_H_ */ |
| 12253 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12254 | #ifndef UPB_REFLECTION_DEF_POOL_INTERNAL_H_ |
| 12255 | #define UPB_REFLECTION_DEF_POOL_INTERNAL_H_ |
| 12256 | |
| 12257 | |
| 12258 | // Must be last. |
| 12259 | |
| 12260 | #ifdef __cplusplus |
| 12261 | extern "C" { |
| 12262 | #endif |
| 12263 | |
| 12264 | upb_Arena* _upb_DefPool_Arena(const upb_DefPool* s); |
| 12265 | size_t _upb_DefPool_BytesLoaded(const upb_DefPool* s); |
| 12266 | upb_ExtensionRegistry* _upb_DefPool_ExtReg(const upb_DefPool* s); |
| 12267 | |
| 12268 | bool _upb_DefPool_InsertExt(upb_DefPool* s, const upb_MiniTableExtension* ext, |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 12269 | const upb_FieldDef* f); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12270 | bool _upb_DefPool_InsertSym(upb_DefPool* s, upb_StringView sym, upb_value v, |
| 12271 | upb_Status* status); |
| 12272 | bool _upb_DefPool_LookupSym(const upb_DefPool* s, const char* sym, size_t size, |
| 12273 | upb_value* v); |
| 12274 | |
| 12275 | void** _upb_DefPool_ScratchData(const upb_DefPool* s); |
| 12276 | size_t* _upb_DefPool_ScratchSize(const upb_DefPool* s); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 12277 | void _upb_DefPool_SetPlatform(upb_DefPool* s, upb_MiniTablePlatform platform); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12278 | |
| 12279 | // For generated code only: loads a generated descriptor. |
| 12280 | typedef struct _upb_DefPool_Init { |
| 12281 | struct _upb_DefPool_Init** deps; // Dependencies of this file. |
| 12282 | const upb_MiniTableFile* layout; |
| 12283 | const char* filename; |
| 12284 | upb_StringView descriptor; // Serialized descriptor. |
| 12285 | } _upb_DefPool_Init; |
| 12286 | |
| 12287 | bool _upb_DefPool_LoadDefInit(upb_DefPool* s, const _upb_DefPool_Init* init); |
| 12288 | |
| 12289 | // Should only be directly called by tests. This variant lets us suppress |
| 12290 | // the use of compiled-in tables, forcing a rebuild of the tables at runtime. |
| 12291 | bool _upb_DefPool_LoadDefInitEx(upb_DefPool* s, const _upb_DefPool_Init* init, |
| 12292 | bool rebuild_minitable); |
| 12293 | |
| 12294 | #ifdef __cplusplus |
| 12295 | } /* extern "C" */ |
| 12296 | #endif |
| 12297 | |
| 12298 | |
| 12299 | #endif /* UPB_REFLECTION_DEF_POOL_INTERNAL_H_ */ |
| 12300 | |
Protobuf Team Bot | 7be2a45 | 2023-09-13 16:50:05 +0000 | [diff] [blame] | 12301 | #ifndef UPB_REFLECTION_DEF_BUILDER_INTERNAL_H_ |
| 12302 | #define UPB_REFLECTION_DEF_BUILDER_INTERNAL_H_ |
| 12303 | |
| 12304 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12305 | // Must be last. |
| 12306 | |
| 12307 | // We want to copy the options verbatim into the destination options proto. |
| 12308 | // We use serialize+parse as our deep copy. |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 12309 | #define UPB_DEF_SET_OPTIONS(target, desc_type, options_type, proto) \ |
| 12310 | if (UPB_DESC(desc_type##_has_options)(proto)) { \ |
| 12311 | size_t size; \ |
| 12312 | char* pb = UPB_DESC(options_type##_serialize)( \ |
| 12313 | UPB_DESC(desc_type##_options)(proto), ctx->tmp_arena, &size); \ |
| 12314 | if (!pb) _upb_DefBuilder_OomErr(ctx); \ |
| 12315 | target = \ |
| 12316 | UPB_DESC(options_type##_parse)(pb, size, _upb_DefBuilder_Arena(ctx)); \ |
| 12317 | if (!target) _upb_DefBuilder_OomErr(ctx); \ |
| 12318 | } else { \ |
| 12319 | target = (const UPB_DESC(options_type)*)kUpbDefOptDefault; \ |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12320 | } |
| 12321 | |
| 12322 | #ifdef __cplusplus |
| 12323 | extern "C" { |
| 12324 | #endif |
| 12325 | |
| 12326 | struct upb_DefBuilder { |
| 12327 | upb_DefPool* symtab; |
| 12328 | upb_FileDef* file; // File we are building. |
| 12329 | upb_Arena* arena; // Allocate defs here. |
| 12330 | upb_Arena* tmp_arena; // For temporary allocations. |
| 12331 | upb_Status* status; // Record errors here. |
| 12332 | const upb_MiniTableFile* layout; // NULL if we should build layouts. |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 12333 | upb_MiniTablePlatform platform; // Platform we are targeting. |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12334 | int enum_count; // Count of enums built so far. |
| 12335 | int msg_count; // Count of messages built so far. |
| 12336 | int ext_count; // Count of extensions built so far. |
| 12337 | jmp_buf err; // longjmp() on error. |
| 12338 | }; |
| 12339 | |
| 12340 | extern const char* kUpbDefOptDefault; |
| 12341 | |
| 12342 | // ctx->status has already been set elsewhere so just fail/longjmp() |
| 12343 | UPB_NORETURN void _upb_DefBuilder_FailJmp(upb_DefBuilder* ctx); |
| 12344 | |
| 12345 | UPB_NORETURN void _upb_DefBuilder_Errf(upb_DefBuilder* ctx, const char* fmt, |
| 12346 | ...) UPB_PRINTF(2, 3); |
| 12347 | UPB_NORETURN void _upb_DefBuilder_OomErr(upb_DefBuilder* ctx); |
| 12348 | |
| 12349 | const char* _upb_DefBuilder_MakeFullName(upb_DefBuilder* ctx, |
| 12350 | const char* prefix, |
| 12351 | upb_StringView name); |
| 12352 | |
| 12353 | // Given a symbol and the base symbol inside which it is defined, |
| 12354 | // find the symbol's definition. |
| 12355 | const void* _upb_DefBuilder_ResolveAny(upb_DefBuilder* ctx, |
| 12356 | const char* from_name_dbg, |
| 12357 | const char* base, upb_StringView sym, |
| 12358 | upb_deftype_t* type); |
| 12359 | |
| 12360 | const void* _upb_DefBuilder_Resolve(upb_DefBuilder* ctx, |
| 12361 | const char* from_name_dbg, const char* base, |
| 12362 | upb_StringView sym, upb_deftype_t type); |
| 12363 | |
| 12364 | char _upb_DefBuilder_ParseEscape(upb_DefBuilder* ctx, const upb_FieldDef* f, |
| 12365 | const char** src, const char* end); |
| 12366 | |
| 12367 | const char* _upb_DefBuilder_FullToShort(const char* fullname); |
| 12368 | |
| 12369 | UPB_INLINE void* _upb_DefBuilder_Alloc(upb_DefBuilder* ctx, size_t bytes) { |
| 12370 | if (bytes == 0) return NULL; |
| 12371 | void* ret = upb_Arena_Malloc(ctx->arena, bytes); |
| 12372 | if (!ret) _upb_DefBuilder_OomErr(ctx); |
| 12373 | return ret; |
| 12374 | } |
| 12375 | |
| 12376 | // Adds a symbol |v| to the symtab, which must be a def pointer previously |
| 12377 | // packed with pack_def(). The def's pointer to upb_FileDef* must be set before |
| 12378 | // adding, so we know which entries to remove if building this file fails. |
| 12379 | UPB_INLINE void _upb_DefBuilder_Add(upb_DefBuilder* ctx, const char* name, |
| 12380 | upb_value v) { |
| 12381 | upb_StringView sym = {.data = name, .size = strlen(name)}; |
| 12382 | bool ok = _upb_DefPool_InsertSym(ctx->symtab, sym, v, ctx->status); |
| 12383 | if (!ok) _upb_DefBuilder_FailJmp(ctx); |
| 12384 | } |
| 12385 | |
| 12386 | UPB_INLINE upb_Arena* _upb_DefBuilder_Arena(const upb_DefBuilder* ctx) { |
| 12387 | return ctx->arena; |
| 12388 | } |
| 12389 | |
| 12390 | UPB_INLINE upb_FileDef* _upb_DefBuilder_File(const upb_DefBuilder* ctx) { |
| 12391 | return ctx->file; |
| 12392 | } |
| 12393 | |
| 12394 | // This version of CheckIdent() is only called by other, faster versions after |
| 12395 | // they detect a parsing error. |
| 12396 | void _upb_DefBuilder_CheckIdentSlow(upb_DefBuilder* ctx, upb_StringView name, |
| 12397 | bool full); |
| 12398 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12399 | // Verify a full identifier string. This is slightly more complicated than |
| 12400 | // verifying a relative identifier string because we must track '.' chars. |
| 12401 | UPB_INLINE void _upb_DefBuilder_CheckIdentFull(upb_DefBuilder* ctx, |
| 12402 | upb_StringView name) { |
| 12403 | bool good = name.size > 0; |
| 12404 | bool start = true; |
| 12405 | |
| 12406 | for (size_t i = 0; i < name.size; i++) { |
| 12407 | const char c = name.data[i]; |
| 12408 | const char d = c | 0x20; // force lowercase |
| 12409 | const bool is_alpha = (('a' <= d) & (d <= 'z')) | (c == '_'); |
| 12410 | const bool is_numer = ('0' <= c) & (c <= '9') & !start; |
| 12411 | const bool is_dot = (c == '.') & !start; |
| 12412 | |
| 12413 | good &= is_alpha | is_numer | is_dot; |
| 12414 | start = is_dot; |
| 12415 | } |
| 12416 | |
| 12417 | if (!good) _upb_DefBuilder_CheckIdentSlow(ctx, name, true); |
| 12418 | } |
| 12419 | |
| 12420 | #ifdef __cplusplus |
| 12421 | } /* extern "C" */ |
| 12422 | #endif |
| 12423 | |
| 12424 | |
| 12425 | #endif /* UPB_REFLECTION_DEF_BUILDER_INTERNAL_H_ */ |
| 12426 | |
| 12427 | #ifndef UPB_REFLECTION_ENUM_DEF_INTERNAL_H_ |
| 12428 | #define UPB_REFLECTION_ENUM_DEF_INTERNAL_H_ |
| 12429 | |
| 12430 | |
| 12431 | // Must be last. |
| 12432 | |
| 12433 | #ifdef __cplusplus |
| 12434 | extern "C" { |
| 12435 | #endif |
| 12436 | |
| 12437 | upb_EnumDef* _upb_EnumDef_At(const upb_EnumDef* e, int i); |
| 12438 | bool _upb_EnumDef_Insert(upb_EnumDef* e, upb_EnumValueDef* v, upb_Arena* a); |
| 12439 | const upb_MiniTableEnum* _upb_EnumDef_MiniTable(const upb_EnumDef* e); |
| 12440 | |
| 12441 | // Allocate and initialize an array of |n| enum defs. |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 12442 | upb_EnumDef* _upb_EnumDefs_New( |
| 12443 | upb_DefBuilder* ctx, int n, |
| 12444 | const UPB_DESC(EnumDescriptorProto) * const* protos, |
| 12445 | const upb_MessageDef* containing_type); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12446 | |
| 12447 | #ifdef __cplusplus |
| 12448 | } /* extern "C" */ |
| 12449 | #endif |
| 12450 | |
| 12451 | |
| 12452 | #endif /* UPB_REFLECTION_ENUM_DEF_INTERNAL_H_ */ |
| 12453 | |
| 12454 | #ifndef UPB_REFLECTION_ENUM_VALUE_DEF_INTERNAL_H_ |
| 12455 | #define UPB_REFLECTION_ENUM_VALUE_DEF_INTERNAL_H_ |
| 12456 | |
| 12457 | |
| 12458 | // Must be last. |
| 12459 | |
| 12460 | #ifdef __cplusplus |
| 12461 | extern "C" { |
| 12462 | #endif |
| 12463 | |
| 12464 | upb_EnumValueDef* _upb_EnumValueDef_At(const upb_EnumValueDef* v, int i); |
| 12465 | |
| 12466 | // Allocate and initialize an array of |n| enum value defs owned by |e|. |
| 12467 | upb_EnumValueDef* _upb_EnumValueDefs_New( |
| 12468 | upb_DefBuilder* ctx, const char* prefix, int n, |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 12469 | const UPB_DESC(EnumValueDescriptorProto) * const* protos, upb_EnumDef* e, |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12470 | bool* is_sorted); |
| 12471 | |
| 12472 | const upb_EnumValueDef** _upb_EnumValueDefs_Sorted(const upb_EnumValueDef* v, |
| 12473 | int n, upb_Arena* a); |
| 12474 | |
| 12475 | #ifdef __cplusplus |
| 12476 | } /* extern "C" */ |
| 12477 | #endif |
| 12478 | |
| 12479 | |
| 12480 | #endif /* UPB_REFLECTION_ENUM_VALUE_DEF_INTERNAL_H_ */ |
| 12481 | |
| 12482 | #ifndef UPB_REFLECTION_FIELD_DEF_INTERNAL_H_ |
| 12483 | #define UPB_REFLECTION_FIELD_DEF_INTERNAL_H_ |
| 12484 | |
| 12485 | |
| 12486 | // Must be last. |
| 12487 | |
| 12488 | #ifdef __cplusplus |
| 12489 | extern "C" { |
| 12490 | #endif |
| 12491 | |
| 12492 | upb_FieldDef* _upb_FieldDef_At(const upb_FieldDef* f, int i); |
| 12493 | |
| 12494 | const upb_MiniTableExtension* _upb_FieldDef_ExtensionMiniTable( |
| 12495 | const upb_FieldDef* f); |
| 12496 | bool _upb_FieldDef_IsClosedEnum(const upb_FieldDef* f); |
| 12497 | bool _upb_FieldDef_IsProto3Optional(const upb_FieldDef* f); |
| 12498 | int _upb_FieldDef_LayoutIndex(const upb_FieldDef* f); |
| 12499 | uint64_t _upb_FieldDef_Modifiers(const upb_FieldDef* f); |
| 12500 | void _upb_FieldDef_Resolve(upb_DefBuilder* ctx, const char* prefix, |
| 12501 | upb_FieldDef* f); |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 12502 | void _upb_FieldDef_BuildMiniTableExtension(upb_DefBuilder* ctx, |
| 12503 | const upb_FieldDef* f); |
| 12504 | |
| 12505 | // Allocate and initialize an array of |n| extensions (field defs). |
| 12506 | upb_FieldDef* _upb_Extensions_New( |
| 12507 | upb_DefBuilder* ctx, int n, |
| 12508 | const UPB_DESC(FieldDescriptorProto) * const* protos, const char* prefix, |
| 12509 | upb_MessageDef* m); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12510 | |
| 12511 | // Allocate and initialize an array of |n| field defs. |
| 12512 | upb_FieldDef* _upb_FieldDefs_New( |
| 12513 | upb_DefBuilder* ctx, int n, |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 12514 | const UPB_DESC(FieldDescriptorProto) * const* protos, const char* prefix, |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12515 | upb_MessageDef* m, bool* is_sorted); |
| 12516 | |
| 12517 | // Allocate and return a list of pointers to the |n| field defs in |ff|, |
| 12518 | // sorted by field number. |
| 12519 | const upb_FieldDef** _upb_FieldDefs_Sorted(const upb_FieldDef* f, int n, |
| 12520 | upb_Arena* a); |
| 12521 | |
| 12522 | #ifdef __cplusplus |
| 12523 | } /* extern "C" */ |
| 12524 | #endif |
| 12525 | |
| 12526 | |
| 12527 | #endif /* UPB_REFLECTION_FIELD_DEF_INTERNAL_H_ */ |
| 12528 | |
| 12529 | #ifndef UPB_REFLECTION_FILE_DEF_INTERNAL_H_ |
| 12530 | #define UPB_REFLECTION_FILE_DEF_INTERNAL_H_ |
| 12531 | |
| 12532 | |
| 12533 | // Must be last. |
| 12534 | |
| 12535 | #ifdef __cplusplus |
| 12536 | extern "C" { |
| 12537 | #endif |
| 12538 | |
| 12539 | const upb_MiniTableExtension* _upb_FileDef_ExtensionMiniTable( |
| 12540 | const upb_FileDef* f, int i); |
| 12541 | const int32_t* _upb_FileDef_PublicDependencyIndexes(const upb_FileDef* f); |
| 12542 | const int32_t* _upb_FileDef_WeakDependencyIndexes(const upb_FileDef* f); |
| 12543 | |
| 12544 | // upb_FileDef_Package() returns "" if f->package is NULL, this does not. |
| 12545 | const char* _upb_FileDef_RawPackage(const upb_FileDef* f); |
| 12546 | |
| 12547 | void _upb_FileDef_Create(upb_DefBuilder* ctx, |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 12548 | const UPB_DESC(FileDescriptorProto) * file_proto); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12549 | |
| 12550 | #ifdef __cplusplus |
| 12551 | } /* extern "C" */ |
| 12552 | #endif |
| 12553 | |
| 12554 | |
| 12555 | #endif /* UPB_REFLECTION_FILE_DEF_INTERNAL_H_ */ |
| 12556 | |
| 12557 | #ifndef UPB_REFLECTION_MESSAGE_DEF_INTERNAL_H_ |
| 12558 | #define UPB_REFLECTION_MESSAGE_DEF_INTERNAL_H_ |
| 12559 | |
| 12560 | |
| 12561 | // Must be last. |
| 12562 | |
| 12563 | #ifdef __cplusplus |
| 12564 | extern "C" { |
| 12565 | #endif |
| 12566 | |
| 12567 | upb_MessageDef* _upb_MessageDef_At(const upb_MessageDef* m, int i); |
| 12568 | bool _upb_MessageDef_InMessageSet(const upb_MessageDef* m); |
| 12569 | bool _upb_MessageDef_Insert(upb_MessageDef* m, const char* name, size_t size, |
| 12570 | upb_value v, upb_Arena* a); |
| 12571 | void _upb_MessageDef_InsertField(upb_DefBuilder* ctx, upb_MessageDef* m, |
| 12572 | const upb_FieldDef* f); |
| 12573 | bool _upb_MessageDef_IsValidExtensionNumber(const upb_MessageDef* m, int n); |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 12574 | void _upb_MessageDef_CreateMiniTable(upb_DefBuilder* ctx, upb_MessageDef* m); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12575 | void _upb_MessageDef_LinkMiniTable(upb_DefBuilder* ctx, |
| 12576 | const upb_MessageDef* m); |
| 12577 | void _upb_MessageDef_Resolve(upb_DefBuilder* ctx, upb_MessageDef* m); |
| 12578 | |
| 12579 | // Allocate and initialize an array of |n| message defs. |
| 12580 | upb_MessageDef* _upb_MessageDefs_New( |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 12581 | upb_DefBuilder* ctx, int n, const UPB_DESC(DescriptorProto) * const* protos, |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12582 | const upb_MessageDef* containing_type); |
| 12583 | |
| 12584 | #ifdef __cplusplus |
| 12585 | } /* extern "C" */ |
| 12586 | #endif |
| 12587 | |
| 12588 | |
| 12589 | #endif /* UPB_REFLECTION_MESSAGE_DEF_INTERNAL_H_ */ |
| 12590 | |
| 12591 | #ifndef UPB_REFLECTION_SERVICE_DEF_INTERNAL_H_ |
| 12592 | #define UPB_REFLECTION_SERVICE_DEF_INTERNAL_H_ |
| 12593 | |
| 12594 | |
| 12595 | // Must be last. |
| 12596 | |
| 12597 | #ifdef __cplusplus |
| 12598 | extern "C" { |
| 12599 | #endif |
| 12600 | |
| 12601 | upb_ServiceDef* _upb_ServiceDef_At(const upb_ServiceDef* s, int i); |
| 12602 | |
| 12603 | // Allocate and initialize an array of |n| service defs. |
| 12604 | upb_ServiceDef* _upb_ServiceDefs_New( |
| 12605 | upb_DefBuilder* ctx, int n, |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 12606 | const UPB_DESC(ServiceDescriptorProto) * const* protos); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12607 | |
| 12608 | #ifdef __cplusplus |
| 12609 | } /* extern "C" */ |
| 12610 | #endif |
| 12611 | |
| 12612 | |
| 12613 | #endif /* UPB_REFLECTION_SERVICE_DEF_INTERNAL_H_ */ |
| 12614 | |
| 12615 | #ifndef UPB_REFLECTION_DESC_STATE_INTERNAL_H_ |
| 12616 | #define UPB_REFLECTION_DESC_STATE_INTERNAL_H_ |
| 12617 | |
| 12618 | |
| 12619 | // Must be last. |
| 12620 | |
| 12621 | // Manages the storage for mini descriptor strings as they are being encoded. |
Protobuf Team Bot | 986cbb6 | 2023-09-19 15:03:51 +0000 | [diff] [blame] | 12622 | // TODO: Move some of this state directly into the encoder, maybe. |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12623 | typedef struct { |
| 12624 | upb_MtDataEncoder e; |
| 12625 | size_t bufsize; |
| 12626 | char* buf; |
| 12627 | char* ptr; |
| 12628 | } upb_DescState; |
| 12629 | |
| 12630 | #ifdef __cplusplus |
| 12631 | extern "C" { |
| 12632 | #endif |
| 12633 | |
| 12634 | UPB_INLINE void _upb_DescState_Init(upb_DescState* d) { |
| 12635 | d->bufsize = kUpb_MtDataEncoder_MinSize * 2; |
| 12636 | d->buf = NULL; |
| 12637 | d->ptr = NULL; |
| 12638 | } |
| 12639 | |
| 12640 | bool _upb_DescState_Grow(upb_DescState* d, upb_Arena* a); |
| 12641 | |
| 12642 | #ifdef __cplusplus |
| 12643 | } /* extern "C" */ |
| 12644 | #endif |
| 12645 | |
| 12646 | |
| 12647 | #endif /* UPB_REFLECTION_DESC_STATE_INTERNAL_H_ */ |
| 12648 | |
| 12649 | #ifndef UPB_REFLECTION_ENUM_RESERVED_RANGE_INTERNAL_H_ |
| 12650 | #define UPB_REFLECTION_ENUM_RESERVED_RANGE_INTERNAL_H_ |
| 12651 | |
| 12652 | |
Protobuf Team Bot | 0631035 | 2023-09-26 21:54:58 +0000 | [diff] [blame] | 12653 | // IWYU pragma: private, include "upb/reflection/def.h" |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12654 | |
| 12655 | #ifndef UPB_REFLECTION_ENUM_RESERVED_RANGE_H_ |
| 12656 | #define UPB_REFLECTION_ENUM_RESERVED_RANGE_H_ |
| 12657 | |
| 12658 | |
| 12659 | // Must be last. |
| 12660 | |
| 12661 | #ifdef __cplusplus |
| 12662 | extern "C" { |
| 12663 | #endif |
| 12664 | |
| 12665 | int32_t upb_EnumReservedRange_Start(const upb_EnumReservedRange* r); |
| 12666 | int32_t upb_EnumReservedRange_End(const upb_EnumReservedRange* r); |
| 12667 | |
| 12668 | #ifdef __cplusplus |
| 12669 | } /* extern "C" */ |
| 12670 | #endif |
| 12671 | |
| 12672 | |
| 12673 | #endif /* UPB_REFLECTION_ENUM_RESERVED_RANGE_H_ */ |
| 12674 | |
| 12675 | // Must be last. |
| 12676 | |
| 12677 | #ifdef __cplusplus |
| 12678 | extern "C" { |
| 12679 | #endif |
| 12680 | |
| 12681 | upb_EnumReservedRange* _upb_EnumReservedRange_At(const upb_EnumReservedRange* r, |
| 12682 | int i); |
| 12683 | |
| 12684 | // Allocate and initialize an array of |n| reserved ranges owned by |e|. |
| 12685 | upb_EnumReservedRange* _upb_EnumReservedRanges_New( |
| 12686 | upb_DefBuilder* ctx, int n, |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 12687 | const UPB_DESC(EnumDescriptorProto_EnumReservedRange) * const* protos, |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12688 | const upb_EnumDef* e); |
| 12689 | |
| 12690 | #ifdef __cplusplus |
| 12691 | } /* extern "C" */ |
| 12692 | #endif |
| 12693 | |
| 12694 | |
| 12695 | #endif /* UPB_REFLECTION_ENUM_RESERVED_RANGE_INTERNAL_H_ */ |
| 12696 | |
Protobuf Team Bot | 7be2a45 | 2023-09-13 16:50:05 +0000 | [diff] [blame] | 12697 | #ifndef UPB_REFLECTION_INTERNAL_STRDUP2_H_ |
| 12698 | #define UPB_REFLECTION_INTERNAL_STRDUP2_H_ |
| 12699 | |
| 12700 | #include <stddef.h> |
| 12701 | |
| 12702 | |
| 12703 | // Must be last. |
| 12704 | |
| 12705 | #ifdef __cplusplus |
| 12706 | extern "C" { |
| 12707 | #endif |
| 12708 | |
| 12709 | // Variant that works with a length-delimited rather than NULL-delimited string, |
| 12710 | // as supported by strtable. |
| 12711 | char* upb_strdup2(const char* s, size_t len, upb_Arena* a); |
| 12712 | |
| 12713 | #ifdef __cplusplus |
| 12714 | } /* extern "C" */ |
| 12715 | #endif |
| 12716 | |
| 12717 | |
| 12718 | #endif /* UPB_REFLECTION_INTERNAL_STRDUP2_H_ */ |
| 12719 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12720 | #ifndef UPB_REFLECTION_EXTENSION_RANGE_INTERNAL_H_ |
| 12721 | #define UPB_REFLECTION_EXTENSION_RANGE_INTERNAL_H_ |
| 12722 | |
| 12723 | |
| 12724 | // Must be last. |
| 12725 | |
| 12726 | #ifdef __cplusplus |
| 12727 | extern "C" { |
| 12728 | #endif |
| 12729 | |
| 12730 | upb_ExtensionRange* _upb_ExtensionRange_At(const upb_ExtensionRange* r, int i); |
| 12731 | |
| 12732 | // Allocate and initialize an array of |n| extension ranges owned by |m|. |
| 12733 | upb_ExtensionRange* _upb_ExtensionRanges_New( |
| 12734 | upb_DefBuilder* ctx, int n, |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 12735 | const UPB_DESC(DescriptorProto_ExtensionRange) * const* protos, |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12736 | const upb_MessageDef* m); |
| 12737 | |
| 12738 | #ifdef __cplusplus |
| 12739 | } /* extern "C" */ |
| 12740 | #endif |
| 12741 | |
| 12742 | |
| 12743 | #endif /* UPB_REFLECTION_EXTENSION_RANGE_INTERNAL_H_ */ |
| 12744 | |
| 12745 | #ifndef UPB_REFLECTION_ONEOF_DEF_INTERNAL_H_ |
| 12746 | #define UPB_REFLECTION_ONEOF_DEF_INTERNAL_H_ |
| 12747 | |
| 12748 | |
| 12749 | // Must be last. |
| 12750 | |
| 12751 | #ifdef __cplusplus |
| 12752 | extern "C" { |
| 12753 | #endif |
| 12754 | |
| 12755 | upb_OneofDef* _upb_OneofDef_At(const upb_OneofDef* o, int i); |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 12756 | void _upb_OneofDef_Insert(upb_DefBuilder* ctx, upb_OneofDef* o, |
| 12757 | const upb_FieldDef* f, const char* name, size_t size); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12758 | |
| 12759 | // Allocate and initialize an array of |n| oneof defs owned by |m|. |
| 12760 | upb_OneofDef* _upb_OneofDefs_New( |
| 12761 | upb_DefBuilder* ctx, int n, |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 12762 | const UPB_DESC(OneofDescriptorProto) * const* protos, upb_MessageDef* m); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12763 | |
| 12764 | size_t _upb_OneofDefs_Finalize(upb_DefBuilder* ctx, upb_MessageDef* m); |
| 12765 | |
| 12766 | #ifdef __cplusplus |
| 12767 | } /* extern "C" */ |
| 12768 | #endif |
| 12769 | |
| 12770 | |
| 12771 | #endif /* UPB_REFLECTION_ONEOF_DEF_INTERNAL_H_ */ |
| 12772 | |
| 12773 | #ifndef UPB_REFLECTION_MESSAGE_RESERVED_RANGE_INTERNAL_H_ |
| 12774 | #define UPB_REFLECTION_MESSAGE_RESERVED_RANGE_INTERNAL_H_ |
| 12775 | |
| 12776 | |
Protobuf Team Bot | 0631035 | 2023-09-26 21:54:58 +0000 | [diff] [blame] | 12777 | // IWYU pragma: private, include "upb/reflection/def.h" |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12778 | |
| 12779 | #ifndef UPB_REFLECTION_MESSAGE_RESERVED_RANGE_H_ |
| 12780 | #define UPB_REFLECTION_MESSAGE_RESERVED_RANGE_H_ |
| 12781 | |
| 12782 | |
| 12783 | // Must be last. |
| 12784 | |
| 12785 | #ifdef __cplusplus |
| 12786 | extern "C" { |
| 12787 | #endif |
| 12788 | |
| 12789 | int32_t upb_MessageReservedRange_Start(const upb_MessageReservedRange* r); |
| 12790 | int32_t upb_MessageReservedRange_End(const upb_MessageReservedRange* r); |
| 12791 | |
| 12792 | #ifdef __cplusplus |
| 12793 | } /* extern "C" */ |
| 12794 | #endif |
| 12795 | |
| 12796 | |
| 12797 | #endif /* UPB_REFLECTION_MESSAGE_RESERVED_RANGE_H_ */ |
| 12798 | |
| 12799 | // Must be last. |
| 12800 | |
| 12801 | #ifdef __cplusplus |
| 12802 | extern "C" { |
| 12803 | #endif |
| 12804 | |
| 12805 | upb_MessageReservedRange* _upb_MessageReservedRange_At( |
| 12806 | const upb_MessageReservedRange* r, int i); |
| 12807 | |
| 12808 | // Allocate and initialize an array of |n| reserved ranges owned by |m|. |
| 12809 | upb_MessageReservedRange* _upb_MessageReservedRanges_New( |
| 12810 | upb_DefBuilder* ctx, int n, |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 12811 | const UPB_DESC(DescriptorProto_ReservedRange) * const* protos, |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12812 | const upb_MessageDef* m); |
| 12813 | |
| 12814 | #ifdef __cplusplus |
| 12815 | } /* extern "C" */ |
| 12816 | #endif |
| 12817 | |
| 12818 | |
| 12819 | #endif /* UPB_REFLECTION_MESSAGE_RESERVED_RANGE_INTERNAL_H_ */ |
| 12820 | |
| 12821 | #ifndef UPB_REFLECTION_METHOD_DEF_INTERNAL_H_ |
| 12822 | #define UPB_REFLECTION_METHOD_DEF_INTERNAL_H_ |
| 12823 | |
| 12824 | |
| 12825 | // Must be last. |
| 12826 | |
| 12827 | #ifdef __cplusplus |
| 12828 | extern "C" { |
| 12829 | #endif |
| 12830 | |
| 12831 | upb_MethodDef* _upb_MethodDef_At(const upb_MethodDef* m, int i); |
| 12832 | |
| 12833 | // Allocate and initialize an array of |n| method defs owned by |s|. |
| 12834 | upb_MethodDef* _upb_MethodDefs_New( |
| 12835 | upb_DefBuilder* ctx, int n, |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 12836 | const UPB_DESC(MethodDescriptorProto) * const* protos, upb_ServiceDef* s); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12837 | |
| 12838 | #ifdef __cplusplus |
| 12839 | } /* extern "C" */ |
| 12840 | #endif |
| 12841 | |
| 12842 | |
| 12843 | #endif /* UPB_REFLECTION_METHOD_DEF_INTERNAL_H_ */ |
| 12844 | |
Protobuf Team Bot | 743bf92 | 2023-09-14 01:12:11 +0000 | [diff] [blame] | 12845 | #ifndef UPB_WIRE_INTERNAL_CONSTANTS_H_ |
| 12846 | #define UPB_WIRE_INTERNAL_CONSTANTS_H_ |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12847 | |
Protobuf Team Bot | 743bf92 | 2023-09-14 01:12:11 +0000 | [diff] [blame] | 12848 | #define kUpb_WireFormat_DefaultDepthLimit 100 |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12849 | |
| 12850 | // MessageSet wire format is: |
| 12851 | // message MessageSet { |
| 12852 | // repeated group Item = 1 { |
| 12853 | // required int32 type_id = 2; |
| 12854 | // required bytes message = 3; |
| 12855 | // } |
| 12856 | // } |
| 12857 | |
| 12858 | enum { |
| 12859 | kUpb_MsgSet_Item = 1, |
| 12860 | kUpb_MsgSet_TypeId = 2, |
| 12861 | kUpb_MsgSet_Message = 3, |
| 12862 | }; |
| 12863 | |
Protobuf Team Bot | 743bf92 | 2023-09-14 01:12:11 +0000 | [diff] [blame] | 12864 | #endif /* UPB_WIRE_INTERNAL_CONSTANTS_H_ */ |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12865 | |
| 12866 | /* |
| 12867 | * Internal implementation details of the decoder that are shared between |
| 12868 | * decode.c and decode_fast.c. |
| 12869 | */ |
| 12870 | |
Sandy Zhang | e3b0943 | 2023-08-07 09:30:02 -0700 | [diff] [blame] | 12871 | #ifndef UPB_WIRE_INTERNAL_DECODE_H_ |
| 12872 | #define UPB_WIRE_INTERNAL_DECODE_H_ |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12873 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 12874 | #include "utf8_range.h" |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 12875 | |
| 12876 | // Must be last. |
| 12877 | |
| 12878 | #define DECODE_NOGROUP (uint32_t) - 1 |
| 12879 | |
| 12880 | typedef struct upb_Decoder { |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 12881 | upb_EpsCopyInputStream input; |
| 12882 | const upb_ExtensionRegistry* extreg; |
| 12883 | const char* unknown; // Start of unknown data, preserve at buffer flip |
| 12884 | upb_Message* unknown_msg; // Pointer to preserve data to |
| 12885 | int depth; // Tracks recursion depth to bound stack usage. |
| 12886 | 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] | 12887 | uint16_t options; |
| 12888 | bool missing_required; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 12889 | upb_Arena arena; |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 12890 | upb_DecodeStatus status; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 12891 | jmp_buf err; |
| 12892 | |
| 12893 | #ifndef NDEBUG |
| 12894 | const char* debug_tagstart; |
| 12895 | const char* debug_valstart; |
| 12896 | #endif |
| 12897 | } upb_Decoder; |
| 12898 | |
| 12899 | /* Error function that will abort decoding with longjmp(). We can't declare this |
| 12900 | * UPB_NORETURN, even though it is appropriate, because if we do then compilers |
| 12901 | * will "helpfully" refuse to tailcall to it |
| 12902 | * (see: https://stackoverflow.com/a/55657013), which will defeat a major goal |
| 12903 | * of our optimizations. That is also why we must declare it in a separate file, |
| 12904 | * otherwise the compiler will see that it calls longjmp() and deduce that it is |
| 12905 | * noreturn. */ |
| 12906 | const char* _upb_FastDecoder_ErrorJmp(upb_Decoder* d, int status); |
| 12907 | |
| 12908 | extern const uint8_t upb_utf8_offsets[]; |
| 12909 | |
| 12910 | UPB_INLINE |
| 12911 | bool _upb_Decoder_VerifyUtf8Inline(const char* ptr, int len) { |
| 12912 | const char* end = ptr + len; |
| 12913 | |
| 12914 | // Check 8 bytes at a time for any non-ASCII char. |
| 12915 | while (end - ptr >= 8) { |
| 12916 | uint64_t data; |
| 12917 | memcpy(&data, ptr, 8); |
| 12918 | if (data & 0x8080808080808080) goto non_ascii; |
| 12919 | ptr += 8; |
| 12920 | } |
| 12921 | |
| 12922 | // Check one byte at a time for non-ASCII. |
| 12923 | while (ptr < end) { |
| 12924 | if (*ptr & 0x80) goto non_ascii; |
| 12925 | ptr++; |
| 12926 | } |
| 12927 | |
| 12928 | return true; |
| 12929 | |
| 12930 | non_ascii: |
| 12931 | return utf8_range2((const unsigned char*)ptr, end - ptr) == 0; |
| 12932 | } |
| 12933 | |
| 12934 | const char* _upb_Decoder_CheckRequired(upb_Decoder* d, const char* ptr, |
| 12935 | const upb_Message* msg, |
| 12936 | const upb_MiniTable* l); |
| 12937 | |
| 12938 | /* x86-64 pointers always have the high 16 bits matching. So we can shift |
| 12939 | * left 8 and right 8 without loss of information. */ |
| 12940 | UPB_INLINE intptr_t decode_totable(const upb_MiniTable* tablep) { |
| 12941 | return ((intptr_t)tablep << 8) | tablep->table_mask; |
| 12942 | } |
| 12943 | |
| 12944 | UPB_INLINE const upb_MiniTable* decode_totablep(intptr_t table) { |
| 12945 | return (const upb_MiniTable*)(table >> 8); |
| 12946 | } |
| 12947 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 12948 | const char* _upb_Decoder_IsDoneFallback(upb_EpsCopyInputStream* e, |
| 12949 | const char* ptr, int overrun); |
| 12950 | |
| 12951 | UPB_INLINE bool _upb_Decoder_IsDone(upb_Decoder* d, const char** ptr) { |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 12952 | return upb_EpsCopyInputStream_IsDoneWithCallback( |
| 12953 | &d->input, ptr, &_upb_Decoder_IsDoneFallback); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 12954 | } |
| 12955 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 12956 | UPB_INLINE const char* _upb_Decoder_BufferFlipCallback( |
| 12957 | upb_EpsCopyInputStream* e, const char* old_end, const char* new_start) { |
| 12958 | upb_Decoder* d = (upb_Decoder*)e; |
| 12959 | if (!old_end) _upb_FastDecoder_ErrorJmp(d, kUpb_DecodeStatus_Malformed); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 12960 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 12961 | if (d->unknown) { |
| 12962 | if (!_upb_Message_AddUnknown(d->unknown_msg, d->unknown, |
| 12963 | old_end - d->unknown, &d->arena)) { |
| 12964 | _upb_FastDecoder_ErrorJmp(d, kUpb_DecodeStatus_OutOfMemory); |
| 12965 | } |
| 12966 | d->unknown = new_start; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 12967 | } |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 12968 | return new_start; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 12969 | } |
| 12970 | |
| 12971 | #if UPB_FASTTABLE |
| 12972 | UPB_INLINE |
| 12973 | const char* _upb_FastDecoder_TagDispatch(upb_Decoder* d, const char* ptr, |
| 12974 | upb_Message* msg, intptr_t table, |
| 12975 | uint64_t hasbits, uint64_t tag) { |
| 12976 | const upb_MiniTable* table_p = decode_totablep(table); |
| 12977 | uint8_t mask = table; |
| 12978 | uint64_t data; |
| 12979 | size_t idx = tag & mask; |
| 12980 | UPB_ASSUME((idx & 7) == 0); |
| 12981 | idx >>= 3; |
| 12982 | data = table_p->fasttable[idx].field_data ^ tag; |
| 12983 | UPB_MUSTTAIL return table_p->fasttable[idx].field_parser(d, ptr, msg, table, |
| 12984 | hasbits, data); |
| 12985 | } |
| 12986 | #endif |
| 12987 | |
| 12988 | UPB_INLINE uint32_t _upb_FastDecoder_LoadTag(const char* ptr) { |
| 12989 | uint16_t tag; |
| 12990 | memcpy(&tag, ptr, 2); |
| 12991 | return tag; |
| 12992 | } |
| 12993 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 12994 | |
Sandy Zhang | e3b0943 | 2023-08-07 09:30:02 -0700 | [diff] [blame] | 12995 | #endif /* UPB_WIRE_INTERNAL_DECODE_H_ */ |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 12996 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12997 | // This should #undef all macros #defined in def.inc |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 12998 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 12999 | #undef UPB_SIZE |
| 13000 | #undef UPB_PTR_AT |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 13001 | #undef UPB_MAPTYPE_STRING |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 13002 | #undef UPB_EXPORT |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 13003 | #undef UPB_INLINE |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 13004 | #undef UPB_API |
| 13005 | #undef UPB_API_INLINE |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 13006 | #undef UPB_ALIGN_UP |
| 13007 | #undef UPB_ALIGN_DOWN |
| 13008 | #undef UPB_ALIGN_MALLOC |
| 13009 | #undef UPB_ALIGN_OF |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 13010 | #undef UPB_MALLOC_ALIGN |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 13011 | #undef UPB_LIKELY |
| 13012 | #undef UPB_UNLIKELY |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 13013 | #undef UPB_FORCEINLINE |
| 13014 | #undef UPB_NOINLINE |
| 13015 | #undef UPB_NORETURN |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 13016 | #undef UPB_PRINTF |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 13017 | #undef UPB_MAX |
| 13018 | #undef UPB_MIN |
| 13019 | #undef UPB_UNUSED |
| 13020 | #undef UPB_ASSUME |
| 13021 | #undef UPB_ASSERT |
| 13022 | #undef UPB_UNREACHABLE |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 13023 | #undef UPB_SETJMP |
| 13024 | #undef UPB_LONGJMP |
| 13025 | #undef UPB_PTRADD |
| 13026 | #undef UPB_MUSTTAIL |
| 13027 | #undef UPB_FASTTABLE_SUPPORTED |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 13028 | #undef UPB_FASTTABLE_MASK |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 13029 | #undef UPB_FASTTABLE |
| 13030 | #undef UPB_FASTTABLE_INIT |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 13031 | #undef UPB_POISON_MEMORY_REGION |
| 13032 | #undef UPB_UNPOISON_MEMORY_REGION |
| 13033 | #undef UPB_ASAN |
Sandy Zhang | e3b0943 | 2023-08-07 09:30:02 -0700 | [diff] [blame] | 13034 | #undef UPB_ASAN_GUARD_SIZE |
| 13035 | #undef UPB_CLANG_ASAN |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 13036 | #undef UPB_TREAT_PROTO2_ENUMS_LIKE_PROTO3 |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 13037 | #undef UPB_DEPRECATED |
| 13038 | #undef UPB_GNUC_MIN |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 13039 | #undef UPB_DESCRIPTOR_UPB_H_FILENAME |
| 13040 | #undef UPB_DESC |
| 13041 | #undef UPB_IS_GOOGLE3 |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 13042 | #undef UPB_ATOMIC |
| 13043 | #undef UPB_USE_C11_ATOMICS |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 13044 | #undef UPB_PRIVATE |