Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 1 | // Ruby is still using proto3 enum semantics for proto2 |
| 2 | #define UPB_DISABLE_PROTO2_ENUM_CHECKING |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3 | /* Amalgamated source file */ |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 4 | |
| 5 | /* |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6 | * This is where we define internal portability macros used across upb. |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 7 | * |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8 | * All of these macros are undef'd in undef.inc to avoid leaking them to users. |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 9 | * |
| 10 | * The correct usage is: |
| 11 | * |
| 12 | * #include "upb/foobar.h" |
| 13 | * #include "upb/baz.h" |
| 14 | * |
| 15 | * // MUST be last included header. |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 16 | * #include "upb/port/def.inc" |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 17 | * |
| 18 | * // Code for this file. |
| 19 | * // <...> |
| 20 | * |
| 21 | * // Can be omitted for .c files, required for .h. |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 22 | * #include "upb/port/undef.inc" |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 23 | * |
| 24 | * This file is private and must not be included by users! |
| 25 | */ |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 26 | |
| 27 | #if !((defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \ |
Mike Kruskal | fd0b1a5 | 2022-10-14 16:27:22 -0700 | [diff] [blame] | 28 | (defined(__cplusplus) && __cplusplus >= 201402L) || \ |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 29 | (defined(_MSC_VER) && _MSC_VER >= 1900)) |
Mike Kruskal | fd0b1a5 | 2022-10-14 16:27:22 -0700 | [diff] [blame] | 30 | #error upb requires C99 or C++14 or MSVC >= 2015. |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 31 | #endif |
| 32 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 33 | // Portable check for GCC minimum version: |
| 34 | // https://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html |
| 35 | #if defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__GNUC_PATCHLEVEL__) |
| 36 | #define UPB_GNUC_MIN(x, y) \ |
| 37 | (__GNUC__ > (x) || __GNUC__ == (x) && __GNUC_MINOR__ >= (y)) |
| 38 | #else |
| 39 | #define UPB_GNUC_MIN(x, y) 0 |
| 40 | #endif |
| 41 | |
| 42 | #include <assert.h> |
| 43 | #include <setjmp.h> |
| 44 | #include <stdbool.h> |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 45 | #include <stddef.h> |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 46 | #include <stdint.h> |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 47 | #include <stdio.h> |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 48 | |
| 49 | #if UINTPTR_MAX == 0xffffffff |
| 50 | #define UPB_SIZE(size32, size64) size32 |
| 51 | #else |
| 52 | #define UPB_SIZE(size32, size64) size64 |
| 53 | #endif |
| 54 | |
| 55 | /* If we always read/write as a consistent type to each address, this shouldn't |
| 56 | * violate aliasing. |
| 57 | */ |
| 58 | #define UPB_PTR_AT(msg, ofs, type) ((type*)((char*)(msg) + (ofs))) |
| 59 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 60 | #define UPB_MAPTYPE_STRING 0 |
| 61 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 62 | // UPB_EXPORT: always generate a public symbol. |
| 63 | #if defined(__GNUC__) || defined(__clang__) |
| 64 | #define UPB_EXPORT __attribute__((visibility("default"))) __attribute__((used)) |
| 65 | #else |
| 66 | #define UPB_EXPORT |
| 67 | #endif |
| 68 | |
| 69 | // UPB_INLINE: inline if possible, emit standalone code if required. |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 70 | #ifdef __cplusplus |
| 71 | #define UPB_INLINE inline |
| 72 | #elif defined (__GNUC__) || defined(__clang__) |
| 73 | #define UPB_INLINE static __inline__ |
| 74 | #else |
| 75 | #define UPB_INLINE static |
| 76 | #endif |
| 77 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 78 | #ifdef UPB_BUILD_API |
| 79 | #define UPB_API UPB_EXPORT |
| 80 | #define UPB_API_INLINE UPB_EXPORT |
| 81 | #else |
| 82 | #define UPB_API |
| 83 | #define UPB_API_INLINE UPB_INLINE |
| 84 | #endif |
| 85 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 86 | #define UPB_MALLOC_ALIGN 8 |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 87 | #define UPB_ALIGN_UP(size, align) (((size) + (align) - 1) / (align) * (align)) |
| 88 | #define UPB_ALIGN_DOWN(size, align) ((size) / (align) * (align)) |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 89 | #define UPB_ALIGN_MALLOC(size) UPB_ALIGN_UP(size, UPB_MALLOC_ALIGN) |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 90 | #ifdef __clang__ |
| 91 | #define UPB_ALIGN_OF(type) _Alignof(type) |
| 92 | #else |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 93 | #define UPB_ALIGN_OF(type) offsetof (struct { char c; type member; }, member) |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 94 | #endif |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 95 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 96 | // Hints to the compiler about likely/unlikely branches. |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 97 | #if defined (__GNUC__) || defined(__clang__) |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 98 | #define UPB_LIKELY(x) __builtin_expect((bool)(x), 1) |
| 99 | #define UPB_UNLIKELY(x) __builtin_expect((bool)(x), 0) |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 100 | #else |
| 101 | #define UPB_LIKELY(x) (x) |
| 102 | #define UPB_UNLIKELY(x) (x) |
| 103 | #endif |
| 104 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 105 | // Macros for function attributes on compilers that support them. |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 106 | #ifdef __GNUC__ |
| 107 | #define UPB_FORCEINLINE __inline__ __attribute__((always_inline)) |
| 108 | #define UPB_NOINLINE __attribute__((noinline)) |
| 109 | #define UPB_NORETURN __attribute__((__noreturn__)) |
| 110 | #define UPB_PRINTF(str, first_vararg) __attribute__((format (printf, str, first_vararg))) |
| 111 | #elif defined(_MSC_VER) |
| 112 | #define UPB_NOINLINE |
| 113 | #define UPB_FORCEINLINE |
| 114 | #define UPB_NORETURN __declspec(noreturn) |
| 115 | #define UPB_PRINTF(str, first_vararg) |
| 116 | #else /* !defined(__GNUC__) */ |
| 117 | #define UPB_FORCEINLINE |
| 118 | #define UPB_NOINLINE |
| 119 | #define UPB_NORETURN |
| 120 | #define UPB_PRINTF(str, first_vararg) |
| 121 | #endif |
| 122 | |
| 123 | #define UPB_MAX(x, y) ((x) > (y) ? (x) : (y)) |
| 124 | #define UPB_MIN(x, y) ((x) < (y) ? (x) : (y)) |
| 125 | |
| 126 | #define UPB_UNUSED(var) (void)var |
| 127 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 128 | // 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] | 129 | #ifdef NDEBUG |
| 130 | #ifdef __GNUC__ |
| 131 | #define UPB_ASSUME(expr) if (!(expr)) __builtin_unreachable() |
| 132 | #elif defined _MSC_VER |
| 133 | #define UPB_ASSUME(expr) if (!(expr)) __assume(0) |
| 134 | #else |
| 135 | #define UPB_ASSUME(expr) do {} while (false && (expr)) |
| 136 | #endif |
| 137 | #else |
| 138 | #define UPB_ASSUME(expr) assert(expr) |
| 139 | #endif |
| 140 | |
| 141 | /* UPB_ASSERT(): in release mode, we use the expression without letting it be |
| 142 | * evaluated. This prevents "unused variable" warnings. */ |
| 143 | #ifdef NDEBUG |
| 144 | #define UPB_ASSERT(expr) do {} while (false && (expr)) |
| 145 | #else |
| 146 | #define UPB_ASSERT(expr) assert(expr) |
| 147 | #endif |
| 148 | |
| 149 | #if defined(__GNUC__) || defined(__clang__) |
| 150 | #define UPB_UNREACHABLE() do { assert(0); __builtin_unreachable(); } while(0) |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 151 | #elif defined(_MSC_VER) |
| 152 | #define UPB_UNREACHABLE() \ |
| 153 | do { \ |
| 154 | assert(0); \ |
| 155 | __assume(0); \ |
| 156 | } while (0) |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 157 | #else |
| 158 | #define UPB_UNREACHABLE() do { assert(0); } while(0) |
| 159 | #endif |
| 160 | |
| 161 | /* UPB_SETJMP() / UPB_LONGJMP(): avoid setting/restoring signal mask. */ |
| 162 | #ifdef __APPLE__ |
| 163 | #define UPB_SETJMP(buf) _setjmp(buf) |
| 164 | #define UPB_LONGJMP(buf, val) _longjmp(buf, val) |
| 165 | #else |
| 166 | #define UPB_SETJMP(buf) setjmp(buf) |
| 167 | #define UPB_LONGJMP(buf, val) longjmp(buf, val) |
| 168 | #endif |
| 169 | |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 170 | #ifdef __GNUC__ |
| 171 | #define UPB_USE_C11_ATOMICS |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 172 | #define UPB_ATOMIC(T) _Atomic(T) |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 173 | #else |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 174 | #define UPB_ATOMIC(T) T |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 175 | #endif |
| 176 | |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 177 | /* UPB_PTRADD(ptr, ofs): add pointer while avoiding "NULL + 0" UB */ |
| 178 | #define UPB_PTRADD(ptr, ofs) ((ofs) ? (ptr) + (ofs) : (ptr)) |
| 179 | |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 180 | #define UPB_PRIVATE(x) x##_dont_copy_me__upb_internal_use_only |
| 181 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 182 | /* Configure whether fasttable is switched on or not. *************************/ |
| 183 | |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 184 | #ifdef __has_attribute |
| 185 | #define UPB_HAS_ATTRIBUTE(x) __has_attribute(x) |
| 186 | #else |
| 187 | #define UPB_HAS_ATTRIBUTE(x) 0 |
| 188 | #endif |
| 189 | |
| 190 | #if UPB_HAS_ATTRIBUTE(musttail) |
| 191 | #define UPB_MUSTTAIL __attribute__((musttail)) |
| 192 | #else |
| 193 | #define UPB_MUSTTAIL |
| 194 | #endif |
| 195 | |
| 196 | #undef UPB_HAS_ATTRIBUTE |
| 197 | |
| 198 | /* This check is not fully robust: it does not require that we have "musttail" |
| 199 | * support available. We need tail calls to avoid consuming arbitrary amounts |
| 200 | * of stack space. |
| 201 | * |
| 202 | * GCC/Clang can mostly be trusted to generate tail calls as long as |
| 203 | * optimization is enabled, but, debug builds will not generate tail calls |
| 204 | * unless "musttail" is available. |
| 205 | * |
| 206 | * We should probably either: |
| 207 | * 1. require that the compiler supports musttail. |
| 208 | * 2. add some fallback code for when musttail isn't available (ie. return |
| 209 | * instead of tail calling). This is safe and portable, but this comes at |
| 210 | * a CPU cost. |
| 211 | */ |
| 212 | #if (defined(__x86_64__) || defined(__aarch64__)) && defined(__GNUC__) |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 213 | #define UPB_FASTTABLE_SUPPORTED 1 |
| 214 | #else |
| 215 | #define UPB_FASTTABLE_SUPPORTED 0 |
| 216 | #endif |
| 217 | |
| 218 | /* define UPB_ENABLE_FASTTABLE to force fast table support. |
| 219 | * This is useful when we want to ensure we are really getting fasttable, |
| 220 | * for example for testing or benchmarking. */ |
| 221 | #if defined(UPB_ENABLE_FASTTABLE) |
| 222 | #if !UPB_FASTTABLE_SUPPORTED |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 223 | #error fasttable is x86-64/ARM64 only and requires GCC or Clang. |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 224 | #endif |
| 225 | #define UPB_FASTTABLE 1 |
| 226 | /* Define UPB_TRY_ENABLE_FASTTABLE to use fasttable if possible. |
| 227 | * This is useful for releasing code that might be used on multiple platforms, |
| 228 | * for example the PHP or Ruby C extensions. */ |
| 229 | #elif defined(UPB_TRY_ENABLE_FASTTABLE) |
| 230 | #define UPB_FASTTABLE UPB_FASTTABLE_SUPPORTED |
| 231 | #else |
| 232 | #define UPB_FASTTABLE 0 |
| 233 | #endif |
| 234 | |
| 235 | /* UPB_FASTTABLE_INIT() allows protos compiled for fasttable to gracefully |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 236 | * degrade to non-fasttable if the runtime or platform do not support it. */ |
| 237 | #if !UPB_FASTTABLE |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 238 | #define UPB_FASTTABLE_INIT(...) |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 239 | #define UPB_FASTTABLE_MASK(mask) -1 |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 240 | #else |
| 241 | #define UPB_FASTTABLE_INIT(...) __VA_ARGS__ |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 242 | #define UPB_FASTTABLE_MASK(mask) mask |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 243 | #endif |
| 244 | |
| 245 | #undef UPB_FASTTABLE_SUPPORTED |
| 246 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 247 | /* ASAN poisoning (for arena). |
| 248 | * 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] | 249 | * 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] | 250 | * expected behavior. |
| 251 | */ |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 252 | |
| 253 | #if defined(__SANITIZE_ADDRESS__) |
| 254 | #define UPB_ASAN 1 |
| 255 | #ifdef __cplusplus |
| 256 | extern "C" { |
| 257 | #endif |
| 258 | void __asan_poison_memory_region(void const volatile *addr, size_t size); |
| 259 | void __asan_unpoison_memory_region(void const volatile *addr, size_t size); |
| 260 | #ifdef __cplusplus |
| 261 | } /* extern "C" */ |
| 262 | #endif |
| 263 | #define UPB_POISON_MEMORY_REGION(addr, size) \ |
| 264 | __asan_poison_memory_region((addr), (size)) |
| 265 | #define UPB_UNPOISON_MEMORY_REGION(addr, size) \ |
| 266 | __asan_unpoison_memory_region((addr), (size)) |
| 267 | #else |
| 268 | #define UPB_ASAN 0 |
| 269 | #define UPB_POISON_MEMORY_REGION(addr, size) \ |
| 270 | ((void)(addr), (void)(size)) |
| 271 | #define UPB_UNPOISON_MEMORY_REGION(addr, size) \ |
| 272 | ((void)(addr), (void)(size)) |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 273 | #endif |
| 274 | |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 275 | /* Disable proto2 arena behavior (TEMPORARY) **********************************/ |
| 276 | |
| 277 | #ifdef UPB_DISABLE_PROTO2_ENUM_CHECKING |
| 278 | #define UPB_TREAT_PROTO2_ENUMS_LIKE_PROTO3 1 |
| 279 | #else |
| 280 | #define UPB_TREAT_PROTO2_ENUMS_LIKE_PROTO3 0 |
| 281 | #endif |
| 282 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 283 | #if defined(__cplusplus) |
| 284 | #if defined(__clang__) || UPB_GNUC_MIN(6, 0) |
| 285 | // https://gcc.gnu.org/gcc-6/changes.html |
| 286 | #if __cplusplus >= 201402L |
| 287 | #define UPB_DEPRECATED [[deprecated]] |
| 288 | #else |
| 289 | #define UPB_DEPRECATED __attribute__((deprecated)) |
| 290 | #endif |
| 291 | #else |
| 292 | #define UPB_DEPRECATED |
| 293 | #endif |
| 294 | #else |
| 295 | #define UPB_DEPRECATED |
| 296 | #endif |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 297 | |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 298 | // begin:google_only |
| 299 | // #define UPB_IS_GOOGLE3 |
| 300 | // end:google_only |
| 301 | |
| 302 | #if defined(UPB_IS_GOOGLE3) && !defined(UPB_BOOTSTRAP_STAGE0) |
| 303 | #define UPB_DESC(sym) proto2_##sym |
| 304 | #else |
| 305 | #define UPB_DESC(sym) google_protobuf_##sym |
| 306 | #endif |
| 307 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 308 | #ifndef UPB_BASE_STATUS_H_ |
| 309 | #define UPB_BASE_STATUS_H_ |
| 310 | |
| 311 | #include <stdarg.h> |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 312 | |
| 313 | // Must be last. |
| 314 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 315 | #define _kUpb_Status_MaxMessage 127 |
| 316 | |
| 317 | typedef struct { |
| 318 | bool ok; |
| 319 | char msg[_kUpb_Status_MaxMessage]; // Error message; NULL-terminated. |
| 320 | } upb_Status; |
| 321 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 322 | #ifdef __cplusplus |
| 323 | extern "C" { |
| 324 | #endif |
| 325 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 326 | UPB_API const char* upb_Status_ErrorMessage(const upb_Status* status); |
| 327 | UPB_API bool upb_Status_IsOk(const upb_Status* status); |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 328 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 329 | // These are no-op if |status| is NULL. |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 330 | UPB_API void upb_Status_Clear(upb_Status* status); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 331 | void upb_Status_SetErrorMessage(upb_Status* status, const char* msg); |
| 332 | void upb_Status_SetErrorFormat(upb_Status* status, const char* fmt, ...) |
| 333 | UPB_PRINTF(2, 3); |
| 334 | void upb_Status_VSetErrorFormat(upb_Status* status, const char* fmt, |
| 335 | va_list args) UPB_PRINTF(2, 0); |
| 336 | void upb_Status_VAppendErrorFormat(upb_Status* status, const char* fmt, |
| 337 | va_list args) UPB_PRINTF(2, 0); |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 338 | |
| 339 | #ifdef __cplusplus |
| 340 | } /* extern "C" */ |
| 341 | #endif |
| 342 | |
| 343 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 344 | #endif /* UPB_BASE_STATUS_H_ */ |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 345 | |
| 346 | #ifndef UPB_INTERNAL_ARRAY_INTERNAL_H_ |
| 347 | #define UPB_INTERNAL_ARRAY_INTERNAL_H_ |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 348 | |
| 349 | #include <string.h> |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 350 | |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 351 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 352 | #ifndef UPB_COLLECTIONS_ARRAY_H_ |
| 353 | #define UPB_COLLECTIONS_ARRAY_H_ |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 354 | |
| 355 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 356 | #ifndef UPB_BASE_DESCRIPTOR_CONSTANTS_H_ |
| 357 | #define UPB_BASE_DESCRIPTOR_CONSTANTS_H_ |
| 358 | |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 359 | // Must be last. |
| 360 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 361 | // The types a field can have. Note that this list is not identical to the |
| 362 | // types defined in descriptor.proto, which gives INT32 and SINT32 separate |
| 363 | // types (we distinguish the two with the "integer encoding" enum below). |
| 364 | // This enum is an internal convenience only and has no meaning outside of upb. |
| 365 | typedef enum { |
| 366 | kUpb_CType_Bool = 1, |
| 367 | kUpb_CType_Float = 2, |
| 368 | kUpb_CType_Int32 = 3, |
| 369 | kUpb_CType_UInt32 = 4, |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 370 | kUpb_CType_Enum = 5, // Enum values are int32. TODO(b/279178239): rename |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 371 | kUpb_CType_Message = 6, |
| 372 | kUpb_CType_Double = 7, |
| 373 | kUpb_CType_Int64 = 8, |
| 374 | kUpb_CType_UInt64 = 9, |
| 375 | kUpb_CType_String = 10, |
| 376 | kUpb_CType_Bytes = 11 |
| 377 | } upb_CType; |
| 378 | |
| 379 | // The repeated-ness of each field; this matches descriptor.proto. |
| 380 | typedef enum { |
| 381 | kUpb_Label_Optional = 1, |
| 382 | kUpb_Label_Required = 2, |
| 383 | kUpb_Label_Repeated = 3 |
| 384 | } upb_Label; |
| 385 | |
| 386 | // Descriptor types, as defined in descriptor.proto. |
| 387 | typedef enum { |
| 388 | kUpb_FieldType_Double = 1, |
| 389 | kUpb_FieldType_Float = 2, |
| 390 | kUpb_FieldType_Int64 = 3, |
| 391 | kUpb_FieldType_UInt64 = 4, |
| 392 | kUpb_FieldType_Int32 = 5, |
| 393 | kUpb_FieldType_Fixed64 = 6, |
| 394 | kUpb_FieldType_Fixed32 = 7, |
| 395 | kUpb_FieldType_Bool = 8, |
| 396 | kUpb_FieldType_String = 9, |
| 397 | kUpb_FieldType_Group = 10, |
| 398 | kUpb_FieldType_Message = 11, |
| 399 | kUpb_FieldType_Bytes = 12, |
| 400 | kUpb_FieldType_UInt32 = 13, |
| 401 | kUpb_FieldType_Enum = 14, |
| 402 | kUpb_FieldType_SFixed32 = 15, |
| 403 | kUpb_FieldType_SFixed64 = 16, |
| 404 | kUpb_FieldType_SInt32 = 17, |
| 405 | kUpb_FieldType_SInt64 = 18, |
| 406 | } upb_FieldType; |
| 407 | |
| 408 | #define kUpb_FieldType_SizeOf 19 |
| 409 | |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 410 | #ifdef __cplusplus |
| 411 | extern "C" { |
| 412 | #endif |
| 413 | |
| 414 | UPB_INLINE bool upb_FieldType_IsPackable(upb_FieldType type) { |
| 415 | // clang-format off |
| 416 | const unsigned kUnpackableTypes = |
| 417 | (1 << kUpb_FieldType_String) | |
| 418 | (1 << kUpb_FieldType_Bytes) | |
| 419 | (1 << kUpb_FieldType_Message) | |
| 420 | (1 << kUpb_FieldType_Group); |
| 421 | // clang-format on |
| 422 | return (1 << type) & ~kUnpackableTypes; |
| 423 | } |
| 424 | |
| 425 | #ifdef __cplusplus |
| 426 | } /* extern "C" */ |
| 427 | #endif |
| 428 | |
| 429 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 430 | #endif /* UPB_BASE_DESCRIPTOR_CONSTANTS_H_ */ |
| 431 | |
| 432 | // Users should include array.h or map.h instead. |
| 433 | // IWYU pragma: private, include "upb/collections/array.h" |
| 434 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 435 | #ifndef UPB_MESSAGE_VALUE_H_ |
| 436 | #define UPB_MESSAGE_VALUE_H_ |
| 437 | |
| 438 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 439 | #ifndef UPB_BASE_STRING_VIEW_H_ |
| 440 | #define UPB_BASE_STRING_VIEW_H_ |
| 441 | |
| 442 | #include <string.h> |
| 443 | |
| 444 | // Must be last. |
| 445 | |
| 446 | #define UPB_STRINGVIEW_INIT(ptr, len) \ |
| 447 | { ptr, len } |
| 448 | |
| 449 | #define UPB_STRINGVIEW_FORMAT "%.*s" |
| 450 | #define UPB_STRINGVIEW_ARGS(view) (int)(view).size, (view).data |
| 451 | |
| 452 | // LINT.IfChange(struct_definition) |
| 453 | typedef struct { |
| 454 | const char* data; |
| 455 | size_t size; |
| 456 | } upb_StringView; |
| 457 | // LINT.ThenChange(GoogleInternalName0) |
| 458 | |
| 459 | #ifdef __cplusplus |
| 460 | extern "C" { |
| 461 | #endif |
| 462 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 463 | UPB_API_INLINE upb_StringView upb_StringView_FromDataAndSize(const char* data, |
| 464 | size_t size) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 465 | upb_StringView ret; |
| 466 | ret.data = data; |
| 467 | ret.size = size; |
| 468 | return ret; |
| 469 | } |
| 470 | |
| 471 | UPB_INLINE upb_StringView upb_StringView_FromString(const char* data) { |
| 472 | return upb_StringView_FromDataAndSize(data, strlen(data)); |
| 473 | } |
| 474 | |
| 475 | UPB_INLINE bool upb_StringView_IsEqual(upb_StringView a, upb_StringView b) { |
| 476 | return a.size == b.size && memcmp(a.data, b.data, a.size) == 0; |
| 477 | } |
| 478 | |
| 479 | #ifdef __cplusplus |
| 480 | } /* extern "C" */ |
| 481 | #endif |
| 482 | |
| 483 | |
| 484 | #endif /* UPB_BASE_STRING_VIEW_H_ */ |
| 485 | |
| 486 | #ifndef UPB_MINI_TABLE_TYPES_H_ |
| 487 | #define UPB_MINI_TABLE_TYPES_H_ |
| 488 | |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 489 | #include <stdint.h> |
| 490 | |
| 491 | // Must be last. |
| 492 | |
| 493 | #ifdef __cplusplus |
| 494 | extern "C" { |
| 495 | #endif |
| 496 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 497 | typedef void upb_Message; |
| 498 | |
| 499 | typedef struct upb_MiniTable upb_MiniTable; |
| 500 | typedef struct upb_MiniTableEnum upb_MiniTableEnum; |
| 501 | typedef struct upb_MiniTableExtension upb_MiniTableExtension; |
| 502 | typedef struct upb_MiniTableField upb_MiniTableField; |
| 503 | typedef struct upb_MiniTableFile upb_MiniTableFile; |
| 504 | typedef union upb_MiniTableSub upb_MiniTableSub; |
| 505 | |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 506 | // When a upb_Message* is stored in a message, array, or map, it is stored in a |
| 507 | // tagged form. If the tag bit is set, the referenced upb_Message is of type |
| 508 | // _kUpb_MiniTable_Empty (a sentinel message type with no fields) instead of |
| 509 | // that field's true message type. This forms the basis of what we call |
| 510 | // "dynamic tree shaking." |
| 511 | // |
| 512 | // See the documentation for kUpb_DecodeOption_ExperimentalAllowUnlinked for |
| 513 | // more information. |
| 514 | typedef uintptr_t upb_TaggedMessagePtr; |
| 515 | |
| 516 | // Internal-only because empty messages cannot be created by the user. |
| 517 | UPB_INLINE upb_TaggedMessagePtr _upb_TaggedMessagePtr_Pack(upb_Message* ptr, |
| 518 | bool empty) { |
| 519 | UPB_ASSERT(((uintptr_t)ptr & 1) == 0); |
| 520 | return (uintptr_t)ptr | (empty ? 1 : 0); |
| 521 | } |
| 522 | |
| 523 | // Users who enable unlinked sub-messages must use this to test whether a |
| 524 | // message is empty before accessing it. If a message is empty, it must be |
| 525 | // first promoted using the interfaces in message/promote.h. |
| 526 | UPB_INLINE bool upb_TaggedMessagePtr_IsEmpty(upb_TaggedMessagePtr ptr) { |
| 527 | return ptr & 1; |
| 528 | } |
| 529 | |
| 530 | UPB_INLINE upb_Message* _upb_TaggedMessagePtr_GetMessage( |
| 531 | upb_TaggedMessagePtr ptr) { |
| 532 | return (upb_Message*)(ptr & ~(uintptr_t)1); |
| 533 | } |
| 534 | |
| 535 | UPB_INLINE upb_Message* upb_TaggedMessagePtr_GetNonEmptyMessage( |
| 536 | upb_TaggedMessagePtr ptr) { |
| 537 | UPB_ASSERT(!upb_TaggedMessagePtr_IsEmpty(ptr)); |
| 538 | return _upb_TaggedMessagePtr_GetMessage(ptr); |
| 539 | } |
| 540 | |
| 541 | UPB_INLINE upb_Message* _upb_TaggedMessagePtr_GetEmptyMessage( |
| 542 | upb_TaggedMessagePtr ptr) { |
| 543 | UPB_ASSERT(upb_TaggedMessagePtr_IsEmpty(ptr)); |
| 544 | return _upb_TaggedMessagePtr_GetMessage(ptr); |
| 545 | } |
| 546 | |
| 547 | #ifdef __cplusplus |
| 548 | } /* extern "C" */ |
| 549 | #endif |
| 550 | |
| 551 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 552 | #endif /* UPB_MINI_TABLE_TYPES_H_ */ |
| 553 | |
| 554 | // Must be last. |
| 555 | |
| 556 | typedef struct upb_Array upb_Array; |
| 557 | typedef struct upb_Map upb_Map; |
| 558 | |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 559 | typedef uintptr_t upb_TaggedMessagePtr; |
| 560 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 561 | typedef union { |
| 562 | bool bool_val; |
| 563 | float float_val; |
| 564 | double double_val; |
| 565 | int32_t int32_val; |
| 566 | int64_t int64_val; |
| 567 | uint32_t uint32_val; |
| 568 | uint64_t uint64_val; |
| 569 | const upb_Array* array_val; |
| 570 | const upb_Map* map_val; |
| 571 | const upb_Message* msg_val; |
| 572 | upb_StringView str_val; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 573 | |
| 574 | // EXPERIMENTAL: A tagged upb_Message*. Users must use this instead of |
| 575 | // msg_val if unlinked sub-messages may possibly be in use. See the |
| 576 | // documentation in kUpb_DecodeOption_ExperimentalAllowUnlinked for more |
| 577 | // information. |
| 578 | upb_TaggedMessagePtr tagged_msg_val; |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 579 | } upb_MessageValue; |
| 580 | |
| 581 | typedef union { |
| 582 | upb_Array* array; |
| 583 | upb_Map* map; |
| 584 | upb_Message* msg; |
| 585 | } upb_MutableMessageValue; |
| 586 | |
| 587 | |
| 588 | #endif /* UPB_MESSAGE_VALUE_H_ */ |
| 589 | |
| 590 | /* upb_Arena is a specific allocator implementation that uses arena allocation. |
| 591 | * The user provides an allocator that will be used to allocate the underlying |
| 592 | * arena blocks. Arenas by nature do not require the individual allocations |
| 593 | * to be freed. However the Arena does allow users to register cleanup |
| 594 | * functions that will run when the arena is destroyed. |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 595 | * |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 596 | * A upb_Arena is *not* thread-safe. |
| 597 | * |
| 598 | * You could write a thread-safe arena allocator that satisfies the |
| 599 | * upb_alloc interface, but it would not be as efficient for the |
| 600 | * single-threaded case. */ |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 601 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 602 | #ifndef UPB_MEM_ARENA_H_ |
| 603 | #define UPB_MEM_ARENA_H_ |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 604 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 605 | #include <string.h> |
| 606 | |
| 607 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 608 | #ifndef UPB_MEM_ALLOC_H_ |
| 609 | #define UPB_MEM_ALLOC_H_ |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 610 | |
| 611 | // Must be last. |
| 612 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 613 | #ifdef __cplusplus |
| 614 | extern "C" { |
| 615 | #endif |
| 616 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 617 | typedef struct upb_alloc upb_alloc; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 618 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 619 | /* A combined `malloc()`/`free()` function. |
| 620 | * If `size` is 0 then the function acts like `free()`, otherwise it acts like |
| 621 | * `realloc()`. Only `oldsize` bytes from a previous allocation are |
| 622 | * preserved. */ |
| 623 | typedef void* upb_alloc_func(upb_alloc* alloc, void* ptr, size_t oldsize, |
| 624 | size_t size); |
| 625 | |
| 626 | /* A upb_alloc is a possibly-stateful allocator object. |
| 627 | * |
| 628 | * It could either be an arena allocator (which doesn't require individual |
| 629 | * `free()` calls) or a regular `malloc()` (which does). The client must |
| 630 | * therefore free memory unless it knows that the allocator is an arena |
| 631 | * allocator. */ |
| 632 | struct upb_alloc { |
| 633 | upb_alloc_func* func; |
| 634 | }; |
| 635 | |
| 636 | UPB_INLINE void* upb_malloc(upb_alloc* alloc, size_t size) { |
| 637 | UPB_ASSERT(alloc); |
| 638 | return alloc->func(alloc, NULL, 0, size); |
| 639 | } |
| 640 | |
| 641 | UPB_INLINE void* upb_realloc(upb_alloc* alloc, void* ptr, size_t oldsize, |
| 642 | size_t size) { |
| 643 | UPB_ASSERT(alloc); |
| 644 | return alloc->func(alloc, ptr, oldsize, size); |
| 645 | } |
| 646 | |
| 647 | UPB_INLINE void upb_free(upb_alloc* alloc, void* ptr) { |
| 648 | UPB_ASSERT(alloc); |
| 649 | alloc->func(alloc, ptr, 0, 0); |
| 650 | } |
| 651 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 652 | // The global allocator used by upb. Uses the standard malloc()/free(). |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 653 | |
| 654 | extern upb_alloc upb_alloc_global; |
| 655 | |
| 656 | /* Functions that hard-code the global malloc. |
| 657 | * |
| 658 | * We still get benefit because we can put custom logic into our global |
| 659 | * allocator, like injecting out-of-memory faults in debug/testing builds. */ |
| 660 | |
| 661 | UPB_INLINE void* upb_gmalloc(size_t size) { |
| 662 | return upb_malloc(&upb_alloc_global, size); |
| 663 | } |
| 664 | |
| 665 | UPB_INLINE void* upb_grealloc(void* ptr, size_t oldsize, size_t size) { |
| 666 | return upb_realloc(&upb_alloc_global, ptr, oldsize, size); |
| 667 | } |
| 668 | |
| 669 | UPB_INLINE void upb_gfree(void* ptr) { upb_free(&upb_alloc_global, ptr); } |
| 670 | |
| 671 | #ifdef __cplusplus |
| 672 | } /* extern "C" */ |
| 673 | #endif |
| 674 | |
| 675 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 676 | #endif /* UPB_MEM_ALLOC_H_ */ |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 677 | |
| 678 | // Must be last. |
| 679 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 680 | typedef struct upb_Arena upb_Arena; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 681 | |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 682 | // LINT.IfChange(arena_head) |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 683 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 684 | typedef struct { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 685 | char *ptr, *end; |
| 686 | } _upb_ArenaHead; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 687 | |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 688 | // LINT.ThenChange(//depot/google3/third_party/upb/js/impl/upb_bits/arena.ts:arena_head) |
| 689 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 690 | #ifdef __cplusplus |
| 691 | extern "C" { |
| 692 | #endif |
| 693 | |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 694 | // Creates an arena from the given initial block (if any -- n may be 0). |
| 695 | // Additional blocks will be allocated from |alloc|. If |alloc| is NULL, this |
| 696 | // is a fixed-size arena and cannot grow. |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 697 | 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] | 698 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 699 | UPB_API void upb_Arena_Free(upb_Arena* a); |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 700 | UPB_API bool upb_Arena_Fuse(upb_Arena* a, upb_Arena* b); |
| 701 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 702 | void* _upb_Arena_SlowMalloc(upb_Arena* a, size_t size); |
| 703 | size_t upb_Arena_SpaceAllocated(upb_Arena* arena); |
| 704 | uint32_t upb_Arena_DebugRefCount(upb_Arena* arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 705 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 706 | UPB_INLINE size_t _upb_ArenaHas(upb_Arena* a) { |
| 707 | _upb_ArenaHead* h = (_upb_ArenaHead*)a; |
| 708 | return (size_t)(h->end - h->ptr); |
| 709 | } |
| 710 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 711 | 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] | 712 | size = UPB_ALIGN_MALLOC(size); |
| 713 | if (UPB_UNLIKELY(_upb_ArenaHas(a) < size)) { |
| 714 | return _upb_Arena_SlowMalloc(a, size); |
| 715 | } |
| 716 | |
| 717 | // We have enough space to do a fast malloc. |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 718 | _upb_ArenaHead* h = (_upb_ArenaHead*)a; |
| 719 | void* ret = h->ptr; |
| 720 | UPB_ASSERT(UPB_ALIGN_MALLOC((uintptr_t)ret) == (uintptr_t)ret); |
| 721 | UPB_ASSERT(UPB_ALIGN_MALLOC(size) == size); |
| 722 | UPB_UNPOISON_MEMORY_REGION(ret, size); |
| 723 | |
| 724 | h->ptr += size; |
| 725 | |
| 726 | #if UPB_ASAN |
| 727 | { |
| 728 | size_t guard_size = 32; |
| 729 | if (_upb_ArenaHas(a) >= guard_size) { |
| 730 | h->ptr += guard_size; |
| 731 | } else { |
| 732 | h->ptr = h->end; |
| 733 | } |
| 734 | } |
| 735 | #endif |
| 736 | |
| 737 | return ret; |
| 738 | } |
| 739 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 740 | // Shrinks the last alloc from arena. |
| 741 | // REQUIRES: (ptr, oldsize) was the last malloc/realloc from this arena. |
| 742 | // We could also add a upb_Arena_TryShrinkLast() which is simply a no-op if |
| 743 | // this was not the last alloc. |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 744 | UPB_API_INLINE void upb_Arena_ShrinkLast(upb_Arena* a, void* ptr, |
| 745 | size_t oldsize, size_t size) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 746 | _upb_ArenaHead* h = (_upb_ArenaHead*)a; |
| 747 | oldsize = UPB_ALIGN_MALLOC(oldsize); |
| 748 | size = UPB_ALIGN_MALLOC(size); |
| 749 | UPB_ASSERT((char*)ptr + oldsize == h->ptr); // Must be the last alloc. |
| 750 | UPB_ASSERT(size <= oldsize); |
| 751 | h->ptr = (char*)ptr + size; |
| 752 | } |
| 753 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 754 | UPB_API_INLINE void* upb_Arena_Realloc(upb_Arena* a, void* ptr, size_t oldsize, |
| 755 | size_t size) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 756 | _upb_ArenaHead* h = (_upb_ArenaHead*)a; |
| 757 | oldsize = UPB_ALIGN_MALLOC(oldsize); |
| 758 | size = UPB_ALIGN_MALLOC(size); |
| 759 | bool is_most_recent_alloc = (uintptr_t)ptr + oldsize == (uintptr_t)h->ptr; |
| 760 | |
| 761 | if (is_most_recent_alloc) { |
| 762 | ptrdiff_t diff = size - oldsize; |
| 763 | if ((ptrdiff_t)_upb_ArenaHas(a) >= diff) { |
| 764 | h->ptr += diff; |
| 765 | return ptr; |
| 766 | } |
| 767 | } else if (size <= oldsize) { |
| 768 | return ptr; |
| 769 | } |
| 770 | |
| 771 | void* ret = upb_Arena_Malloc(a, size); |
| 772 | |
| 773 | if (ret && oldsize > 0) { |
| 774 | memcpy(ret, ptr, UPB_MIN(oldsize, size)); |
| 775 | } |
| 776 | |
| 777 | return ret; |
| 778 | } |
| 779 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 780 | UPB_API_INLINE upb_Arena* upb_Arena_New(void) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 781 | return upb_Arena_Init(NULL, 0, &upb_alloc_global); |
| 782 | } |
| 783 | |
| 784 | #ifdef __cplusplus |
| 785 | } /* extern "C" */ |
| 786 | #endif |
| 787 | |
| 788 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 789 | #endif /* UPB_MEM_ARENA_H_ */ |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 790 | |
| 791 | // Must be last. |
| 792 | |
| 793 | #ifdef __cplusplus |
| 794 | extern "C" { |
| 795 | #endif |
| 796 | |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 797 | // Creates a new array on the given arena that holds elements of this type. |
| 798 | 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] | 799 | |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 800 | // Returns the number of elements in the array. |
| 801 | UPB_API size_t upb_Array_Size(const upb_Array* arr); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 802 | |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 803 | // Returns the given element, which must be within the array's current size. |
| 804 | 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] | 805 | |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 806 | // Sets the given element, which must be within the array's current size. |
| 807 | 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] | 808 | |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 809 | // Appends an element to the array. Returns false on allocation failure. |
| 810 | UPB_API bool upb_Array_Append(upb_Array* array, upb_MessageValue val, |
| 811 | upb_Arena* arena); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 812 | |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 813 | // Moves elements within the array using memmove(). |
| 814 | // Like memmove(), the source and destination elements may be overlapping. |
| 815 | UPB_API void upb_Array_Move(upb_Array* array, size_t dst_idx, size_t src_idx, |
| 816 | size_t count); |
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 | // Inserts one or more empty elements into the array. |
| 819 | // Existing elements are shifted right. |
| 820 | // The new elements have undefined state and must be set with `upb_Array_Set()`. |
| 821 | // REQUIRES: `i <= upb_Array_Size(arr)` |
| 822 | UPB_API bool upb_Array_Insert(upb_Array* array, size_t i, size_t count, |
| 823 | upb_Arena* arena); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 824 | |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 825 | // Deletes one or more elements from the array. |
| 826 | // Existing elements are shifted left. |
| 827 | // REQUIRES: `i + count <= upb_Array_Size(arr)` |
| 828 | 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] | 829 | |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 830 | // Changes the size of a vector. New elements are initialized to NULL/0. |
| 831 | // Returns false on allocation failure. |
| 832 | 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] | 833 | |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 834 | // Returns pointer to array data. |
| 835 | UPB_API const void* upb_Array_DataPtr(const upb_Array* arr); |
| 836 | |
| 837 | // Returns mutable pointer to array data. |
| 838 | UPB_API void* upb_Array_MutableDataPtr(upb_Array* arr); |
| 839 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 840 | #ifdef __cplusplus |
| 841 | } /* extern "C" */ |
| 842 | #endif |
| 843 | |
| 844 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 845 | #endif /* UPB_COLLECTIONS_ARRAY_H_ */ |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 846 | |
| 847 | // Must be last. |
| 848 | |
| 849 | #ifdef __cplusplus |
| 850 | extern "C" { |
| 851 | #endif |
| 852 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 853 | // LINT.IfChange(struct_definition) |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 854 | // Our internal representation for repeated fields. |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 855 | struct upb_Array { |
| 856 | uintptr_t data; /* Tagged ptr: low 3 bits of ptr are lg2(elem size). */ |
| 857 | size_t size; /* The number of elements in the array. */ |
| 858 | size_t capacity; /* Allocated storage. Measured in elements. */ |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 859 | }; |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 860 | // LINT.ThenChange(GoogleInternalName1) |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 861 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 862 | UPB_INLINE size_t _upb_Array_ElementSizeLg2(const upb_Array* arr) { |
| 863 | size_t ret = arr->data & 7; |
| 864 | UPB_ASSERT(ret <= 4); |
| 865 | return ret; |
| 866 | } |
| 867 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 868 | UPB_INLINE const void* _upb_array_constptr(const upb_Array* arr) { |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 869 | _upb_Array_ElementSizeLg2(arr); // Check assertion. |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 870 | return (void*)(arr->data & ~(uintptr_t)7); |
| 871 | } |
| 872 | |
| 873 | UPB_INLINE uintptr_t _upb_array_tagptr(void* ptr, int elem_size_lg2) { |
| 874 | UPB_ASSERT(elem_size_lg2 <= 4); |
| 875 | return (uintptr_t)ptr | elem_size_lg2; |
| 876 | } |
| 877 | |
| 878 | UPB_INLINE void* _upb_array_ptr(upb_Array* arr) { |
| 879 | return (void*)_upb_array_constptr(arr); |
| 880 | } |
| 881 | |
| 882 | UPB_INLINE uintptr_t _upb_tag_arrptr(void* ptr, int elem_size_lg2) { |
| 883 | UPB_ASSERT(elem_size_lg2 <= 4); |
| 884 | UPB_ASSERT(((uintptr_t)ptr & 7) == 0); |
| 885 | return (uintptr_t)ptr | (unsigned)elem_size_lg2; |
| 886 | } |
| 887 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 888 | extern const char _upb_Array_CTypeSizeLg2Table[]; |
| 889 | |
| 890 | UPB_INLINE size_t _upb_Array_CTypeSizeLg2(upb_CType ctype) { |
| 891 | return _upb_Array_CTypeSizeLg2Table[ctype]; |
| 892 | } |
| 893 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 894 | UPB_INLINE upb_Array* _upb_Array_New(upb_Arena* a, size_t init_capacity, |
| 895 | int elem_size_lg2) { |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 896 | UPB_ASSERT(elem_size_lg2 <= 4); |
Joshua Haberman | 7755973 | 2022-10-03 11:13:05 -0700 | [diff] [blame] | 897 | const size_t arr_size = UPB_ALIGN_UP(sizeof(upb_Array), UPB_MALLOC_ALIGN); |
| 898 | const size_t bytes = arr_size + (init_capacity << elem_size_lg2); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 899 | upb_Array* arr = (upb_Array*)upb_Arena_Malloc(a, bytes); |
| 900 | if (!arr) return NULL; |
| 901 | arr->data = _upb_tag_arrptr(UPB_PTR_AT(arr, arr_size, void), elem_size_lg2); |
| 902 | arr->size = 0; |
| 903 | arr->capacity = init_capacity; |
| 904 | return arr; |
| 905 | } |
| 906 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 907 | // Resizes the capacity of the array to be at least min_size. |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 908 | bool _upb_array_realloc(upb_Array* arr, size_t min_size, upb_Arena* arena); |
| 909 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 910 | UPB_INLINE bool _upb_array_reserve(upb_Array* arr, size_t size, |
| 911 | upb_Arena* arena) { |
| 912 | if (arr->capacity < size) return _upb_array_realloc(arr, size, arena); |
| 913 | return true; |
| 914 | } |
| 915 | |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 916 | // Resize without initializing new elements. |
| 917 | UPB_INLINE bool _upb_Array_ResizeUninitialized(upb_Array* arr, size_t size, |
| 918 | upb_Arena* arena) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 919 | UPB_ASSERT(size <= arr->size || arena); // Allow NULL arena when shrinking. |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 920 | if (!_upb_array_reserve(arr, size, arena)) return false; |
| 921 | arr->size = size; |
| 922 | return true; |
| 923 | } |
| 924 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 925 | // This function is intended for situations where elem_size is compile-time |
| 926 | // constant or a known expression of the form (1 << lg2), so that the expression |
| 927 | // i*elem_size does not result in an actual multiplication. |
| 928 | UPB_INLINE void _upb_Array_Set(upb_Array* arr, size_t i, const void* data, |
| 929 | size_t elem_size) { |
| 930 | UPB_ASSERT(i < arr->size); |
| 931 | UPB_ASSERT(elem_size == 1U << _upb_Array_ElementSizeLg2(arr)); |
| 932 | char* arr_data = (char*)_upb_array_ptr(arr); |
| 933 | memcpy(arr_data + (i * elem_size), data, elem_size); |
| 934 | } |
| 935 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 936 | UPB_INLINE void _upb_array_detach(const void* msg, size_t ofs) { |
| 937 | *UPB_PTR_AT(msg, ofs, upb_Array*) = NULL; |
| 938 | } |
| 939 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 940 | #ifdef __cplusplus |
| 941 | } /* extern "C" */ |
| 942 | #endif |
| 943 | |
| 944 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 945 | #endif /* UPB_INTERNAL_ARRAY_INTERNAL_H_ */ |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 946 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 947 | #ifndef UPB_COLLECTIONS_MAP_H_ |
| 948 | #define UPB_COLLECTIONS_MAP_H_ |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 949 | |
| 950 | |
| 951 | // Must be last. |
| 952 | |
| 953 | #ifdef __cplusplus |
| 954 | extern "C" { |
| 955 | #endif |
| 956 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 957 | // Creates a new map on the given arena with the given key/value size. |
| 958 | UPB_API upb_Map* upb_Map_New(upb_Arena* a, upb_CType key_type, |
| 959 | upb_CType value_type); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 960 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 961 | // Returns the number of entries in the map. |
| 962 | UPB_API size_t upb_Map_Size(const upb_Map* map); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 963 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 964 | // Stores a value for the given key into |*val| (or the zero value if the key is |
| 965 | // not present). Returns whether the key was present. The |val| pointer may be |
| 966 | // NULL, in which case the function tests whether the given key is present. |
| 967 | UPB_API bool upb_Map_Get(const upb_Map* map, upb_MessageValue key, |
| 968 | upb_MessageValue* val); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 969 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 970 | // Removes all entries in the map. |
| 971 | UPB_API void upb_Map_Clear(upb_Map* map); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 972 | |
| 973 | typedef enum { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 974 | kUpb_MapInsertStatus_Inserted = 0, |
| 975 | kUpb_MapInsertStatus_Replaced = 1, |
| 976 | kUpb_MapInsertStatus_OutOfMemory = 2, |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 977 | } upb_MapInsertStatus; |
| 978 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 979 | // Sets the given key to the given value, returning whether the key was inserted |
| 980 | // or replaced. If the key was inserted, then any existing iterators will be |
| 981 | // invalidated. |
| 982 | UPB_API upb_MapInsertStatus upb_Map_Insert(upb_Map* map, upb_MessageValue key, |
| 983 | upb_MessageValue val, |
| 984 | upb_Arena* arena); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 985 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 986 | // Sets the given key to the given value. Returns false if memory allocation |
| 987 | // failed. If the key is newly inserted, then any existing iterators will be |
| 988 | // invalidated. |
| 989 | UPB_API_INLINE bool upb_Map_Set(upb_Map* map, upb_MessageValue key, |
| 990 | upb_MessageValue val, upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 991 | return upb_Map_Insert(map, key, val, arena) != |
| 992 | kUpb_MapInsertStatus_OutOfMemory; |
| 993 | } |
| 994 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 995 | // Deletes this key from the table. Returns true if the key was present. |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 996 | // If present and |val| is non-NULL, stores the deleted value. |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 997 | UPB_API bool upb_Map_Delete(upb_Map* map, upb_MessageValue key, |
| 998 | upb_MessageValue* val); |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 999 | |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 1000 | // (DEPRECATED and going away soon. Do not use.) |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 1001 | UPB_INLINE bool upb_Map_Delete2(upb_Map* map, upb_MessageValue key, |
| 1002 | upb_MessageValue* val) { |
| 1003 | return upb_Map_Delete(map, key, val); |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 1004 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1005 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1006 | // Map iteration: |
| 1007 | // |
| 1008 | // size_t iter = kUpb_Map_Begin; |
| 1009 | // upb_MessageValue key, val; |
| 1010 | // while (upb_Map_Next(map, &key, &val, &iter)) { |
| 1011 | // ... |
| 1012 | // } |
| 1013 | |
| 1014 | #define kUpb_Map_Begin ((size_t)-1) |
| 1015 | |
| 1016 | // Advances to the next entry. Returns false if no more entries are present. |
| 1017 | // Otherwise returns true and populates both *key and *value. |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 1018 | UPB_API bool upb_Map_Next(const upb_Map* map, upb_MessageValue* key, |
| 1019 | upb_MessageValue* val, size_t* iter); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1020 | |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 1021 | // Sets the value for the entry pointed to by iter. |
| 1022 | // WARNING: this does not currently work for string values! |
| 1023 | UPB_API void upb_Map_SetEntryValue(upb_Map* map, size_t iter, |
| 1024 | upb_MessageValue val); |
| 1025 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1026 | // DEPRECATED iterator, slated for removal. |
| 1027 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1028 | /* Map iteration: |
| 1029 | * |
| 1030 | * size_t iter = kUpb_Map_Begin; |
| 1031 | * while (upb_MapIterator_Next(map, &iter)) { |
| 1032 | * upb_MessageValue key = upb_MapIterator_Key(map, iter); |
| 1033 | * upb_MessageValue val = upb_MapIterator_Value(map, iter); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1034 | * } |
| 1035 | */ |
| 1036 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1037 | // Advances to the next entry. Returns false if no more entries are present. |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1038 | bool upb_MapIterator_Next(const upb_Map* map, size_t* iter); |
| 1039 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 1040 | // Returns true if the iterator still points to a valid entry, or false if the |
| 1041 | // iterator is past the last element. It is an error to call this function with |
| 1042 | // kUpb_Map_Begin (you must call next() at least once first). |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1043 | bool upb_MapIterator_Done(const upb_Map* map, size_t iter); |
| 1044 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 1045 | // Returns the key and value for this entry of the map. |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1046 | upb_MessageValue upb_MapIterator_Key(const upb_Map* map, size_t iter); |
| 1047 | upb_MessageValue upb_MapIterator_Value(const upb_Map* map, size_t iter); |
| 1048 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1049 | #ifdef __cplusplus |
| 1050 | } /* extern "C" */ |
| 1051 | #endif |
| 1052 | |
| 1053 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 1054 | #endif /* UPB_COLLECTIONS_MAP_H_ */ |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1055 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1056 | // EVERYTHING BELOW THIS LINE IS INTERNAL - DO NOT USE ///////////////////////// |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1057 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1058 | #ifndef UPB_COLLECTIONS_MAP_INTERNAL_H_ |
| 1059 | #define UPB_COLLECTIONS_MAP_INTERNAL_H_ |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1060 | |
| 1061 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1062 | #ifndef UPB_HASH_STR_TABLE_H_ |
| 1063 | #define UPB_HASH_STR_TABLE_H_ |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1064 | |
| 1065 | |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 1066 | /* |
| 1067 | * upb_table |
| 1068 | * |
| 1069 | * This header is INTERNAL-ONLY! Its interfaces are not public or stable! |
| 1070 | * This file defines very fast int->upb_value (inttable) and string->upb_value |
| 1071 | * (strtable) hash tables. |
| 1072 | * |
| 1073 | * The table uses chained scatter with Brent's variation (inspired by the Lua |
| 1074 | * implementation of hash tables). The hash function for strings is Austin |
| 1075 | * Appleby's "MurmurHash." |
| 1076 | * |
| 1077 | * The inttable uses uintptr_t as its key, which guarantees it can be used to |
| 1078 | * store pointers or integers of at least 32 bits (upb isn't really useful on |
| 1079 | * systems where sizeof(void*) < 4). |
| 1080 | * |
| 1081 | * The table must be homogeneous (all values of the same type). In debug |
| 1082 | * mode, we check this on insert and lookup. |
| 1083 | */ |
| 1084 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1085 | #ifndef UPB_HASH_COMMON_H_ |
| 1086 | #define UPB_HASH_COMMON_H_ |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 1087 | |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 1088 | #include <string.h> |
| 1089 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1090 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1091 | // Must be last. |
| 1092 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1093 | #ifdef __cplusplus |
| 1094 | extern "C" { |
| 1095 | #endif |
| 1096 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1097 | /* upb_value ******************************************************************/ |
| 1098 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1099 | typedef struct { |
| 1100 | uint64_t val; |
| 1101 | } upb_value; |
| 1102 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1103 | /* Variant that works with a length-delimited rather than NULL-delimited string, |
| 1104 | * as supported by strtable. */ |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1105 | char* upb_strdup2(const char* s, size_t len, upb_Arena* a); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1106 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1107 | UPB_INLINE void _upb_value_setval(upb_value* v, uint64_t val) { v->val = val; } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1108 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1109 | /* For each value ctype, define the following set of functions: |
| 1110 | * |
| 1111 | * // Get/set an int32 from a upb_value. |
| 1112 | * int32_t upb_value_getint32(upb_value val); |
| 1113 | * void upb_value_setint32(upb_value *val, int32_t cval); |
| 1114 | * |
| 1115 | * // Construct a new upb_value from an int32. |
| 1116 | * upb_value upb_value_int32(int32_t val); */ |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1117 | #define FUNCS(name, membername, type_t, converter, proto_type) \ |
| 1118 | UPB_INLINE void upb_value_set##name(upb_value* val, type_t cval) { \ |
| 1119 | val->val = (converter)cval; \ |
| 1120 | } \ |
| 1121 | UPB_INLINE upb_value upb_value_##name(type_t val) { \ |
| 1122 | upb_value ret; \ |
| 1123 | upb_value_set##name(&ret, val); \ |
| 1124 | return ret; \ |
| 1125 | } \ |
| 1126 | UPB_INLINE type_t upb_value_get##name(upb_value val) { \ |
| 1127 | return (type_t)(converter)val.val; \ |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1128 | } |
| 1129 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1130 | FUNCS(int32, int32, int32_t, int32_t, UPB_CTYPE_INT32) |
| 1131 | FUNCS(int64, int64, int64_t, int64_t, UPB_CTYPE_INT64) |
| 1132 | FUNCS(uint32, uint32, uint32_t, uint32_t, UPB_CTYPE_UINT32) |
| 1133 | FUNCS(uint64, uint64, uint64_t, uint64_t, UPB_CTYPE_UINT64) |
| 1134 | FUNCS(bool, _bool, bool, bool, UPB_CTYPE_BOOL) |
| 1135 | FUNCS(cstr, cstr, char*, uintptr_t, UPB_CTYPE_CSTR) |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 1136 | FUNCS(uintptr, uptr, uintptr_t, uintptr_t, UPB_CTYPE_UPTR) |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1137 | FUNCS(ptr, ptr, void*, uintptr_t, UPB_CTYPE_PTR) |
| 1138 | FUNCS(constptr, constptr, const void*, uintptr_t, UPB_CTYPE_CONSTPTR) |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1139 | |
| 1140 | #undef FUNCS |
| 1141 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1142 | UPB_INLINE void upb_value_setfloat(upb_value* val, float cval) { |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1143 | memcpy(&val->val, &cval, sizeof(cval)); |
| 1144 | } |
| 1145 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1146 | UPB_INLINE void upb_value_setdouble(upb_value* val, double cval) { |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1147 | memcpy(&val->val, &cval, sizeof(cval)); |
| 1148 | } |
| 1149 | |
| 1150 | UPB_INLINE upb_value upb_value_float(float cval) { |
| 1151 | upb_value ret; |
| 1152 | upb_value_setfloat(&ret, cval); |
| 1153 | return ret; |
| 1154 | } |
| 1155 | |
| 1156 | UPB_INLINE upb_value upb_value_double(double cval) { |
| 1157 | upb_value ret; |
| 1158 | upb_value_setdouble(&ret, cval); |
| 1159 | return ret; |
| 1160 | } |
| 1161 | |
| 1162 | #undef SET_TYPE |
| 1163 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1164 | /* upb_tabkey *****************************************************************/ |
| 1165 | |
| 1166 | /* Either: |
| 1167 | * 1. an actual integer key, or |
| 1168 | * 2. a pointer to a string prefixed by its uint32_t length, owned by us. |
| 1169 | * |
| 1170 | * ...depending on whether this is a string table or an int table. We would |
| 1171 | * make this a union of those two types, but C89 doesn't support statically |
| 1172 | * initializing a non-first union member. */ |
| 1173 | typedef uintptr_t upb_tabkey; |
| 1174 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1175 | UPB_INLINE char* upb_tabstr(upb_tabkey key, uint32_t* len) { |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1176 | char* mem = (char*)key; |
| 1177 | if (len) memcpy(len, mem, sizeof(*len)); |
| 1178 | return mem + sizeof(*len); |
| 1179 | } |
| 1180 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1181 | UPB_INLINE upb_StringView upb_tabstrview(upb_tabkey key) { |
| 1182 | upb_StringView ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1183 | uint32_t len; |
| 1184 | ret.data = upb_tabstr(key, &len); |
| 1185 | ret.size = len; |
| 1186 | return ret; |
| 1187 | } |
| 1188 | |
| 1189 | /* upb_tabval *****************************************************************/ |
| 1190 | |
| 1191 | typedef struct upb_tabval { |
| 1192 | uint64_t val; |
| 1193 | } upb_tabval; |
| 1194 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1195 | #define UPB_TABVALUE_EMPTY_INIT \ |
| 1196 | { -1 } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1197 | |
| 1198 | /* upb_table ******************************************************************/ |
| 1199 | |
| 1200 | typedef struct _upb_tabent { |
| 1201 | upb_tabkey key; |
| 1202 | upb_tabval val; |
| 1203 | |
| 1204 | /* Internal chaining. This is const so we can create static initializers for |
| 1205 | * tables. We cast away const sometimes, but *only* when the containing |
| 1206 | * upb_table is known to be non-const. This requires a bit of care, but |
| 1207 | * the subtlety is confined to table.c. */ |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1208 | const struct _upb_tabent* next; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1209 | } upb_tabent; |
| 1210 | |
| 1211 | typedef struct { |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1212 | size_t count; /* Number of entries in the hash part. */ |
| 1213 | uint32_t mask; /* Mask to turn hash value -> bucket. */ |
| 1214 | uint32_t max_count; /* Max count before we hit our load limit. */ |
| 1215 | uint8_t size_lg2; /* Size of the hashtable part is 2^size_lg2 entries. */ |
| 1216 | upb_tabent* entries; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1217 | } upb_table; |
| 1218 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1219 | UPB_INLINE size_t upb_table_size(const upb_table* t) { |
| 1220 | return t->size_lg2 ? 1 << t->size_lg2 : 0; |
| 1221 | } |
| 1222 | |
| 1223 | // Internal-only functions, in .h file only out of necessity. |
Mike Kruskal | 04e8135 | 2022-11-23 11:07:53 -0800 | [diff] [blame] | 1224 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1225 | UPB_INLINE bool upb_tabent_isempty(const upb_tabent* e) { return e->key == 0; } |
| 1226 | |
Mike Kruskal | 04e8135 | 2022-11-23 11:07:53 -0800 | [diff] [blame] | 1227 | uint32_t _upb_Hash(const void* p, size_t n, uint64_t seed); |
| 1228 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1229 | #ifdef __cplusplus |
| 1230 | } /* extern "C" */ |
| 1231 | #endif |
| 1232 | |
| 1233 | |
| 1234 | #endif /* UPB_HASH_COMMON_H_ */ |
| 1235 | |
| 1236 | // Must be last. |
| 1237 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1238 | typedef struct { |
| 1239 | upb_table t; |
| 1240 | } upb_strtable; |
| 1241 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1242 | #ifdef __cplusplus |
| 1243 | extern "C" { |
| 1244 | #endif |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1245 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1246 | // Initialize a table. If memory allocation failed, false is returned and |
| 1247 | // the table is uninitialized. |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1248 | bool upb_strtable_init(upb_strtable* table, size_t expected_size, upb_Arena* a); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1249 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1250 | // Returns the number of values in the table. |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1251 | UPB_INLINE size_t upb_strtable_count(const upb_strtable* t) { |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1252 | return t->t.count; |
| 1253 | } |
| 1254 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1255 | void upb_strtable_clear(upb_strtable* t); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1256 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1257 | // Inserts the given key into the hashtable with the given value. |
| 1258 | // The key must not already exist in the hash table. The key is not required |
| 1259 | // to be NULL-terminated, and the table will make an internal copy of the key. |
| 1260 | // |
| 1261 | // If a table resize was required but memory allocation failed, false is |
| 1262 | // returned and the table is unchanged. */ |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1263 | bool upb_strtable_insert(upb_strtable* t, const char* key, size_t len, |
| 1264 | upb_value val, upb_Arena* a); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1265 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1266 | // Looks up key in this table, returning "true" if the key was found. |
| 1267 | // If v is non-NULL, copies the value for this key into *v. |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1268 | bool upb_strtable_lookup2(const upb_strtable* t, const char* key, size_t len, |
| 1269 | upb_value* v); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1270 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1271 | // For NULL-terminated strings. |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1272 | UPB_INLINE bool upb_strtable_lookup(const upb_strtable* t, const char* key, |
| 1273 | upb_value* v) { |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1274 | return upb_strtable_lookup2(t, key, strlen(key), v); |
| 1275 | } |
| 1276 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1277 | // Removes an item from the table. Returns true if the remove was successful, |
| 1278 | // and stores the removed item in *val if non-NULL. |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1279 | bool upb_strtable_remove2(upb_strtable* t, const char* key, size_t len, |
| 1280 | upb_value* val); |
| 1281 | |
| 1282 | UPB_INLINE bool upb_strtable_remove(upb_strtable* t, const char* key, |
| 1283 | upb_value* v) { |
| 1284 | return upb_strtable_remove2(t, key, strlen(key), v); |
| 1285 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1286 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1287 | // Exposed for testing only. |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1288 | bool upb_strtable_resize(upb_strtable* t, size_t size_lg2, upb_Arena* a); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1289 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1290 | /* Iteration over strtable: |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1291 | * |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1292 | * intptr_t iter = UPB_STRTABLE_BEGIN; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1293 | * upb_StringView key; |
| 1294 | * upb_value val; |
| 1295 | * while (upb_strtable_next2(t, &key, &val, &iter)) { |
| 1296 | * // ... |
| 1297 | * } |
| 1298 | */ |
| 1299 | |
| 1300 | #define UPB_STRTABLE_BEGIN -1 |
| 1301 | |
| 1302 | bool upb_strtable_next2(const upb_strtable* t, upb_StringView* key, |
| 1303 | upb_value* val, intptr_t* iter); |
| 1304 | void upb_strtable_removeiter(upb_strtable* t, intptr_t* iter); |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 1305 | void upb_strtable_setentryvalue(upb_strtable* t, intptr_t iter, upb_value v); |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1306 | |
| 1307 | /* DEPRECATED iterators, slated for removal. |
| 1308 | * |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1309 | * Iterators for string tables. We are subject to some kind of unusual |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1310 | * design constraints: |
| 1311 | * |
| 1312 | * For high-level languages: |
| 1313 | * - we must be able to guarantee that we don't crash or corrupt memory even if |
| 1314 | * the program accesses an invalidated iterator. |
| 1315 | * |
| 1316 | * For C++11 range-based for: |
| 1317 | * - iterators must be copyable |
| 1318 | * - iterators must be comparable |
| 1319 | * - it must be possible to construct an "end" value. |
| 1320 | * |
| 1321 | * Iteration order is undefined. |
| 1322 | * |
| 1323 | * Modifying the table invalidates iterators. upb_{str,int}table_done() is |
| 1324 | * guaranteed to work even on an invalidated iterator, as long as the table it |
| 1325 | * is iterating over has not been freed. Calling next() or accessing data from |
| 1326 | * an invalidated iterator yields unspecified elements from the table, but it is |
| 1327 | * guaranteed not to crash and to return real table elements (except when done() |
| 1328 | * is true). */ |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1329 | /* upb_strtable_iter **********************************************************/ |
| 1330 | |
| 1331 | /* upb_strtable_iter i; |
| 1332 | * upb_strtable_begin(&i, t); |
| 1333 | * for(; !upb_strtable_done(&i); upb_strtable_next(&i)) { |
| 1334 | * const char *key = upb_strtable_iter_key(&i); |
| 1335 | * const upb_value val = upb_strtable_iter_value(&i); |
| 1336 | * // ... |
| 1337 | * } |
| 1338 | */ |
| 1339 | |
| 1340 | typedef struct { |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1341 | const upb_strtable* t; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1342 | size_t index; |
| 1343 | } upb_strtable_iter; |
| 1344 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1345 | UPB_INLINE const upb_tabent* str_tabent(const upb_strtable_iter* i) { |
| 1346 | return &i->t->t.entries[i->index]; |
| 1347 | } |
| 1348 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1349 | void upb_strtable_begin(upb_strtable_iter* i, const upb_strtable* t); |
| 1350 | void upb_strtable_next(upb_strtable_iter* i); |
| 1351 | bool upb_strtable_done(const upb_strtable_iter* i); |
| 1352 | upb_StringView upb_strtable_iter_key(const upb_strtable_iter* i); |
| 1353 | upb_value upb_strtable_iter_value(const upb_strtable_iter* i); |
| 1354 | void upb_strtable_iter_setdone(upb_strtable_iter* i); |
| 1355 | bool upb_strtable_iter_isequal(const upb_strtable_iter* i1, |
| 1356 | const upb_strtable_iter* i2); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1357 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1358 | #ifdef __cplusplus |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1359 | } /* extern "C" */ |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1360 | #endif |
| 1361 | |
| 1362 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1363 | #endif /* UPB_HASH_STR_TABLE_H_ */ |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1364 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1365 | // Must be last. |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1366 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1367 | struct upb_Map { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1368 | // Size of key and val, based on the map type. |
| 1369 | // Strings are represented as '0' because they must be handled specially. |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1370 | char key_size; |
| 1371 | char val_size; |
| 1372 | |
| 1373 | upb_strtable table; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1374 | }; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1375 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1376 | #ifdef __cplusplus |
| 1377 | extern "C" { |
| 1378 | #endif |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1379 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1380 | // Converting between internal table representation and user values. |
| 1381 | // |
| 1382 | // _upb_map_tokey() and _upb_map_fromkey() are inverses. |
| 1383 | // _upb_map_tovalue() and _upb_map_fromvalue() are inverses. |
| 1384 | // |
| 1385 | // These functions account for the fact that strings are treated differently |
| 1386 | // from other types when stored in a map. |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1387 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1388 | UPB_INLINE upb_StringView _upb_map_tokey(const void* key, size_t size) { |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1389 | if (size == UPB_MAPTYPE_STRING) { |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1390 | return *(upb_StringView*)key; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1391 | } else { |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1392 | return upb_StringView_FromDataAndSize((const char*)key, size); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1393 | } |
| 1394 | } |
| 1395 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1396 | UPB_INLINE void _upb_map_fromkey(upb_StringView key, void* out, size_t size) { |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1397 | if (size == UPB_MAPTYPE_STRING) { |
| 1398 | memcpy(out, &key, sizeof(key)); |
| 1399 | } else { |
| 1400 | memcpy(out, key.data, size); |
| 1401 | } |
| 1402 | } |
| 1403 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1404 | UPB_INLINE bool _upb_map_tovalue(const void* val, size_t size, |
| 1405 | upb_value* msgval, upb_Arena* a) { |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1406 | if (size == UPB_MAPTYPE_STRING) { |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1407 | upb_StringView* strp = (upb_StringView*)upb_Arena_Malloc(a, sizeof(*strp)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1408 | if (!strp) return false; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1409 | *strp = *(upb_StringView*)val; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1410 | *msgval = upb_value_ptr(strp); |
| 1411 | } else { |
| 1412 | memcpy(msgval, val, size); |
| 1413 | } |
| 1414 | return true; |
| 1415 | } |
| 1416 | |
| 1417 | UPB_INLINE void _upb_map_fromvalue(upb_value val, void* out, size_t size) { |
| 1418 | if (size == UPB_MAPTYPE_STRING) { |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1419 | const upb_StringView* strp = (const upb_StringView*)upb_value_getptr(val); |
| 1420 | memcpy(out, strp, sizeof(upb_StringView)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1421 | } else { |
| 1422 | memcpy(out, &val, size); |
| 1423 | } |
| 1424 | } |
| 1425 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1426 | UPB_INLINE void* _upb_map_next(const upb_Map* map, size_t* iter) { |
| 1427 | upb_strtable_iter it; |
| 1428 | it.t = &map->table; |
| 1429 | it.index = *iter; |
| 1430 | upb_strtable_next(&it); |
| 1431 | *iter = it.index; |
| 1432 | if (upb_strtable_done(&it)) return NULL; |
| 1433 | return (void*)str_tabent(&it); |
| 1434 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1435 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1436 | UPB_INLINE void _upb_Map_Clear(upb_Map* map) { |
| 1437 | upb_strtable_clear(&map->table); |
| 1438 | } |
| 1439 | |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 1440 | UPB_INLINE bool _upb_Map_Delete(upb_Map* map, const void* key, size_t key_size, |
| 1441 | upb_value* val) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1442 | upb_StringView k = _upb_map_tokey(key, key_size); |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 1443 | return upb_strtable_remove2(&map->table, k.data, k.size, val); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1444 | } |
| 1445 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1446 | UPB_INLINE bool _upb_Map_Get(const upb_Map* map, const void* key, |
| 1447 | size_t key_size, void* val, size_t val_size) { |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1448 | upb_value tabval; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1449 | upb_StringView k = _upb_map_tokey(key, key_size); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1450 | bool ret = upb_strtable_lookup2(&map->table, k.data, k.size, &tabval); |
| 1451 | if (ret && val) { |
| 1452 | _upb_map_fromvalue(tabval, val, val_size); |
| 1453 | } |
| 1454 | return ret; |
| 1455 | } |
| 1456 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1457 | UPB_INLINE upb_MapInsertStatus _upb_Map_Insert(upb_Map* map, const void* key, |
| 1458 | size_t key_size, void* val, |
| 1459 | size_t val_size, upb_Arena* a) { |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 1460 | upb_StringView strkey = _upb_map_tokey(key, key_size); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1461 | upb_value tabval = {0}; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1462 | if (!_upb_map_tovalue(val, val_size, &tabval, a)) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1463 | return kUpb_MapInsertStatus_OutOfMemory; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1464 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1465 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1466 | // TODO(haberman): add overwrite operation to minimize number of lookups. |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1467 | bool removed = |
| 1468 | upb_strtable_remove2(&map->table, strkey.data, strkey.size, NULL); |
| 1469 | if (!upb_strtable_insert(&map->table, strkey.data, strkey.size, tabval, a)) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1470 | return kUpb_MapInsertStatus_OutOfMemory; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 1471 | } |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1472 | return removed ? kUpb_MapInsertStatus_Replaced |
| 1473 | : kUpb_MapInsertStatus_Inserted; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1474 | } |
| 1475 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1476 | UPB_INLINE size_t _upb_Map_Size(const upb_Map* map) { |
| 1477 | return map->table.t.count; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1478 | } |
| 1479 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 1480 | // Strings/bytes are special-cased in maps. |
| 1481 | extern char _upb_Map_CTypeSizeTable[12]; |
| 1482 | |
| 1483 | UPB_INLINE size_t _upb_Map_CTypeSize(upb_CType ctype) { |
| 1484 | return _upb_Map_CTypeSizeTable[ctype]; |
| 1485 | } |
| 1486 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1487 | // Creates a new map on the given arena with this key/value type. |
| 1488 | upb_Map* _upb_Map_New(upb_Arena* a, size_t key_size, size_t value_size); |
| 1489 | |
| 1490 | #ifdef __cplusplus |
| 1491 | } /* extern "C" */ |
| 1492 | #endif |
| 1493 | |
| 1494 | |
| 1495 | #endif /* UPB_COLLECTIONS_MAP_INTERNAL_H_ */ |
| 1496 | |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 1497 | #ifndef UPB_BASE_LOG2_H_ |
| 1498 | #define UPB_BASE_LOG2_H_ |
| 1499 | |
| 1500 | // Must be last. |
| 1501 | |
| 1502 | #ifdef __cplusplus |
| 1503 | extern "C" { |
| 1504 | #endif |
| 1505 | |
| 1506 | UPB_INLINE int upb_Log2Ceiling(int x) { |
| 1507 | if (x <= 1) return 0; |
| 1508 | #ifdef __GNUC__ |
| 1509 | return 32 - __builtin_clz(x - 1); |
| 1510 | #else |
| 1511 | int lg2 = 0; |
| 1512 | while (1 << lg2 < x) lg2++; |
| 1513 | return lg2; |
| 1514 | #endif |
| 1515 | } |
| 1516 | |
| 1517 | UPB_INLINE int upb_Log2CeilingSize(int x) { return 1 << upb_Log2Ceiling(x); } |
| 1518 | |
| 1519 | #ifdef __cplusplus |
| 1520 | } /* extern "C" */ |
| 1521 | #endif |
| 1522 | |
| 1523 | |
| 1524 | #endif /* UPB_BASE_LOG2_H_ */ |
| 1525 | |
| 1526 | // EVERYTHING BELOW THIS LINE IS INTERNAL - DO NOT USE ///////////////////////// |
| 1527 | |
| 1528 | #ifndef UPB_COLLECTIONS_MAP_SORTER_INTERNAL_H_ |
| 1529 | #define UPB_COLLECTIONS_MAP_SORTER_INTERNAL_H_ |
| 1530 | |
| 1531 | #include <stdlib.h> |
| 1532 | |
| 1533 | |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 1534 | #ifndef UPB_MESSAGE_EXTENSION_INTERNAL_H_ |
| 1535 | #define UPB_MESSAGE_EXTENSION_INTERNAL_H_ |
| 1536 | |
| 1537 | |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 1538 | // Public APIs for message operations that do not depend on the schema. |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1539 | // |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 1540 | // MiniTable-based accessors live in accessors.h. |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1541 | |
| 1542 | #ifndef UPB_MESSAGE_MESSAGE_H_ |
| 1543 | #define UPB_MESSAGE_MESSAGE_H_ |
| 1544 | |
| 1545 | |
| 1546 | // Must be last. |
| 1547 | |
| 1548 | #ifdef __cplusplus |
| 1549 | extern "C" { |
| 1550 | #endif |
| 1551 | |
| 1552 | // 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] | 1553 | UPB_API upb_Message* upb_Message_New(const upb_MiniTable* mini_table, |
| 1554 | upb_Arena* arena); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1555 | |
| 1556 | // Adds unknown data (serialized protobuf data) to the given message. |
| 1557 | // The data is copied into the message instance. |
| 1558 | void upb_Message_AddUnknown(upb_Message* msg, const char* data, size_t len, |
| 1559 | upb_Arena* arena); |
| 1560 | |
| 1561 | // Returns a reference to the message's unknown data. |
| 1562 | const char* upb_Message_GetUnknown(const upb_Message* msg, size_t* len); |
| 1563 | |
| 1564 | // Removes partial unknown data from message. |
| 1565 | void upb_Message_DeleteUnknown(upb_Message* msg, const char* data, size_t len); |
| 1566 | |
| 1567 | // Returns the number of extensions present in this message. |
| 1568 | size_t upb_Message_ExtensionCount(const upb_Message* msg); |
| 1569 | |
| 1570 | #ifdef __cplusplus |
| 1571 | } /* extern "C" */ |
| 1572 | #endif |
| 1573 | |
| 1574 | |
| 1575 | #endif /* UPB_MESSAGE_MESSAGE_H_ */ |
| 1576 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1577 | #ifndef UPB_MINI_TABLE_EXTENSION_INTERNAL_H_ |
| 1578 | #define UPB_MINI_TABLE_EXTENSION_INTERNAL_H_ |
| 1579 | |
| 1580 | |
| 1581 | #ifndef UPB_MINI_TABLE_FIELD_INTERNAL_H_ |
| 1582 | #define UPB_MINI_TABLE_FIELD_INTERNAL_H_ |
| 1583 | |
| 1584 | |
| 1585 | // Must be last. |
| 1586 | |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 1587 | // LINT.IfChange(mini_table_field_layout) |
| 1588 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1589 | struct upb_MiniTableField { |
| 1590 | uint32_t number; |
| 1591 | uint16_t offset; |
| 1592 | int16_t presence; // If >0, hasbit_index. If <0, ~oneof_index |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 1593 | |
| 1594 | // Indexes into `upb_MiniTable.subs` |
| 1595 | // Will be set to `kUpb_NoSub` if `descriptortype` != MESSAGE/GROUP/ENUM |
| 1596 | uint16_t UPB_PRIVATE(submsg_index); |
| 1597 | |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 1598 | uint8_t UPB_PRIVATE(descriptortype); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1599 | |
| 1600 | // upb_FieldMode | upb_LabelFlags | (upb_FieldRep << kUpb_FieldRep_Shift) |
| 1601 | uint8_t mode; |
| 1602 | }; |
| 1603 | |
| 1604 | #define kUpb_NoSub ((uint16_t)-1) |
| 1605 | |
| 1606 | typedef enum { |
| 1607 | kUpb_FieldMode_Map = 0, |
| 1608 | kUpb_FieldMode_Array = 1, |
| 1609 | kUpb_FieldMode_Scalar = 2, |
| 1610 | } upb_FieldMode; |
| 1611 | |
| 1612 | // Mask to isolate the upb_FieldMode from field.mode. |
| 1613 | #define kUpb_FieldMode_Mask 3 |
| 1614 | |
| 1615 | // Extra flags on the mode field. |
| 1616 | typedef enum { |
| 1617 | kUpb_LabelFlags_IsPacked = 4, |
| 1618 | kUpb_LabelFlags_IsExtension = 8, |
| 1619 | // Indicates that this descriptor type is an "alternate type": |
| 1620 | // - for Int32, this indicates that the actual type is Enum (but was |
| 1621 | // rewritten to Int32 because it is an open enum that requires no check). |
| 1622 | // - for Bytes, this indicates that the actual type is String (but does |
| 1623 | // not require any UTF-8 check). |
| 1624 | kUpb_LabelFlags_IsAlternate = 16, |
| 1625 | } upb_LabelFlags; |
| 1626 | |
| 1627 | // Note: we sort by this number when calculating layout order. |
| 1628 | typedef enum { |
| 1629 | kUpb_FieldRep_1Byte = 0, |
| 1630 | kUpb_FieldRep_4Byte = 1, |
| 1631 | kUpb_FieldRep_StringView = 2, |
| 1632 | kUpb_FieldRep_8Byte = 3, |
| 1633 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 1634 | kUpb_FieldRep_NativePointer = |
| 1635 | UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte), |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1636 | kUpb_FieldRep_Max = kUpb_FieldRep_8Byte, |
| 1637 | } upb_FieldRep; |
| 1638 | |
| 1639 | #define kUpb_FieldRep_Shift 6 |
| 1640 | |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 1641 | // LINT.ThenChange(//depot/google3/third_party/upb/js/impl/upb_bits/mini_table_field.ts:mini_table_field_layout) |
| 1642 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1643 | UPB_INLINE upb_FieldRep |
| 1644 | _upb_MiniTableField_GetRep(const upb_MiniTableField* field) { |
| 1645 | return (upb_FieldRep)(field->mode >> kUpb_FieldRep_Shift); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1646 | } |
| 1647 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1648 | #ifdef __cplusplus |
| 1649 | extern "C" { |
| 1650 | #endif |
| 1651 | |
| 1652 | UPB_INLINE upb_FieldMode upb_FieldMode_Get(const upb_MiniTableField* field) { |
| 1653 | return (upb_FieldMode)(field->mode & 3); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1654 | } |
| 1655 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 1656 | UPB_INLINE void _upb_MiniTableField_CheckIsArray( |
| 1657 | const upb_MiniTableField* field) { |
| 1658 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_NativePointer); |
| 1659 | UPB_ASSUME(upb_FieldMode_Get(field) == kUpb_FieldMode_Array); |
| 1660 | UPB_ASSUME(field->presence == 0); |
| 1661 | } |
| 1662 | |
| 1663 | UPB_INLINE void _upb_MiniTableField_CheckIsMap( |
| 1664 | const upb_MiniTableField* field) { |
| 1665 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_NativePointer); |
| 1666 | UPB_ASSUME(upb_FieldMode_Get(field) == kUpb_FieldMode_Map); |
| 1667 | UPB_ASSUME(field->presence == 0); |
| 1668 | } |
| 1669 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1670 | UPB_INLINE bool upb_IsRepeatedOrMap(const upb_MiniTableField* field) { |
| 1671 | // This works because upb_FieldMode has no value 3. |
| 1672 | return !(field->mode & kUpb_FieldMode_Scalar); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1673 | } |
| 1674 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1675 | UPB_INLINE bool upb_IsSubMessage(const upb_MiniTableField* field) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 1676 | return field->UPB_PRIVATE(descriptortype) == kUpb_FieldType_Message || |
| 1677 | field->UPB_PRIVATE(descriptortype) == kUpb_FieldType_Group; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1678 | } |
| 1679 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1680 | // LINT.IfChange(presence_logic) |
| 1681 | |
| 1682 | // Hasbit access /////////////////////////////////////////////////////////////// |
| 1683 | |
| 1684 | UPB_INLINE size_t _upb_hasbit_ofs(size_t idx) { return idx / 8; } |
| 1685 | |
| 1686 | UPB_INLINE char _upb_hasbit_mask(size_t idx) { return 1 << (idx % 8); } |
| 1687 | |
| 1688 | UPB_INLINE bool _upb_hasbit(const upb_Message* msg, size_t idx) { |
| 1689 | return (*UPB_PTR_AT(msg, _upb_hasbit_ofs(idx), const char) & |
| 1690 | _upb_hasbit_mask(idx)) != 0; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1691 | } |
| 1692 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1693 | UPB_INLINE void _upb_sethas(const upb_Message* msg, size_t idx) { |
| 1694 | (*UPB_PTR_AT(msg, _upb_hasbit_ofs(idx), char)) |= _upb_hasbit_mask(idx); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1695 | } |
| 1696 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1697 | UPB_INLINE void _upb_clearhas(const upb_Message* msg, size_t idx) { |
| 1698 | (*UPB_PTR_AT(msg, _upb_hasbit_ofs(idx), char)) &= ~_upb_hasbit_mask(idx); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1699 | } |
| 1700 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1701 | UPB_INLINE size_t _upb_Message_Hasidx(const upb_MiniTableField* f) { |
| 1702 | UPB_ASSERT(f->presence > 0); |
| 1703 | return f->presence; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 1704 | } |
| 1705 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1706 | UPB_INLINE bool _upb_hasbit_field(const upb_Message* msg, |
| 1707 | const upb_MiniTableField* f) { |
| 1708 | return _upb_hasbit(msg, _upb_Message_Hasidx(f)); |
| 1709 | } |
| 1710 | |
| 1711 | UPB_INLINE void _upb_sethas_field(const upb_Message* msg, |
| 1712 | const upb_MiniTableField* f) { |
| 1713 | _upb_sethas(msg, _upb_Message_Hasidx(f)); |
| 1714 | } |
| 1715 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1716 | // Oneof case access /////////////////////////////////////////////////////////// |
| 1717 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1718 | UPB_INLINE size_t _upb_oneofcase_ofs(const upb_MiniTableField* f) { |
| 1719 | UPB_ASSERT(f->presence < 0); |
| 1720 | return ~(ptrdiff_t)f->presence; |
| 1721 | } |
| 1722 | |
| 1723 | UPB_INLINE uint32_t* _upb_oneofcase_field(upb_Message* msg, |
| 1724 | const upb_MiniTableField* f) { |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 1725 | return UPB_PTR_AT(msg, _upb_oneofcase_ofs(f), uint32_t); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1726 | } |
| 1727 | |
| 1728 | UPB_INLINE uint32_t _upb_getoneofcase_field(const upb_Message* msg, |
| 1729 | const upb_MiniTableField* f) { |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 1730 | return *_upb_oneofcase_field((upb_Message*)msg, f); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1731 | } |
| 1732 | |
| 1733 | // LINT.ThenChange(GoogleInternalName2) |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 1734 | // LINT.ThenChange(//depot/google3/third_party/upb/js/impl/upb_bits/presence.ts:presence_logic) |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1735 | |
| 1736 | #ifdef __cplusplus |
| 1737 | } /* extern "C" */ |
| 1738 | #endif |
| 1739 | |
| 1740 | |
| 1741 | #endif /* UPB_MINI_TABLE_FIELD_INTERNAL_H_ */ |
| 1742 | |
| 1743 | #ifndef UPB_MINI_TABLE_SUB_INTERNAL_H_ |
| 1744 | #define UPB_MINI_TABLE_SUB_INTERNAL_H_ |
| 1745 | |
| 1746 | |
| 1747 | union upb_MiniTableSub { |
| 1748 | const upb_MiniTable* submsg; |
| 1749 | const upb_MiniTableEnum* subenum; |
| 1750 | }; |
| 1751 | |
| 1752 | #endif /* UPB_MINI_TABLE_SUB_INTERNAL_H_ */ |
| 1753 | |
| 1754 | // Must be last. |
| 1755 | |
| 1756 | struct upb_MiniTableExtension { |
Deanna Garcia | 59cfc2f | 2023-01-31 13:19:28 -0800 | [diff] [blame] | 1757 | // Do not move this field. We need to be able to alias pointers. |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1758 | upb_MiniTableField field; |
Deanna Garcia | 59cfc2f | 2023-01-31 13:19:28 -0800 | [diff] [blame] | 1759 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1760 | const upb_MiniTable* extendee; |
| 1761 | upb_MiniTableSub sub; // NULL unless submessage or proto2 enum |
| 1762 | }; |
| 1763 | |
| 1764 | |
| 1765 | #endif /* UPB_MINI_TABLE_EXTENSION_INTERNAL_H_ */ |
| 1766 | |
| 1767 | // Must be last. |
| 1768 | |
| 1769 | // The internal representation of an extension is self-describing: it contains |
| 1770 | // enough information that we can serialize it to binary format without needing |
| 1771 | // to look it up in a upb_ExtensionRegistry. |
| 1772 | // |
| 1773 | // This representation allocates 16 bytes to data on 64-bit platforms. |
| 1774 | // This is rather wasteful for scalars (in the extreme case of bool, |
| 1775 | // it wastes 15 bytes). We accept this because we expect messages to be |
| 1776 | // the most common extension type. |
| 1777 | typedef struct { |
| 1778 | const upb_MiniTableExtension* ext; |
| 1779 | union { |
| 1780 | upb_StringView str; |
| 1781 | void* ptr; |
| 1782 | char scalar_data[8]; |
| 1783 | } data; |
| 1784 | } upb_Message_Extension; |
| 1785 | |
| 1786 | #ifdef __cplusplus |
| 1787 | extern "C" { |
| 1788 | #endif |
| 1789 | |
| 1790 | // Adds the given extension data to the given message. |
| 1791 | // |ext| is copied into the message instance. |
| 1792 | // This logically replaces any previously-added extension with this number. |
| 1793 | upb_Message_Extension* _upb_Message_GetOrCreateExtension( |
| 1794 | upb_Message* msg, const upb_MiniTableExtension* ext, upb_Arena* arena); |
| 1795 | |
| 1796 | // Returns an array of extensions for this message. |
| 1797 | // Note: the array is ordered in reverse relative to the order of creation. |
| 1798 | const upb_Message_Extension* _upb_Message_Getexts(const upb_Message* msg, |
| 1799 | size_t* count); |
| 1800 | |
| 1801 | // Returns an extension for the given field number, or NULL if no extension |
| 1802 | // exists for this field number. |
| 1803 | const upb_Message_Extension* _upb_Message_Getext( |
| 1804 | const upb_Message* msg, const upb_MiniTableExtension* ext); |
| 1805 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 1806 | #ifdef __cplusplus |
| 1807 | } /* extern "C" */ |
| 1808 | #endif |
| 1809 | |
| 1810 | |
| 1811 | #endif /* UPB_MESSAGE_EXTENSION_INTERNAL_H_ */ |
| 1812 | |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 1813 | #ifndef UPB_MINI_TABLE_MESSAGE_INTERNAL_H_ |
| 1814 | #define UPB_MINI_TABLE_MESSAGE_INTERNAL_H_ |
| 1815 | |
| 1816 | |
| 1817 | // Must be last. |
| 1818 | |
| 1819 | struct upb_Decoder; |
| 1820 | typedef const char* _upb_FieldParser(struct upb_Decoder* d, const char* ptr, |
| 1821 | upb_Message* msg, intptr_t table, |
| 1822 | uint64_t hasbits, uint64_t data); |
| 1823 | typedef struct { |
| 1824 | uint64_t field_data; |
| 1825 | _upb_FieldParser* field_parser; |
| 1826 | } _upb_FastTable_Entry; |
| 1827 | |
| 1828 | typedef enum { |
| 1829 | kUpb_ExtMode_NonExtendable = 0, // Non-extendable message. |
| 1830 | kUpb_ExtMode_Extendable = 1, // Normal extendable message. |
| 1831 | kUpb_ExtMode_IsMessageSet = 2, // MessageSet message. |
| 1832 | kUpb_ExtMode_IsMessageSet_ITEM = |
| 1833 | 3, // MessageSet item (temporary only, see decode.c) |
| 1834 | |
| 1835 | // During table building we steal a bit to indicate that the message is a map |
| 1836 | // entry. *Only* used during table building! |
| 1837 | kUpb_ExtMode_IsMapEntry = 4, |
| 1838 | } upb_ExtMode; |
| 1839 | |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 1840 | // LINT.IfChange(mini_table_layout) |
| 1841 | |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 1842 | // upb_MiniTable represents the memory layout of a given upb_MessageDef. |
| 1843 | // The members are public so generated code can initialize them, |
| 1844 | // but users MUST NOT directly read or write any of its members. |
| 1845 | struct upb_MiniTable { |
| 1846 | const upb_MiniTableSub* subs; |
| 1847 | const upb_MiniTableField* fields; |
| 1848 | |
| 1849 | // Must be aligned to sizeof(void*). Doesn't include internal members like |
| 1850 | // unknown fields, extension dict, pointer to msglayout, etc. |
| 1851 | uint16_t size; |
| 1852 | |
| 1853 | uint16_t field_count; |
| 1854 | uint8_t ext; // upb_ExtMode, declared as uint8_t so sizeof(ext) == 1 |
| 1855 | uint8_t dense_below; |
| 1856 | uint8_t table_mask; |
| 1857 | uint8_t required_count; // Required fields have the lowest hasbits. |
| 1858 | |
| 1859 | // To statically initialize the tables of variable length, we need a flexible |
| 1860 | // array member, and we need to compile in gnu99 mode (constant initialization |
| 1861 | // of flexible array members is a GNU extension, not in C99 unfortunately. |
| 1862 | _upb_FastTable_Entry fasttable[]; |
| 1863 | }; |
| 1864 | |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 1865 | // LINT.ThenChange(//depot/google3/third_party/upb/js/impl/upb_bits/mini_table.ts:presence_logic) |
| 1866 | |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 1867 | // Map entries aren't actually stored for map fields, they are only used during |
| 1868 | // parsing. For parsing, it helps a lot if all map entry messages have the same |
| 1869 | // layout. The layout code in mini_table/decode.c will ensure that all map |
| 1870 | // entries have this layout. |
| 1871 | // |
| 1872 | // Note that users can and do create map entries directly, which will also use |
| 1873 | // this layout. |
| 1874 | // |
| 1875 | // NOTE: sync with mini_table/decode.c. |
| 1876 | typedef struct { |
| 1877 | // We only need 2 hasbits max, but due to alignment we'll use 8 bytes here, |
| 1878 | // and the uint64_t helps make this clear. |
| 1879 | uint64_t hasbits; |
| 1880 | union { |
| 1881 | upb_StringView str; // For str/bytes. |
| 1882 | upb_value val; // For all other types. |
| 1883 | } k; |
| 1884 | union { |
| 1885 | upb_StringView str; // For str/bytes. |
| 1886 | upb_value val; // For all other types. |
| 1887 | } v; |
| 1888 | } upb_MapEntryData; |
| 1889 | |
| 1890 | typedef struct { |
| 1891 | void* internal_data; |
| 1892 | upb_MapEntryData data; |
| 1893 | } upb_MapEntry; |
| 1894 | |
| 1895 | #ifdef __cplusplus |
| 1896 | extern "C" { |
| 1897 | #endif |
| 1898 | |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 1899 | // A MiniTable for an empty message, used for unlinked sub-messages. |
| 1900 | extern const upb_MiniTable _kUpb_MiniTable_Empty; |
| 1901 | |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 1902 | // Computes a bitmask in which the |l->required_count| lowest bits are set, |
| 1903 | // except that we skip the lowest bit (because upb never uses hasbit 0). |
| 1904 | // |
| 1905 | // Sample output: |
| 1906 | // requiredmask(1) => 0b10 (0x2) |
| 1907 | // requiredmask(5) => 0b111110 (0x3e) |
| 1908 | UPB_INLINE uint64_t upb_MiniTable_requiredmask(const upb_MiniTable* l) { |
| 1909 | int n = l->required_count; |
| 1910 | assert(0 < n && n <= 63); |
| 1911 | return ((1ULL << n) - 1) << 1; |
| 1912 | } |
| 1913 | |
| 1914 | #ifdef __cplusplus |
| 1915 | } /* extern "C" */ |
| 1916 | #endif |
| 1917 | |
| 1918 | |
| 1919 | #endif /* UPB_MINI_TABLE_MESSAGE_INTERNAL_H_ */ |
| 1920 | |
| 1921 | // Must be last. |
| 1922 | |
| 1923 | #ifdef __cplusplus |
| 1924 | extern "C" { |
| 1925 | #endif |
| 1926 | |
| 1927 | // _upb_mapsorter sorts maps and provides ordered iteration over the entries. |
| 1928 | // Since maps can be recursive (map values can be messages which contain other |
| 1929 | // maps), _upb_mapsorter can contain a stack of maps. |
| 1930 | |
| 1931 | typedef struct { |
| 1932 | void const** entries; |
| 1933 | int size; |
| 1934 | int cap; |
| 1935 | } _upb_mapsorter; |
| 1936 | |
| 1937 | typedef struct { |
| 1938 | int start; |
| 1939 | int pos; |
| 1940 | int end; |
| 1941 | } _upb_sortedmap; |
| 1942 | |
| 1943 | UPB_INLINE void _upb_mapsorter_init(_upb_mapsorter* s) { |
| 1944 | s->entries = NULL; |
| 1945 | s->size = 0; |
| 1946 | s->cap = 0; |
| 1947 | } |
| 1948 | |
| 1949 | UPB_INLINE void _upb_mapsorter_destroy(_upb_mapsorter* s) { |
| 1950 | if (s->entries) free(s->entries); |
| 1951 | } |
| 1952 | |
| 1953 | UPB_INLINE bool _upb_sortedmap_next(_upb_mapsorter* s, const upb_Map* map, |
| 1954 | _upb_sortedmap* sorted, upb_MapEntry* ent) { |
| 1955 | if (sorted->pos == sorted->end) return false; |
| 1956 | const upb_tabent* tabent = (const upb_tabent*)s->entries[sorted->pos++]; |
| 1957 | upb_StringView key = upb_tabstrview(tabent->key); |
| 1958 | _upb_map_fromkey(key, &ent->data.k, map->key_size); |
| 1959 | upb_value val = {tabent->val.val}; |
| 1960 | _upb_map_fromvalue(val, &ent->data.v, map->val_size); |
| 1961 | return true; |
| 1962 | } |
| 1963 | |
| 1964 | UPB_INLINE bool _upb_sortedmap_nextext(_upb_mapsorter* s, |
| 1965 | _upb_sortedmap* sorted, |
| 1966 | const upb_Message_Extension** ext) { |
| 1967 | if (sorted->pos == sorted->end) return false; |
| 1968 | *ext = (const upb_Message_Extension*)s->entries[sorted->pos++]; |
| 1969 | return true; |
| 1970 | } |
| 1971 | |
| 1972 | UPB_INLINE void _upb_mapsorter_popmap(_upb_mapsorter* s, |
| 1973 | _upb_sortedmap* sorted) { |
| 1974 | s->size = sorted->start; |
| 1975 | } |
| 1976 | |
| 1977 | bool _upb_mapsorter_pushmap(_upb_mapsorter* s, upb_FieldType key_type, |
| 1978 | const upb_Map* map, _upb_sortedmap* sorted); |
| 1979 | |
| 1980 | bool _upb_mapsorter_pushexts(_upb_mapsorter* s, |
| 1981 | const upb_Message_Extension* exts, size_t count, |
| 1982 | _upb_sortedmap* sorted); |
| 1983 | |
| 1984 | #ifdef __cplusplus |
| 1985 | } /* extern "C" */ |
| 1986 | #endif |
| 1987 | |
| 1988 | |
| 1989 | #endif /* UPB_COLLECTIONS_MAP_SORTER_INTERNAL_H_ */ |
| 1990 | |
| 1991 | /* |
| 1992 | ** Our memory representation for parsing tables and messages themselves. |
| 1993 | ** Functions in this file are used by generated code and possibly reflection. |
| 1994 | ** |
| 1995 | ** The definitions in this file are internal to upb. |
| 1996 | **/ |
| 1997 | |
| 1998 | #ifndef UPB_MESSAGE_INTERNAL_H_ |
| 1999 | #define UPB_MESSAGE_INTERNAL_H_ |
| 2000 | |
| 2001 | #include <stdlib.h> |
| 2002 | #include <string.h> |
| 2003 | |
| 2004 | |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 2005 | #ifndef UPB_MINI_TABLE_EXTENSION_REGISTRY_H_ |
| 2006 | #define UPB_MINI_TABLE_EXTENSION_REGISTRY_H_ |
| 2007 | |
| 2008 | |
| 2009 | // Must be last. |
| 2010 | |
| 2011 | #ifdef __cplusplus |
| 2012 | extern "C" { |
| 2013 | #endif |
| 2014 | |
| 2015 | /* Extension registry: a dynamic data structure that stores a map of: |
| 2016 | * (upb_MiniTable, number) -> extension info |
| 2017 | * |
| 2018 | * upb_decode() uses upb_ExtensionRegistry to look up extensions while parsing |
| 2019 | * binary format. |
| 2020 | * |
| 2021 | * upb_ExtensionRegistry is part of the mini-table (msglayout) family of |
| 2022 | * objects. Like all mini-table objects, it is suitable for reflection-less |
| 2023 | * builds that do not want to expose names into the binary. |
| 2024 | * |
| 2025 | * Unlike most mini-table types, upb_ExtensionRegistry requires dynamic memory |
| 2026 | * allocation and dynamic initialization: |
| 2027 | * * If reflection is being used, then upb_DefPool will construct an appropriate |
| 2028 | * upb_ExtensionRegistry automatically. |
| 2029 | * * For a mini-table only build, the user must manually construct the |
| 2030 | * upb_ExtensionRegistry and populate it with all of the extensions the user |
| 2031 | * cares about. |
| 2032 | * * A third alternative is to manually unpack relevant extensions after the |
| 2033 | * main parse is complete, similar to how Any works. This is perhaps the |
| 2034 | * nicest solution from the perspective of reducing dependencies, avoiding |
| 2035 | * dynamic memory allocation, and avoiding the need to parse uninteresting |
| 2036 | * extensions. The downsides are: |
| 2037 | * (1) parse errors are not caught during the main parse |
| 2038 | * (2) the CPU hit of parsing comes during access, which could cause an |
| 2039 | * undesirable stutter in application performance. |
| 2040 | * |
| 2041 | * Users cannot directly get or put into this map. Users can only add the |
| 2042 | * extensions from a generated module and pass the extension registry to the |
| 2043 | * binary decoder. |
| 2044 | * |
| 2045 | * A upb_DefPool provides a upb_ExtensionRegistry, so any users who use |
| 2046 | * reflection do not need to populate a upb_ExtensionRegistry directly. |
| 2047 | */ |
| 2048 | |
| 2049 | typedef struct upb_ExtensionRegistry upb_ExtensionRegistry; |
| 2050 | |
| 2051 | // Creates a upb_ExtensionRegistry in the given arena. |
| 2052 | // The arena must outlive any use of the extreg. |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2053 | UPB_API upb_ExtensionRegistry* upb_ExtensionRegistry_New(upb_Arena* arena); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 2054 | |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 2055 | UPB_API bool upb_ExtensionRegistry_Add(upb_ExtensionRegistry* r, |
| 2056 | const upb_MiniTableExtension* e); |
| 2057 | |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 2058 | // Adds the given extension info for the array |e| of size |count| into the |
| 2059 | // registry. If there are any errors, the entire array is backed out. |
| 2060 | // The extensions must outlive the registry. |
| 2061 | // Possible errors include OOM or an extension number that already exists. |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 2062 | // TODO(salo): There is currently no way to know the exact reason for failure. |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 2063 | bool upb_ExtensionRegistry_AddArray(upb_ExtensionRegistry* r, |
| 2064 | const upb_MiniTableExtension** e, |
| 2065 | size_t count); |
| 2066 | |
| 2067 | // Looks up the extension (if any) defined for message type |t| and field |
| 2068 | // number |num|. Returns the extension if found, otherwise NULL. |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 2069 | UPB_API const upb_MiniTableExtension* upb_ExtensionRegistry_Lookup( |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 2070 | const upb_ExtensionRegistry* r, const upb_MiniTable* t, uint32_t num); |
| 2071 | |
| 2072 | #ifdef __cplusplus |
| 2073 | } /* extern "C" */ |
| 2074 | #endif |
| 2075 | |
| 2076 | |
| 2077 | #endif /* UPB_MINI_TABLE_EXTENSION_REGISTRY_H_ */ |
| 2078 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2079 | #ifndef UPB_MINI_TABLE_FILE_INTERNAL_H_ |
| 2080 | #define UPB_MINI_TABLE_FILE_INTERNAL_H_ |
| 2081 | |
| 2082 | |
| 2083 | // Must be last. |
| 2084 | |
| 2085 | struct upb_MiniTableFile { |
| 2086 | const upb_MiniTable** msgs; |
| 2087 | const upb_MiniTableEnum** enums; |
| 2088 | const upb_MiniTableExtension** exts; |
| 2089 | int msg_count; |
| 2090 | int enum_count; |
| 2091 | int ext_count; |
| 2092 | }; |
| 2093 | |
| 2094 | |
| 2095 | #endif /* UPB_MINI_TABLE_FILE_INTERNAL_H_ */ |
| 2096 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2097 | // Must be last. |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 2098 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2099 | #ifdef __cplusplus |
| 2100 | extern "C" { |
| 2101 | #endif |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 2102 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2103 | extern const float kUpb_FltInfinity; |
| 2104 | extern const double kUpb_Infinity; |
| 2105 | extern const double kUpb_NaN; |
| 2106 | |
| 2107 | /* Internal members of a upb_Message that track unknown fields and/or |
| 2108 | * extensions. We can change this without breaking binary compatibility. We put |
| 2109 | * these before the user's data. The user's upb_Message* points after the |
| 2110 | * upb_Message_Internal. */ |
| 2111 | |
| 2112 | typedef struct { |
| 2113 | /* Total size of this structure, including the data that follows. |
| 2114 | * Must be aligned to 8, which is alignof(upb_Message_Extension) */ |
| 2115 | uint32_t size; |
| 2116 | |
| 2117 | /* Offsets relative to the beginning of this structure. |
| 2118 | * |
| 2119 | * Unknown data grows forward from the beginning to unknown_end. |
| 2120 | * Extension data grows backward from size to ext_begin. |
| 2121 | * When the two meet, we're out of data and have to realloc. |
| 2122 | * |
| 2123 | * If we imagine that the final member of this struct is: |
| 2124 | * char data[size - overhead]; // overhead = |
| 2125 | * sizeof(upb_Message_InternalData) |
| 2126 | * |
| 2127 | * Then we have: |
| 2128 | * unknown data: data[0 .. (unknown_end - overhead)] |
| 2129 | * extensions data: data[(ext_begin - overhead) .. (size - overhead)] */ |
| 2130 | uint32_t unknown_end; |
| 2131 | uint32_t ext_begin; |
| 2132 | /* Data follows, as if there were an array: |
| 2133 | * char data[size - sizeof(upb_Message_InternalData)]; */ |
| 2134 | } upb_Message_InternalData; |
| 2135 | |
| 2136 | typedef struct { |
| 2137 | upb_Message_InternalData* internal; |
| 2138 | /* Message data follows. */ |
| 2139 | } upb_Message_Internal; |
| 2140 | |
| 2141 | /* Maps upb_CType -> memory size. */ |
| 2142 | extern char _upb_CTypeo_size[12]; |
| 2143 | |
| 2144 | UPB_INLINE size_t upb_msg_sizeof(const upb_MiniTable* t) { |
| 2145 | return t->size + sizeof(upb_Message_Internal); |
| 2146 | } |
| 2147 | |
| 2148 | // Inline version upb_Message_New(), for internal use. |
| 2149 | UPB_INLINE upb_Message* _upb_Message_New(const upb_MiniTable* mini_table, |
| 2150 | upb_Arena* arena) { |
| 2151 | size_t size = upb_msg_sizeof(mini_table); |
| 2152 | void* mem = upb_Arena_Malloc(arena, size + sizeof(upb_Message_Internal)); |
| 2153 | if (UPB_UNLIKELY(!mem)) return NULL; |
| 2154 | upb_Message* msg = UPB_PTR_AT(mem, sizeof(upb_Message_Internal), upb_Message); |
| 2155 | memset(mem, 0, size); |
| 2156 | return msg; |
| 2157 | } |
| 2158 | |
| 2159 | UPB_INLINE upb_Message_Internal* upb_Message_Getinternal( |
| 2160 | const upb_Message* msg) { |
| 2161 | ptrdiff_t size = sizeof(upb_Message_Internal); |
| 2162 | return (upb_Message_Internal*)((char*)msg - size); |
| 2163 | } |
| 2164 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2165 | // Discards the unknown fields for this message only. |
| 2166 | void _upb_Message_DiscardUnknown_shallow(upb_Message* msg); |
| 2167 | |
| 2168 | // Adds unknown data (serialized protobuf data) to the given message. |
| 2169 | // The data is copied into the message instance. |
| 2170 | bool _upb_Message_AddUnknown(upb_Message* msg, const char* data, size_t len, |
| 2171 | upb_Arena* arena); |
| 2172 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2173 | #ifdef __cplusplus |
| 2174 | } /* extern "C" */ |
| 2175 | #endif |
| 2176 | |
| 2177 | |
| 2178 | #endif /* UPB_MESSAGE_INTERNAL_H_ */ |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 2179 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2180 | #ifndef UPB_MINI_TABLE_ENUM_INTERNAL_H_ |
| 2181 | #define UPB_MINI_TABLE_ENUM_INTERNAL_H_ |
| 2182 | |
| 2183 | |
| 2184 | // Must be last. |
| 2185 | |
| 2186 | struct upb_MiniTableEnum { |
| 2187 | uint32_t mask_limit; // Limit enum value that can be tested with mask. |
| 2188 | uint32_t value_count; // Number of values after the bitfield. |
| 2189 | uint32_t data[]; // Bitmask + enumerated values follow. |
| 2190 | }; |
| 2191 | |
| 2192 | typedef enum { |
| 2193 | _kUpb_FastEnumCheck_ValueIsInEnum = 0, |
| 2194 | _kUpb_FastEnumCheck_ValueIsNotInEnum = 1, |
| 2195 | _kUpb_FastEnumCheck_CannotCheckFast = 2, |
| 2196 | } _kUpb_FastEnumCheck_Status; |
| 2197 | |
| 2198 | #ifdef __cplusplus |
| 2199 | extern "C" { |
| 2200 | #endif |
| 2201 | |
| 2202 | UPB_INLINE _kUpb_FastEnumCheck_Status |
| 2203 | _upb_MiniTable_CheckEnumValueFast(const upb_MiniTableEnum* e, uint32_t val) { |
| 2204 | if (UPB_UNLIKELY(val >= 64)) return _kUpb_FastEnumCheck_CannotCheckFast; |
| 2205 | uint64_t mask = e->data[0] | ((uint64_t)e->data[1] << 32); |
| 2206 | return (mask & (1ULL << val)) ? _kUpb_FastEnumCheck_ValueIsInEnum |
| 2207 | : _kUpb_FastEnumCheck_ValueIsNotInEnum; |
| 2208 | } |
| 2209 | |
| 2210 | UPB_INLINE bool _upb_MiniTable_CheckEnumValueSlow(const upb_MiniTableEnum* e, |
| 2211 | uint32_t val) { |
| 2212 | if (val < e->mask_limit) return e->data[val / 32] & (1ULL << (val % 32)); |
| 2213 | // OPT: binary search long lists? |
| 2214 | const uint32_t* start = &e->data[e->mask_limit / 32]; |
| 2215 | const uint32_t* limit = &e->data[(e->mask_limit / 32) + e->value_count]; |
| 2216 | for (const uint32_t* p = start; p < limit; p++) { |
| 2217 | if (*p == val) return true; |
| 2218 | } |
| 2219 | return false; |
| 2220 | } |
| 2221 | |
| 2222 | // Validates enum value against range defined by enum mini table. |
| 2223 | UPB_INLINE bool upb_MiniTableEnum_CheckValue(const upb_MiniTableEnum* e, |
| 2224 | uint32_t val) { |
| 2225 | _kUpb_FastEnumCheck_Status status = _upb_MiniTable_CheckEnumValueFast(e, val); |
| 2226 | if (UPB_UNLIKELY(status == _kUpb_FastEnumCheck_CannotCheckFast)) { |
| 2227 | return _upb_MiniTable_CheckEnumValueSlow(e, val); |
| 2228 | } |
| 2229 | return status == _kUpb_FastEnumCheck_ValueIsInEnum ? true : false; |
| 2230 | } |
| 2231 | |
| 2232 | #ifdef __cplusplus |
| 2233 | } /* extern "C" */ |
| 2234 | #endif |
| 2235 | |
| 2236 | |
| 2237 | #endif /* UPB_MINI_TABLE_ENUM_INTERNAL_H_ */ |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 2238 | /* This file was generated by upbc (the upb compiler) from the input |
| 2239 | * file: |
| 2240 | * |
| 2241 | * google/protobuf/descriptor.proto |
| 2242 | * |
| 2243 | * Do not edit -- your changes will be discarded when the file is |
| 2244 | * regenerated. */ |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 2245 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 2246 | #ifndef GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_H_ |
| 2247 | #define GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_H_ |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 2248 | |
| 2249 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2250 | // These functions are only used by generated code. |
| 2251 | |
| 2252 | #ifndef UPB_COLLECTIONS_MAP_GENCODE_UTIL_H_ |
| 2253 | #define UPB_COLLECTIONS_MAP_GENCODE_UTIL_H_ |
| 2254 | |
| 2255 | |
| 2256 | // Must be last. |
| 2257 | |
| 2258 | #ifdef __cplusplus |
| 2259 | extern "C" { |
| 2260 | #endif |
| 2261 | |
| 2262 | // Message map operations, these get the map from the message first. |
| 2263 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2264 | UPB_INLINE void _upb_msg_map_key(const void* msg, void* key, size_t size) { |
| 2265 | const upb_tabent* ent = (const upb_tabent*)msg; |
| 2266 | uint32_t u32len; |
| 2267 | upb_StringView k; |
| 2268 | k.data = upb_tabstr(ent->key, &u32len); |
| 2269 | k.size = u32len; |
| 2270 | _upb_map_fromkey(k, key, size); |
| 2271 | } |
| 2272 | |
| 2273 | UPB_INLINE void _upb_msg_map_value(const void* msg, void* val, size_t size) { |
| 2274 | const upb_tabent* ent = (const upb_tabent*)msg; |
| 2275 | upb_value v = {ent->val.val}; |
| 2276 | _upb_map_fromvalue(v, val, size); |
| 2277 | } |
| 2278 | |
| 2279 | UPB_INLINE void _upb_msg_map_set_value(void* msg, const void* val, |
| 2280 | size_t size) { |
| 2281 | upb_tabent* ent = (upb_tabent*)msg; |
| 2282 | // This is like _upb_map_tovalue() except the entry already exists |
| 2283 | // so we can reuse the allocated upb_StringView for string fields. |
| 2284 | if (size == UPB_MAPTYPE_STRING) { |
| 2285 | upb_StringView* strp = (upb_StringView*)(uintptr_t)ent->val.val; |
| 2286 | memcpy(strp, val, sizeof(*strp)); |
| 2287 | } else { |
| 2288 | memcpy(&ent->val.val, val, size); |
| 2289 | } |
| 2290 | } |
| 2291 | |
| 2292 | #ifdef __cplusplus |
| 2293 | } /* extern "C" */ |
| 2294 | #endif |
| 2295 | |
| 2296 | |
| 2297 | #endif /* UPB_COLLECTIONS_MAP_GENCODE_UTIL_H_ */ |
| 2298 | |
| 2299 | #ifndef UPB_MESSAGE_ACCESSORS_H_ |
| 2300 | #define UPB_MESSAGE_ACCESSORS_H_ |
| 2301 | |
| 2302 | |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2303 | #ifndef UPB_MESSAGE_ACCESSORS_INTERNAL_H_ |
| 2304 | #define UPB_MESSAGE_ACCESSORS_INTERNAL_H_ |
| 2305 | |
| 2306 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2307 | #ifndef UPB_MINI_TABLE_COMMON_H_ |
| 2308 | #define UPB_MINI_TABLE_COMMON_H_ |
| 2309 | |
| 2310 | |
| 2311 | // Must be last. |
| 2312 | |
| 2313 | typedef enum { |
| 2314 | kUpb_FieldModifier_IsRepeated = 1 << 0, |
| 2315 | kUpb_FieldModifier_IsPacked = 1 << 1, |
| 2316 | kUpb_FieldModifier_IsClosedEnum = 1 << 2, |
| 2317 | kUpb_FieldModifier_IsProto3Singular = 1 << 3, |
| 2318 | kUpb_FieldModifier_IsRequired = 1 << 4, |
| 2319 | } kUpb_FieldModifier; |
| 2320 | |
| 2321 | typedef enum { |
| 2322 | kUpb_MessageModifier_ValidateUtf8 = 1 << 0, |
| 2323 | kUpb_MessageModifier_DefaultIsPacked = 1 << 1, |
| 2324 | kUpb_MessageModifier_IsExtendable = 1 << 2, |
| 2325 | } kUpb_MessageModifier; |
| 2326 | |
| 2327 | #ifdef __cplusplus |
| 2328 | extern "C" { |
| 2329 | #endif |
| 2330 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 2331 | UPB_API const upb_MiniTableField* upb_MiniTable_FindFieldByNumber( |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2332 | const upb_MiniTable* table, uint32_t number); |
| 2333 | |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 2334 | UPB_API_INLINE const upb_MiniTableField* upb_MiniTable_GetFieldByIndex( |
| 2335 | const upb_MiniTable* t, uint32_t index) { |
| 2336 | return &t->fields[index]; |
| 2337 | } |
| 2338 | |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 2339 | UPB_API_INLINE upb_FieldType |
| 2340 | upb_MiniTableField_Type(const upb_MiniTableField* field) { |
| 2341 | if (field->mode & kUpb_LabelFlags_IsAlternate) { |
| 2342 | if (field->UPB_PRIVATE(descriptortype) == kUpb_FieldType_Int32) { |
| 2343 | return kUpb_FieldType_Enum; |
| 2344 | } else if (field->UPB_PRIVATE(descriptortype) == kUpb_FieldType_Bytes) { |
| 2345 | return kUpb_FieldType_String; |
| 2346 | } else { |
| 2347 | UPB_ASSERT(false); |
| 2348 | } |
| 2349 | } |
| 2350 | return (upb_FieldType)field->UPB_PRIVATE(descriptortype); |
| 2351 | } |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2352 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 2353 | UPB_API_INLINE upb_CType upb_MiniTableField_CType(const upb_MiniTableField* f) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 2354 | switch (upb_MiniTableField_Type(f)) { |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 2355 | case kUpb_FieldType_Double: |
| 2356 | return kUpb_CType_Double; |
| 2357 | case kUpb_FieldType_Float: |
| 2358 | return kUpb_CType_Float; |
| 2359 | case kUpb_FieldType_Int64: |
| 2360 | case kUpb_FieldType_SInt64: |
| 2361 | case kUpb_FieldType_SFixed64: |
| 2362 | return kUpb_CType_Int64; |
| 2363 | case kUpb_FieldType_Int32: |
| 2364 | case kUpb_FieldType_SFixed32: |
| 2365 | case kUpb_FieldType_SInt32: |
| 2366 | return kUpb_CType_Int32; |
| 2367 | case kUpb_FieldType_UInt64: |
| 2368 | case kUpb_FieldType_Fixed64: |
| 2369 | return kUpb_CType_UInt64; |
| 2370 | case kUpb_FieldType_UInt32: |
| 2371 | case kUpb_FieldType_Fixed32: |
| 2372 | return kUpb_CType_UInt32; |
| 2373 | case kUpb_FieldType_Enum: |
| 2374 | return kUpb_CType_Enum; |
| 2375 | case kUpb_FieldType_Bool: |
| 2376 | return kUpb_CType_Bool; |
| 2377 | case kUpb_FieldType_String: |
| 2378 | return kUpb_CType_String; |
| 2379 | case kUpb_FieldType_Bytes: |
| 2380 | return kUpb_CType_Bytes; |
| 2381 | case kUpb_FieldType_Group: |
| 2382 | case kUpb_FieldType_Message: |
| 2383 | return kUpb_CType_Message; |
| 2384 | } |
| 2385 | UPB_UNREACHABLE(); |
| 2386 | } |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 2387 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 2388 | UPB_API_INLINE bool upb_MiniTableField_IsExtension( |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2389 | const upb_MiniTableField* field) { |
| 2390 | return field->mode & kUpb_LabelFlags_IsExtension; |
| 2391 | } |
| 2392 | |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2393 | UPB_API_INLINE bool upb_MiniTableField_IsClosedEnum( |
| 2394 | const upb_MiniTableField* field) { |
| 2395 | return field->UPB_PRIVATE(descriptortype) == kUpb_FieldType_Enum; |
| 2396 | } |
| 2397 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 2398 | UPB_API_INLINE bool upb_MiniTableField_HasPresence( |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 2399 | const upb_MiniTableField* field) { |
| 2400 | if (upb_MiniTableField_IsExtension(field)) { |
| 2401 | return !upb_IsRepeatedOrMap(field); |
| 2402 | } else { |
| 2403 | return field->presence != 0; |
| 2404 | } |
| 2405 | } |
| 2406 | |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 2407 | // Returns the MiniTable for this message field. If the field is unlinked, |
| 2408 | // returns NULL. |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 2409 | UPB_API_INLINE const upb_MiniTable* upb_MiniTable_GetSubMessageTable( |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2410 | const upb_MiniTable* mini_table, const upb_MiniTableField* field) { |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 2411 | UPB_ASSERT(upb_MiniTableField_CType(field) == kUpb_CType_Message); |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 2412 | const upb_MiniTable* ret = |
| 2413 | mini_table->subs[field->UPB_PRIVATE(submsg_index)].submsg; |
| 2414 | UPB_ASSUME(ret); |
| 2415 | return ret == &_kUpb_MiniTable_Empty ? NULL : ret; |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2416 | } |
| 2417 | |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 2418 | // Returns the MiniTableEnum for this enum field. If the field is unlinked, |
| 2419 | // returns NULL. |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 2420 | UPB_API_INLINE const upb_MiniTableEnum* upb_MiniTable_GetSubEnumTable( |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2421 | const upb_MiniTable* mini_table, const upb_MiniTableField* field) { |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 2422 | UPB_ASSERT(upb_MiniTableField_CType(field) == kUpb_CType_Enum); |
| 2423 | return mini_table->subs[field->UPB_PRIVATE(submsg_index)].subenum; |
| 2424 | } |
| 2425 | |
| 2426 | // Returns true if this MiniTable field is linked to a MiniTable for the |
| 2427 | // sub-message. |
| 2428 | UPB_API_INLINE bool upb_MiniTable_MessageFieldIsLinked( |
| 2429 | const upb_MiniTable* mini_table, const upb_MiniTableField* field) { |
| 2430 | return upb_MiniTable_GetSubMessageTable(mini_table, field) != NULL; |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2431 | } |
| 2432 | |
Mike Kruskal | ccbdaa7 | 2023-02-02 20:42:14 -0800 | [diff] [blame] | 2433 | // If this field is in a oneof, returns the first field in the oneof. |
| 2434 | // |
| 2435 | // Otherwise returns NULL. |
| 2436 | // |
| 2437 | // Usage: |
| 2438 | // const upb_MiniTableField* field = upb_MiniTable_GetOneof(m, f); |
| 2439 | // do { |
| 2440 | // .. |
| 2441 | // } while (upb_MiniTable_NextOneofField(m, &field); |
| 2442 | // |
| 2443 | const upb_MiniTableField* upb_MiniTable_GetOneof(const upb_MiniTable* m, |
| 2444 | const upb_MiniTableField* f); |
| 2445 | |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 2446 | // Iterates to the next field in the oneof. If this is the last field in the |
| 2447 | // oneof, returns false. The ordering of fields in the oneof is not |
Mike Kruskal | ccbdaa7 | 2023-02-02 20:42:14 -0800 | [diff] [blame] | 2448 | // guaranteed. |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 2449 | // REQUIRES: |f| is the field initialized by upb_MiniTable_GetOneof and updated |
| 2450 | // by prior upb_MiniTable_NextOneofField calls. |
Mike Kruskal | ccbdaa7 | 2023-02-02 20:42:14 -0800 | [diff] [blame] | 2451 | bool upb_MiniTable_NextOneofField(const upb_MiniTable* m, |
| 2452 | const upb_MiniTableField** f); |
| 2453 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2454 | #ifdef __cplusplus |
| 2455 | } /* extern "C" */ |
| 2456 | #endif |
| 2457 | |
| 2458 | |
| 2459 | #endif /* UPB_MINI_TABLE_COMMON_H_ */ |
| 2460 | |
| 2461 | // Must be last. |
| 2462 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 2463 | #if defined(__GNUC__) && !defined(__clang__) |
| 2464 | // GCC raises incorrect warnings in these functions. It thinks that we are |
| 2465 | // overrunning buffers, but we carefully write the functions in this file to |
| 2466 | // guarantee that this is impossible. GCC gets this wrong due it its failure |
| 2467 | // to perform constant propagation as we expect: |
| 2468 | // - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108217 |
| 2469 | // - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108226 |
| 2470 | // |
| 2471 | // Unfortunately this also indicates that GCC is not optimizing away the |
| 2472 | // switch() in cases where it should be, compromising the performance. |
| 2473 | #pragma GCC diagnostic push |
| 2474 | #pragma GCC diagnostic ignored "-Warray-bounds" |
| 2475 | #pragma GCC diagnostic ignored "-Wstringop-overflow" |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 2476 | #if __GNUC__ >= 11 |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 2477 | #pragma GCC diagnostic ignored "-Wstringop-overread" |
| 2478 | #endif |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 2479 | #endif |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 2480 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2481 | #ifdef __cplusplus |
| 2482 | extern "C" { |
| 2483 | #endif |
| 2484 | |
| 2485 | UPB_INLINE bool _upb_MiniTableField_InOneOf(const upb_MiniTableField* field) { |
| 2486 | return field->presence < 0; |
| 2487 | } |
| 2488 | |
| 2489 | UPB_INLINE void* _upb_MiniTableField_GetPtr(upb_Message* msg, |
| 2490 | const upb_MiniTableField* field) { |
| 2491 | return (char*)msg + field->offset; |
| 2492 | } |
| 2493 | |
| 2494 | UPB_INLINE const void* _upb_MiniTableField_GetConstPtr( |
| 2495 | const upb_Message* msg, const upb_MiniTableField* field) { |
| 2496 | return (char*)msg + field->offset; |
| 2497 | } |
| 2498 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2499 | UPB_INLINE void _upb_Message_SetPresence(upb_Message* msg, |
| 2500 | const upb_MiniTableField* field) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2501 | if (field->presence > 0) { |
| 2502 | _upb_sethas_field(msg, field); |
| 2503 | } else if (_upb_MiniTableField_InOneOf(field)) { |
| 2504 | *_upb_oneofcase_field(msg, field) = field->number; |
| 2505 | } |
| 2506 | } |
| 2507 | |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 2508 | // LINT.IfChange(message_raw_fields) |
| 2509 | |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 2510 | UPB_INLINE bool _upb_MiniTable_ValueIsNonZero(const void* default_val, |
| 2511 | const upb_MiniTableField* field) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2512 | char zero[16] = {0}; |
| 2513 | switch (_upb_MiniTableField_GetRep(field)) { |
| 2514 | case kUpb_FieldRep_1Byte: |
| 2515 | return memcmp(&zero, default_val, 1) != 0; |
| 2516 | case kUpb_FieldRep_4Byte: |
| 2517 | return memcmp(&zero, default_val, 4) != 0; |
| 2518 | case kUpb_FieldRep_8Byte: |
| 2519 | return memcmp(&zero, default_val, 8) != 0; |
| 2520 | case kUpb_FieldRep_StringView: { |
| 2521 | const upb_StringView* sv = (const upb_StringView*)default_val; |
| 2522 | return sv->size != 0; |
| 2523 | } |
| 2524 | } |
| 2525 | UPB_UNREACHABLE(); |
| 2526 | } |
| 2527 | |
| 2528 | UPB_INLINE void _upb_MiniTable_CopyFieldData(void* to, const void* from, |
| 2529 | const upb_MiniTableField* field) { |
| 2530 | switch (_upb_MiniTableField_GetRep(field)) { |
| 2531 | case kUpb_FieldRep_1Byte: |
| 2532 | memcpy(to, from, 1); |
| 2533 | return; |
| 2534 | case kUpb_FieldRep_4Byte: |
| 2535 | memcpy(to, from, 4); |
| 2536 | return; |
| 2537 | case kUpb_FieldRep_8Byte: |
| 2538 | memcpy(to, from, 8); |
| 2539 | return; |
| 2540 | case kUpb_FieldRep_StringView: { |
| 2541 | memcpy(to, from, sizeof(upb_StringView)); |
| 2542 | return; |
| 2543 | } |
| 2544 | } |
| 2545 | UPB_UNREACHABLE(); |
| 2546 | } |
| 2547 | |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 2548 | // LINT.ThenChange(//depot/google3/third_party/upb/js/impl/upb_bits/message.ts:message_raw_fields) |
| 2549 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 2550 | UPB_INLINE size_t |
| 2551 | _upb_MiniTable_ElementSizeLg2(const upb_MiniTableField* field) { |
| 2552 | const unsigned char table[] = { |
| 2553 | 0, |
| 2554 | 3, // kUpb_FieldType_Double = 1, |
| 2555 | 2, // kUpb_FieldType_Float = 2, |
| 2556 | 3, // kUpb_FieldType_Int64 = 3, |
| 2557 | 3, // kUpb_FieldType_UInt64 = 4, |
| 2558 | 2, // kUpb_FieldType_Int32 = 5, |
| 2559 | 3, // kUpb_FieldType_Fixed64 = 6, |
| 2560 | 2, // kUpb_FieldType_Fixed32 = 7, |
| 2561 | 0, // kUpb_FieldType_Bool = 8, |
| 2562 | UPB_SIZE(3, 4), // kUpb_FieldType_String = 9, |
| 2563 | UPB_SIZE(2, 3), // kUpb_FieldType_Group = 10, |
| 2564 | UPB_SIZE(2, 3), // kUpb_FieldType_Message = 11, |
| 2565 | UPB_SIZE(3, 4), // kUpb_FieldType_Bytes = 12, |
| 2566 | 2, // kUpb_FieldType_UInt32 = 13, |
| 2567 | 2, // kUpb_FieldType_Enum = 14, |
| 2568 | 2, // kUpb_FieldType_SFixed32 = 15, |
| 2569 | 3, // kUpb_FieldType_SFixed64 = 16, |
| 2570 | 2, // kUpb_FieldType_SInt32 = 17, |
| 2571 | 3, // kUpb_FieldType_SInt64 = 18, |
| 2572 | }; |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2573 | return table[field->UPB_PRIVATE(descriptortype)]; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 2574 | } |
| 2575 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2576 | // Here we define universal getter/setter functions for message fields. |
| 2577 | // These look very branchy and inefficient, but as long as the MiniTableField |
| 2578 | // values are known at compile time, all the branches are optimized away and |
| 2579 | // we are left with ideal code. This can happen either through through |
| 2580 | // literals or UPB_ASSUME(): |
| 2581 | // |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 2582 | // // Via struct literals. |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2583 | // bool FooMessage_set_bool_field(const upb_Message* msg, bool val) { |
| 2584 | // const upb_MiniTableField field = {1, 0, 0, /* etc... */}; |
| 2585 | // // All value in "field" are compile-time known. |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2586 | // _upb_Message_SetNonExtensionField(msg, &field, &value); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2587 | // } |
| 2588 | // |
| 2589 | // // Via UPB_ASSUME(). |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2590 | // UPB_INLINE bool upb_Message_SetBool(upb_Message* msg, |
| 2591 | // const upb_MiniTableField* field, |
| 2592 | // bool value, upb_Arena* a) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2593 | // UPB_ASSUME(field->UPB_PRIVATE(descriptortype) == kUpb_FieldType_Bool); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2594 | // UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
| 2595 | // UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_1Byte); |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2596 | // _upb_Message_SetField(msg, field, &value, a); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2597 | // } |
| 2598 | // |
| 2599 | // As a result, we can use these universal getters/setters for *all* message |
| 2600 | // accessors: generated code, MiniTable accessors, and reflection. The only |
| 2601 | // 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] | 2602 | // about how they read/write the message data, for efficiency. |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2603 | // |
| 2604 | // These functions work on both extensions and non-extensions. If the field |
| 2605 | // of a setter is known to be a non-extension, the arena may be NULL and the |
| 2606 | // returned bool value may be ignored since it will always succeed. |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2607 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2608 | UPB_INLINE bool _upb_Message_HasExtensionField( |
| 2609 | const upb_Message* msg, const upb_MiniTableExtension* ext) { |
| 2610 | UPB_ASSERT(upb_MiniTableField_HasPresence(&ext->field)); |
| 2611 | return _upb_Message_Getext(msg, ext) != NULL; |
| 2612 | } |
| 2613 | |
| 2614 | UPB_INLINE bool _upb_Message_HasNonExtensionField( |
| 2615 | const upb_Message* msg, const upb_MiniTableField* field) { |
| 2616 | UPB_ASSERT(upb_MiniTableField_HasPresence(field)); |
| 2617 | UPB_ASSUME(!upb_MiniTableField_IsExtension(field)); |
| 2618 | if (_upb_MiniTableField_InOneOf(field)) { |
| 2619 | return _upb_getoneofcase_field(msg, field) == field->number; |
| 2620 | } else { |
| 2621 | return _upb_hasbit_field(msg, field); |
| 2622 | } |
| 2623 | } |
| 2624 | |
| 2625 | static UPB_FORCEINLINE void _upb_Message_GetNonExtensionField( |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2626 | const upb_Message* msg, const upb_MiniTableField* field, |
| 2627 | const void* default_val, void* val) { |
| 2628 | UPB_ASSUME(!upb_MiniTableField_IsExtension(field)); |
| 2629 | if ((_upb_MiniTableField_InOneOf(field) || |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 2630 | _upb_MiniTable_ValueIsNonZero(default_val, field)) && |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2631 | !_upb_Message_HasNonExtensionField(msg, field)) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2632 | _upb_MiniTable_CopyFieldData(val, default_val, field); |
| 2633 | return; |
| 2634 | } |
| 2635 | _upb_MiniTable_CopyFieldData(val, _upb_MiniTableField_GetConstPtr(msg, field), |
| 2636 | field); |
| 2637 | } |
| 2638 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2639 | UPB_INLINE void _upb_Message_GetExtensionField( |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2640 | const upb_Message* msg, const upb_MiniTableExtension* mt_ext, |
| 2641 | const void* default_val, void* val) { |
| 2642 | UPB_ASSUME(upb_MiniTableField_IsExtension(&mt_ext->field)); |
| 2643 | const upb_Message_Extension* ext = _upb_Message_Getext(msg, mt_ext); |
| 2644 | if (ext) { |
| 2645 | _upb_MiniTable_CopyFieldData(val, &ext->data, &mt_ext->field); |
| 2646 | } else { |
| 2647 | _upb_MiniTable_CopyFieldData(val, default_val, &mt_ext->field); |
| 2648 | } |
| 2649 | } |
| 2650 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2651 | UPB_INLINE void _upb_Message_GetField(const upb_Message* msg, |
| 2652 | const upb_MiniTableField* field, |
| 2653 | const void* default_val, void* val) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2654 | if (upb_MiniTableField_IsExtension(field)) { |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2655 | _upb_Message_GetExtensionField(msg, (upb_MiniTableExtension*)field, |
| 2656 | default_val, val); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2657 | } else { |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2658 | _upb_Message_GetNonExtensionField(msg, field, default_val, val); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2659 | } |
| 2660 | } |
| 2661 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2662 | UPB_INLINE void _upb_Message_SetNonExtensionField( |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2663 | upb_Message* msg, const upb_MiniTableField* field, const void* val) { |
| 2664 | UPB_ASSUME(!upb_MiniTableField_IsExtension(field)); |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2665 | _upb_Message_SetPresence(msg, field); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2666 | _upb_MiniTable_CopyFieldData(_upb_MiniTableField_GetPtr(msg, field), val, |
| 2667 | field); |
| 2668 | } |
| 2669 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2670 | UPB_INLINE bool _upb_Message_SetExtensionField( |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2671 | upb_Message* msg, const upb_MiniTableExtension* mt_ext, const void* val, |
| 2672 | upb_Arena* a) { |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2673 | UPB_ASSERT(a); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2674 | upb_Message_Extension* ext = |
| 2675 | _upb_Message_GetOrCreateExtension(msg, mt_ext, a); |
| 2676 | if (!ext) return false; |
| 2677 | _upb_MiniTable_CopyFieldData(&ext->data, val, &mt_ext->field); |
| 2678 | return true; |
| 2679 | } |
| 2680 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2681 | UPB_INLINE bool _upb_Message_SetField(upb_Message* msg, |
| 2682 | const upb_MiniTableField* field, |
| 2683 | const void* val, upb_Arena* a) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2684 | if (upb_MiniTableField_IsExtension(field)) { |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2685 | const upb_MiniTableExtension* ext = (const upb_MiniTableExtension*)field; |
| 2686 | return _upb_Message_SetExtensionField(msg, ext, val, a); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2687 | } else { |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2688 | _upb_Message_SetNonExtensionField(msg, field, val); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2689 | return true; |
| 2690 | } |
| 2691 | } |
| 2692 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2693 | UPB_INLINE void _upb_Message_ClearExtensionField( |
| 2694 | upb_Message* msg, const upb_MiniTableExtension* ext_l) { |
| 2695 | upb_Message_Internal* in = upb_Message_Getinternal(msg); |
| 2696 | if (!in->internal) return; |
| 2697 | const upb_Message_Extension* base = |
| 2698 | UPB_PTR_AT(in->internal, in->internal->ext_begin, upb_Message_Extension); |
| 2699 | upb_Message_Extension* ext = |
| 2700 | (upb_Message_Extension*)_upb_Message_Getext(msg, ext_l); |
| 2701 | if (ext) { |
| 2702 | *ext = *base; |
| 2703 | in->internal->ext_begin += sizeof(upb_Message_Extension); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 2704 | } |
| 2705 | } |
| 2706 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2707 | UPB_INLINE void _upb_Message_ClearNonExtensionField( |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 2708 | upb_Message* msg, const upb_MiniTableField* field) { |
| 2709 | if (field->presence > 0) { |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 2710 | _upb_clearhas(msg, _upb_Message_Hasidx(field)); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 2711 | } else if (_upb_MiniTableField_InOneOf(field)) { |
| 2712 | uint32_t* oneof_case = _upb_oneofcase_field(msg, field); |
| 2713 | if (*oneof_case != field->number) return; |
| 2714 | *oneof_case = 0; |
| 2715 | } |
| 2716 | const char zeros[16] = {0}; |
| 2717 | _upb_MiniTable_CopyFieldData(_upb_MiniTableField_GetPtr(msg, field), zeros, |
| 2718 | field); |
| 2719 | } |
| 2720 | |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 2721 | UPB_INLINE void _upb_Message_AssertMapIsUntagged( |
| 2722 | const upb_Message* msg, const upb_MiniTableField* field) { |
| 2723 | _upb_MiniTableField_CheckIsMap(field); |
| 2724 | #ifndef NDEBUG |
| 2725 | upb_TaggedMessagePtr default_val = 0; |
| 2726 | upb_TaggedMessagePtr tagged; |
| 2727 | _upb_Message_GetNonExtensionField(msg, field, &default_val, &tagged); |
| 2728 | UPB_ASSERT(!upb_TaggedMessagePtr_IsEmpty(tagged)); |
| 2729 | #endif |
| 2730 | } |
| 2731 | |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 2732 | UPB_INLINE upb_Map* _upb_Message_GetOrCreateMutableMap( |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 2733 | upb_Message* msg, const upb_MiniTableField* field, size_t key_size, |
| 2734 | size_t val_size, upb_Arena* arena) { |
| 2735 | _upb_MiniTableField_CheckIsMap(field); |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 2736 | _upb_Message_AssertMapIsUntagged(msg, field); |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 2737 | upb_Map* map = NULL; |
| 2738 | upb_Map* default_map_value = NULL; |
| 2739 | _upb_Message_GetNonExtensionField(msg, field, &default_map_value, &map); |
| 2740 | if (!map) { |
| 2741 | map = _upb_Map_New(arena, key_size, val_size); |
| 2742 | // Check again due to: https://godbolt.org/z/7WfaoKG1r |
| 2743 | _upb_MiniTableField_CheckIsMap(field); |
| 2744 | _upb_Message_SetNonExtensionField(msg, field, &map); |
| 2745 | } |
| 2746 | return map; |
| 2747 | } |
| 2748 | |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2749 | #ifdef __cplusplus |
| 2750 | } /* extern "C" */ |
| 2751 | #endif |
| 2752 | |
| 2753 | #if defined(__GNUC__) && !defined(__clang__) |
| 2754 | #pragma GCC diagnostic pop |
| 2755 | #endif |
| 2756 | |
| 2757 | |
| 2758 | #endif // UPB_MESSAGE_ACCESSORS_INTERNAL_H_ |
| 2759 | |
| 2760 | // Must be last. |
| 2761 | |
| 2762 | #ifdef __cplusplus |
| 2763 | extern "C" { |
| 2764 | #endif |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2765 | |
| 2766 | UPB_API_INLINE void upb_Message_ClearField(upb_Message* msg, |
| 2767 | const upb_MiniTableField* field) { |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 2768 | if (upb_MiniTableField_IsExtension(field)) { |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2769 | const upb_MiniTableExtension* ext = (const upb_MiniTableExtension*)field; |
| 2770 | _upb_Message_ClearExtensionField(msg, ext); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 2771 | } else { |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2772 | _upb_Message_ClearNonExtensionField(msg, field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 2773 | } |
| 2774 | } |
| 2775 | |
Jie Luo | f36a5c6 | 2023-05-23 17:56:18 -0700 | [diff] [blame] | 2776 | UPB_API_INLINE void upb_Message_Clear(upb_Message* msg, |
| 2777 | const upb_MiniTable* l) { |
| 2778 | // Note: Can't use UPB_PTR_AT() here because we are doing pointer subtraction. |
| 2779 | char* mem = (char*)msg - sizeof(upb_Message_Internal); |
| 2780 | memset(mem, 0, upb_msg_sizeof(l)); |
| 2781 | } |
| 2782 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2783 | UPB_API_INLINE bool upb_Message_HasField(const upb_Message* msg, |
| 2784 | const upb_MiniTableField* field) { |
| 2785 | if (upb_MiniTableField_IsExtension(field)) { |
| 2786 | const upb_MiniTableExtension* ext = (const upb_MiniTableExtension*)field; |
| 2787 | return _upb_Message_HasExtensionField(msg, ext); |
| 2788 | } else { |
| 2789 | return _upb_Message_HasNonExtensionField(msg, field); |
| 2790 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 2791 | } |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2792 | |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 2793 | UPB_API_INLINE uint32_t upb_Message_WhichOneofFieldNumber( |
| 2794 | const upb_Message* message, const upb_MiniTableField* oneof_field) { |
| 2795 | UPB_ASSUME(_upb_MiniTableField_InOneOf(oneof_field)); |
| 2796 | return _upb_getoneofcase_field(message, oneof_field); |
| 2797 | } |
| 2798 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2799 | UPB_API_INLINE bool upb_Message_GetBool(const upb_Message* msg, |
| 2800 | const upb_MiniTableField* field, |
| 2801 | bool default_val) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2802 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Bool); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2803 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_1Byte); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2804 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2805 | bool ret; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2806 | _upb_Message_GetField(msg, field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2807 | return ret; |
| 2808 | } |
| 2809 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2810 | UPB_API_INLINE bool upb_Message_SetBool(upb_Message* msg, |
| 2811 | const upb_MiniTableField* field, |
| 2812 | bool value, upb_Arena* a) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2813 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Bool); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2814 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_1Byte); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2815 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2816 | return _upb_Message_SetField(msg, field, &value, a); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2817 | } |
| 2818 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2819 | UPB_API_INLINE int32_t upb_Message_GetInt32(const upb_Message* msg, |
| 2820 | const upb_MiniTableField* field, |
| 2821 | int32_t default_val) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2822 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Int32 || |
| 2823 | upb_MiniTableField_CType(field) == kUpb_CType_Enum); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2824 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2825 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2826 | int32_t ret; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2827 | _upb_Message_GetField(msg, field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2828 | return ret; |
| 2829 | } |
| 2830 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2831 | UPB_API_INLINE bool upb_Message_SetInt32(upb_Message* msg, |
| 2832 | const upb_MiniTableField* field, |
| 2833 | int32_t value, upb_Arena* a) { |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 2834 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Int32 || |
| 2835 | upb_MiniTableField_CType(field) == kUpb_CType_Enum); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2836 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2837 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2838 | return _upb_Message_SetField(msg, field, &value, a); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2839 | } |
| 2840 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2841 | UPB_API_INLINE uint32_t upb_Message_GetUInt32(const upb_Message* msg, |
| 2842 | const upb_MiniTableField* field, |
| 2843 | uint32_t default_val) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2844 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_UInt32); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2845 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2846 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2847 | uint32_t ret; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2848 | _upb_Message_GetField(msg, field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2849 | return ret; |
| 2850 | } |
| 2851 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2852 | UPB_API_INLINE bool upb_Message_SetUInt32(upb_Message* msg, |
| 2853 | const upb_MiniTableField* field, |
| 2854 | uint32_t value, upb_Arena* a) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2855 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_UInt32); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2856 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2857 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2858 | return _upb_Message_SetField(msg, field, &value, a); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2859 | } |
| 2860 | |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 2861 | UPB_API_INLINE void upb_Message_SetClosedEnum( |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 2862 | upb_Message* msg, const upb_MiniTable* msg_mini_table, |
| 2863 | const upb_MiniTableField* field, int32_t value) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2864 | UPB_ASSERT(upb_MiniTableField_IsClosedEnum(field)); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2865 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2866 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2867 | UPB_ASSERT(upb_MiniTableEnum_CheckValue( |
| 2868 | upb_MiniTable_GetSubEnumTable(msg_mini_table, field), value)); |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2869 | _upb_Message_SetNonExtensionField(msg, field, &value); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2870 | } |
| 2871 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2872 | UPB_API_INLINE int64_t upb_Message_GetInt64(const upb_Message* msg, |
| 2873 | const upb_MiniTableField* field, |
| 2874 | uint64_t default_val) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2875 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Int64); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2876 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_8Byte); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2877 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2878 | int64_t ret; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2879 | _upb_Message_GetField(msg, field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2880 | return ret; |
| 2881 | } |
| 2882 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2883 | UPB_API_INLINE bool upb_Message_SetInt64(upb_Message* msg, |
| 2884 | const upb_MiniTableField* field, |
| 2885 | int64_t value, upb_Arena* a) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2886 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Int64); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2887 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_8Byte); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2888 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2889 | return _upb_Message_SetField(msg, field, &value, a); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2890 | } |
| 2891 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2892 | UPB_API_INLINE uint64_t upb_Message_GetUInt64(const upb_Message* msg, |
| 2893 | const upb_MiniTableField* field, |
| 2894 | uint64_t default_val) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2895 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_UInt64); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2896 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_8Byte); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2897 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2898 | uint64_t ret; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2899 | _upb_Message_GetField(msg, field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2900 | return ret; |
| 2901 | } |
| 2902 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2903 | UPB_API_INLINE bool upb_Message_SetUInt64(upb_Message* msg, |
| 2904 | const upb_MiniTableField* field, |
| 2905 | uint64_t value, upb_Arena* a) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2906 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_UInt64); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2907 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_8Byte); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2908 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2909 | return _upb_Message_SetField(msg, field, &value, a); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2910 | } |
| 2911 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2912 | UPB_API_INLINE float upb_Message_GetFloat(const upb_Message* msg, |
| 2913 | const upb_MiniTableField* field, |
| 2914 | float default_val) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2915 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Float); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2916 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2917 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2918 | float ret; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2919 | _upb_Message_GetField(msg, field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2920 | return ret; |
| 2921 | } |
| 2922 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2923 | UPB_API_INLINE bool upb_Message_SetFloat(upb_Message* msg, |
| 2924 | const upb_MiniTableField* field, |
| 2925 | float value, upb_Arena* a) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2926 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Float); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2927 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2928 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2929 | return _upb_Message_SetField(msg, field, &value, a); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2930 | } |
| 2931 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2932 | UPB_API_INLINE double upb_Message_GetDouble(const upb_Message* msg, |
| 2933 | const upb_MiniTableField* field, |
| 2934 | double default_val) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2935 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Double); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2936 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_8Byte); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2937 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2938 | double ret; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2939 | _upb_Message_GetField(msg, field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2940 | return ret; |
| 2941 | } |
| 2942 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2943 | UPB_API_INLINE bool upb_Message_SetDouble(upb_Message* msg, |
| 2944 | const upb_MiniTableField* field, |
| 2945 | double value, upb_Arena* a) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2946 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Double); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2947 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_8Byte); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2948 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2949 | return _upb_Message_SetField(msg, field, &value, a); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2950 | } |
| 2951 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 2952 | UPB_API_INLINE upb_StringView |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2953 | upb_Message_GetString(const upb_Message* msg, const upb_MiniTableField* field, |
| 2954 | upb_StringView def_val) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2955 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_String || |
| 2956 | upb_MiniTableField_CType(field) == kUpb_CType_Bytes); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2957 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_StringView); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2958 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2959 | upb_StringView ret; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2960 | _upb_Message_GetField(msg, field, &def_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2961 | return ret; |
| 2962 | } |
| 2963 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2964 | UPB_API_INLINE bool upb_Message_SetString(upb_Message* msg, |
| 2965 | const upb_MiniTableField* field, |
| 2966 | upb_StringView value, upb_Arena* a) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2967 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_String || |
| 2968 | upb_MiniTableField_CType(field) == kUpb_CType_Bytes); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2969 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_StringView); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2970 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 2971 | return _upb_Message_SetField(msg, field, &value, a); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2972 | } |
| 2973 | |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 2974 | UPB_API_INLINE upb_TaggedMessagePtr upb_Message_GetTaggedMessagePtr( |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2975 | const upb_Message* msg, const upb_MiniTableField* field, |
| 2976 | upb_Message* default_val) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2977 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Message); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2978 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == |
| 2979 | UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte)); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 2980 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 2981 | upb_TaggedMessagePtr tagged; |
| 2982 | _upb_Message_GetNonExtensionField(msg, field, &default_val, &tagged); |
| 2983 | return tagged; |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 2984 | } |
| 2985 | |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 2986 | UPB_API_INLINE const upb_Message* upb_Message_GetMessage( |
| 2987 | const upb_Message* msg, const upb_MiniTableField* field, |
| 2988 | upb_Message* default_val) { |
| 2989 | upb_TaggedMessagePtr tagged = |
| 2990 | upb_Message_GetTaggedMessagePtr(msg, field, default_val); |
| 2991 | return upb_TaggedMessagePtr_GetNonEmptyMessage(tagged); |
| 2992 | } |
| 2993 | |
| 2994 | // For internal use only; users cannot set tagged messages because only the |
| 2995 | // parser and the message copier are allowed to directly create an empty |
| 2996 | // message. |
| 2997 | UPB_API_INLINE void _upb_Message_SetTaggedMessagePtr( |
| 2998 | upb_Message* msg, const upb_MiniTable* mini_table, |
| 2999 | const upb_MiniTableField* field, upb_TaggedMessagePtr sub_message) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 3000 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Message); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 3001 | UPB_ASSUME(_upb_MiniTableField_GetRep(field) == |
| 3002 | UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte)); |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 3003 | UPB_ASSUME(!upb_IsRepeatedOrMap(field)); |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 3004 | UPB_ASSERT(mini_table->subs[field->UPB_PRIVATE(submsg_index)].submsg); |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 3005 | _upb_Message_SetNonExtensionField(msg, field, &sub_message); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 3006 | } |
| 3007 | |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 3008 | UPB_API_INLINE void upb_Message_SetMessage(upb_Message* msg, |
| 3009 | const upb_MiniTable* mini_table, |
| 3010 | const upb_MiniTableField* field, |
| 3011 | upb_Message* sub_message) { |
| 3012 | _upb_Message_SetTaggedMessagePtr( |
| 3013 | msg, mini_table, field, _upb_TaggedMessagePtr_Pack(sub_message, false)); |
| 3014 | } |
| 3015 | |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 3016 | UPB_API_INLINE upb_Message* upb_Message_GetOrCreateMutableMessage( |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 3017 | upb_Message* msg, const upb_MiniTable* mini_table, |
| 3018 | const upb_MiniTableField* field, upb_Arena* arena) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 3019 | UPB_ASSERT(arena); |
| 3020 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Message); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 3021 | upb_Message* sub_message = *UPB_PTR_AT(msg, field->offset, upb_Message*); |
| 3022 | if (!sub_message) { |
| 3023 | const upb_MiniTable* sub_mini_table = |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 3024 | mini_table->subs[field->UPB_PRIVATE(submsg_index)].submsg; |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 3025 | UPB_ASSERT(sub_mini_table); |
| 3026 | sub_message = _upb_Message_New(sub_mini_table, arena); |
| 3027 | *UPB_PTR_AT(msg, field->offset, upb_Message*) = sub_message; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 3028 | _upb_Message_SetPresence(msg, field); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 3029 | } |
| 3030 | return sub_message; |
| 3031 | } |
| 3032 | |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 3033 | UPB_API_INLINE const upb_Array* upb_Message_GetArray( |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 3034 | const upb_Message* msg, const upb_MiniTableField* field) { |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 3035 | _upb_MiniTableField_CheckIsArray(field); |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 3036 | upb_Array* ret; |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 3037 | const upb_Array* default_val = NULL; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 3038 | _upb_Message_GetNonExtensionField(msg, field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 3039 | return ret; |
| 3040 | } |
| 3041 | |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 3042 | UPB_API_INLINE upb_Array* upb_Message_GetMutableArray( |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 3043 | upb_Message* msg, const upb_MiniTableField* field) { |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 3044 | _upb_MiniTableField_CheckIsArray(field); |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 3045 | return (upb_Array*)upb_Message_GetArray(msg, field); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 3046 | } |
| 3047 | |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 3048 | UPB_API_INLINE upb_Array* upb_Message_GetOrCreateMutableArray( |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 3049 | upb_Message* msg, const upb_MiniTableField* field, upb_Arena* arena) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 3050 | UPB_ASSERT(arena); |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 3051 | _upb_MiniTableField_CheckIsArray(field); |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 3052 | upb_Array* array = upb_Message_GetMutableArray(msg, field); |
| 3053 | if (!array) { |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 3054 | array = _upb_Array_New(arena, 4, _upb_MiniTable_ElementSizeLg2(field)); |
| 3055 | // Check again due to: https://godbolt.org/z/7WfaoKG1r |
| 3056 | _upb_MiniTableField_CheckIsArray(field); |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 3057 | _upb_Message_SetField(msg, field, &array, arena); |
| 3058 | } |
| 3059 | return array; |
| 3060 | } |
| 3061 | |
Jie Luo | f36a5c6 | 2023-05-23 17:56:18 -0700 | [diff] [blame] | 3062 | UPB_API_INLINE void* upb_Message_ResizeArrayUninitialized( |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 3063 | upb_Message* msg, const upb_MiniTableField* field, size_t size, |
| 3064 | upb_Arena* arena) { |
| 3065 | _upb_MiniTableField_CheckIsArray(field); |
| 3066 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, field, arena); |
| 3067 | if (!arr || !_upb_Array_ResizeUninitialized(arr, size, arena)) return NULL; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 3068 | return _upb_array_ptr(arr); |
| 3069 | } |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 3070 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 3071 | UPB_API_INLINE const upb_Map* upb_Message_GetMap( |
| 3072 | const upb_Message* msg, const upb_MiniTableField* field) { |
| 3073 | _upb_MiniTableField_CheckIsMap(field); |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 3074 | _upb_Message_AssertMapIsUntagged(msg, field); |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 3075 | upb_Map* ret; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 3076 | const upb_Map* default_val = NULL; |
| 3077 | _upb_Message_GetNonExtensionField(msg, field, &default_val, &ret); |
| 3078 | return ret; |
| 3079 | } |
| 3080 | |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 3081 | UPB_API_INLINE upb_Map* upb_Message_GetMutableMap( |
| 3082 | upb_Message* msg, const upb_MiniTableField* field) { |
| 3083 | return (upb_Map*)upb_Message_GetMap(msg, field); |
| 3084 | } |
| 3085 | |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 3086 | UPB_API_INLINE upb_Map* upb_Message_GetOrCreateMutableMap( |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 3087 | upb_Message* msg, const upb_MiniTable* map_entry_mini_table, |
| 3088 | const upb_MiniTableField* field, upb_Arena* arena) { |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 3089 | UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Message); |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 3090 | const upb_MiniTableField* map_entry_key_field = |
| 3091 | &map_entry_mini_table->fields[0]; |
| 3092 | const upb_MiniTableField* map_entry_value_field = |
| 3093 | &map_entry_mini_table->fields[1]; |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 3094 | return _upb_Message_GetOrCreateMutableMap( |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 3095 | msg, field, |
| 3096 | _upb_Map_CTypeSize(upb_MiniTableField_CType(map_entry_key_field)), |
| 3097 | _upb_Map_CTypeSize(upb_MiniTableField_CType(map_entry_value_field)), |
| 3098 | arena); |
Eric Salo | b598b2d | 2022-12-22 23:14:27 -0800 | [diff] [blame] | 3099 | } |
| 3100 | |
| 3101 | // Updates a map entry given an entry message. |
| 3102 | upb_MapInsertStatus upb_Message_InsertMapEntry(upb_Map* map, |
| 3103 | const upb_MiniTable* mini_table, |
| 3104 | const upb_MiniTableField* field, |
| 3105 | upb_Message* map_entry_message, |
| 3106 | upb_Arena* arena); |
| 3107 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 3108 | #ifdef __cplusplus |
| 3109 | } /* extern "C" */ |
| 3110 | #endif |
| 3111 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 3112 | |
| 3113 | #endif // UPB_MESSAGE_ACCESSORS_H_ |
| 3114 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 3115 | // upb_decode: parsing into a upb_Message using a upb_MiniTable. |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3116 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 3117 | #ifndef UPB_WIRE_DECODE_H_ |
| 3118 | #define UPB_WIRE_DECODE_H_ |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3119 | |
| 3120 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3121 | // Must be last. |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3122 | |
| 3123 | #ifdef __cplusplus |
| 3124 | extern "C" { |
| 3125 | #endif |
| 3126 | |
| 3127 | enum { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3128 | /* If set, strings will alias the input buffer instead of copying into the |
| 3129 | * arena. */ |
| 3130 | kUpb_DecodeOption_AliasString = 1, |
| 3131 | |
| 3132 | /* If set, the parse will return failure if any message is missing any |
| 3133 | * required fields when the message data ends. The parse will still continue, |
| 3134 | * and the failure will only be reported at the end. |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3135 | * |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3136 | * IMPORTANT CAVEATS: |
| 3137 | * |
| 3138 | * 1. This can throw a false positive failure if an incomplete message is seen |
| 3139 | * on the wire but is later completed when the sub-message occurs again. |
| 3140 | * For this reason, a second pass is required to verify a failure, to be |
| 3141 | * truly robust. |
| 3142 | * |
| 3143 | * 2. This can return a false success if you are decoding into a message that |
| 3144 | * already has some sub-message fields present. If the sub-message does |
| 3145 | * not occur in the binary payload, we will never visit it and discover the |
| 3146 | * incomplete sub-message. For this reason, this check is only useful for |
| 3147 | * implemting ParseFromString() semantics. For MergeFromString(), a |
| 3148 | * post-parse validation step will always be necessary. */ |
| 3149 | kUpb_DecodeOption_CheckRequired = 2, |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 3150 | |
| 3151 | /* EXPERIMENTAL: |
| 3152 | * |
| 3153 | * If set, the parser will allow parsing of sub-message fields that were not |
| 3154 | * previously linked using upb_MiniTable_SetSubMessage(). The data will be |
| 3155 | * parsed into an internal "empty" message type that cannot be accessed |
| 3156 | * directly, but can be later promoted into the true message type if the |
| 3157 | * sub-message fields are linked at a later time. |
| 3158 | * |
| 3159 | * Users should set this option if they intend to perform dynamic tree shaking |
| 3160 | * and promoting using the interfaces in message/promote.h. If this option is |
| 3161 | * enabled, it is important that the resulting messages are only accessed by |
| 3162 | * code that is aware of promotion rules: |
| 3163 | * |
| 3164 | * 1. Message pointers in upb_Message, upb_Array, and upb_Map are represented |
| 3165 | * by a tagged pointer upb_TaggedMessagePointer. The tag indicates whether |
| 3166 | * the message uses the internal "empty" type. |
| 3167 | * |
| 3168 | * 2. Any code *reading* these message pointers must test whether the "empty" |
| 3169 | * tag bit is set, using the interfaces in mini_table/types.h. However |
| 3170 | * writing of message pointers should always use plain upb_Message*, since |
| 3171 | * users are not allowed to create "empty" messages. |
| 3172 | * |
| 3173 | * 3. It is always safe to test whether a field is present or test the array |
| 3174 | * length; these interfaces will reflect that empty messages are present, |
| 3175 | * even though their data cannot be accessed without promoting first. |
| 3176 | * |
| 3177 | * 4. If a message pointer is indeed tagged as empty, the message may not be |
| 3178 | * accessed directly, only promoted through the interfaces in |
| 3179 | * message/promote.h. |
| 3180 | * |
| 3181 | * 5. Tagged/empty messages may never be created by the user. They may only |
| 3182 | * be created by the parser or the message-copying logic in message/copy.h. |
| 3183 | */ |
| 3184 | kUpb_DecodeOption_ExperimentalAllowUnlinked = 4, |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3185 | }; |
| 3186 | |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 3187 | UPB_INLINE uint32_t upb_DecodeOptions_MaxDepth(uint16_t depth) { |
| 3188 | return (uint32_t)depth << 16; |
| 3189 | } |
| 3190 | |
| 3191 | UPB_INLINE uint16_t upb_DecodeOptions_GetMaxDepth(uint32_t options) { |
| 3192 | return options >> 16; |
| 3193 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3194 | |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 3195 | // Enforce an upper bound on recursion depth. |
| 3196 | 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] | 3197 | uint32_t max_depth = upb_DecodeOptions_GetMaxDepth(decode_options); |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 3198 | if (max_depth > limit) max_depth = limit; |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 3199 | return upb_DecodeOptions_MaxDepth(max_depth) | (decode_options & 0xffff); |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 3200 | } |
| 3201 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3202 | typedef enum { |
| 3203 | kUpb_DecodeStatus_Ok = 0, |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 3204 | kUpb_DecodeStatus_Malformed = 1, // Wire format was corrupt |
| 3205 | kUpb_DecodeStatus_OutOfMemory = 2, // Arena alloc failed |
| 3206 | kUpb_DecodeStatus_BadUtf8 = 3, // String field had bad UTF-8 |
| 3207 | kUpb_DecodeStatus_MaxDepthExceeded = |
| 3208 | 4, // Exceeded upb_DecodeOptions_MaxDepth |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3209 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3210 | // kUpb_DecodeOption_CheckRequired failed (see above), but the parse otherwise |
| 3211 | // succeeded. |
| 3212 | kUpb_DecodeStatus_MissingRequired = 5, |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 3213 | |
| 3214 | // Unlinked sub-message field was present, but |
| 3215 | // kUpb_DecodeOptions_ExperimentalAllowUnlinked was not specified in the list |
| 3216 | // of options. |
| 3217 | kUpb_DecodeStatus_UnlinkedSubMessage = 6, |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3218 | } upb_DecodeStatus; |
| 3219 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 3220 | UPB_API upb_DecodeStatus upb_Decode(const char* buf, size_t size, |
| 3221 | upb_Message* msg, const upb_MiniTable* l, |
| 3222 | const upb_ExtensionRegistry* extreg, |
| 3223 | int options, upb_Arena* arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3224 | |
| 3225 | #ifdef __cplusplus |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 3226 | } /* extern "C" */ |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3227 | #endif |
| 3228 | |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 3229 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 3230 | #endif /* UPB_WIRE_DECODE_H_ */ |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3231 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3232 | // These are the specialized field parser functions for the fast parser. |
| 3233 | // Generated tables will refer to these by name. |
| 3234 | // |
| 3235 | // The function names are encoded with names like: |
| 3236 | // |
| 3237 | // // 123 4 |
| 3238 | // upb_pss_1bt(); // Parse singular string, 1 byte tag. |
| 3239 | // |
| 3240 | // In position 1: |
| 3241 | // - 'p' for parse, most function use this |
| 3242 | // - 'c' for copy, for when we are copying strings instead of aliasing |
| 3243 | // |
| 3244 | // In position 2 (cardinality): |
| 3245 | // - 's' for singular, with or without hasbit |
| 3246 | // - 'o' for oneof |
| 3247 | // - 'r' for non-packed repeated |
| 3248 | // - 'p' for packed repeated |
| 3249 | // |
| 3250 | // In position 3 (type): |
| 3251 | // - 'b1' for bool |
| 3252 | // - 'v4' for 4-byte varint |
| 3253 | // - 'v8' for 8-byte varint |
| 3254 | // - 'z4' for zig-zag-encoded 4-byte varint |
| 3255 | // - 'z8' for zig-zag-encoded 8-byte varint |
| 3256 | // - 'f4' for 4-byte fixed |
| 3257 | // - 'f8' for 8-byte fixed |
| 3258 | // - 'm' for sub-message |
| 3259 | // - 's' for string (validate UTF-8) |
| 3260 | // - 'b' for bytes |
| 3261 | // |
| 3262 | // In position 4 (tag length): |
| 3263 | // - '1' for one-byte tags (field numbers 1-15) |
| 3264 | // - '2' for two-byte tags (field numbers 16-2048) |
| 3265 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 3266 | #ifndef UPB_WIRE_DECODE_FAST_H_ |
| 3267 | #define UPB_WIRE_DECODE_FAST_H_ |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3268 | |
| 3269 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3270 | // Must be last. |
| 3271 | |
| 3272 | #ifdef __cplusplus |
| 3273 | extern "C" { |
| 3274 | #endif |
| 3275 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 3276 | struct upb_Decoder; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3277 | |
| 3278 | // The fallback, generic parsing function that can handle any field type. |
| 3279 | // 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] | 3280 | const char* _upb_FastDecoder_DecodeGeneric(struct upb_Decoder* d, |
| 3281 | const char* ptr, upb_Message* msg, |
| 3282 | intptr_t table, uint64_t hasbits, |
| 3283 | uint64_t data); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3284 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 3285 | #define UPB_PARSE_PARAMS \ |
| 3286 | 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] | 3287 | uint64_t hasbits, uint64_t data |
| 3288 | |
| 3289 | /* primitive fields ***********************************************************/ |
| 3290 | |
| 3291 | #define F(card, type, valbytes, tagbytes) \ |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 3292 | const char* upb_p##card##type##valbytes##_##tagbytes##bt(UPB_PARSE_PARAMS); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3293 | |
| 3294 | #define TYPES(card, tagbytes) \ |
| 3295 | F(card, b, 1, tagbytes) \ |
| 3296 | F(card, v, 4, tagbytes) \ |
| 3297 | F(card, v, 8, tagbytes) \ |
| 3298 | F(card, z, 4, tagbytes) \ |
| 3299 | F(card, z, 8, tagbytes) \ |
| 3300 | F(card, f, 4, tagbytes) \ |
| 3301 | F(card, f, 8, tagbytes) |
| 3302 | |
| 3303 | #define TAGBYTES(card) \ |
| 3304 | TYPES(card, 1) \ |
| 3305 | TYPES(card, 2) |
| 3306 | |
| 3307 | TAGBYTES(s) |
| 3308 | TAGBYTES(o) |
| 3309 | TAGBYTES(r) |
| 3310 | TAGBYTES(p) |
| 3311 | |
| 3312 | #undef F |
| 3313 | #undef TYPES |
| 3314 | #undef TAGBYTES |
| 3315 | |
| 3316 | /* string fields **************************************************************/ |
| 3317 | |
| 3318 | #define F(card, tagbytes, type) \ |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 3319 | const char* upb_p##card##type##_##tagbytes##bt(UPB_PARSE_PARAMS); \ |
| 3320 | const char* upb_c##card##type##_##tagbytes##bt(UPB_PARSE_PARAMS); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3321 | |
| 3322 | #define UTF8(card, tagbytes) \ |
| 3323 | F(card, tagbytes, s) \ |
| 3324 | F(card, tagbytes, b) |
| 3325 | |
| 3326 | #define TAGBYTES(card) \ |
| 3327 | UTF8(card, 1) \ |
| 3328 | UTF8(card, 2) |
| 3329 | |
| 3330 | TAGBYTES(s) |
| 3331 | TAGBYTES(o) |
| 3332 | TAGBYTES(r) |
| 3333 | |
| 3334 | #undef F |
| 3335 | #undef TAGBYTES |
| 3336 | |
| 3337 | /* sub-message fields *********************************************************/ |
| 3338 | |
| 3339 | #define F(card, tagbytes, size_ceil, ceil_arg) \ |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 3340 | 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] | 3341 | |
| 3342 | #define SIZES(card, tagbytes) \ |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 3343 | F(card, tagbytes, 64, 64) \ |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3344 | F(card, tagbytes, 128, 128) \ |
| 3345 | F(card, tagbytes, 192, 192) \ |
| 3346 | F(card, tagbytes, 256, 256) \ |
| 3347 | F(card, tagbytes, max, -1) |
| 3348 | |
| 3349 | #define TAGBYTES(card) \ |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 3350 | SIZES(card, 1) \ |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3351 | SIZES(card, 2) |
| 3352 | |
| 3353 | TAGBYTES(s) |
| 3354 | TAGBYTES(o) |
| 3355 | TAGBYTES(r) |
| 3356 | |
| 3357 | #undef TAGBYTES |
| 3358 | #undef SIZES |
| 3359 | #undef F |
| 3360 | |
| 3361 | #undef UPB_PARSE_PARAMS |
| 3362 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3363 | #ifdef __cplusplus |
| 3364 | } /* extern "C" */ |
| 3365 | #endif |
| 3366 | |
| 3367 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 3368 | #endif /* UPB_WIRE_DECODE_FAST_H_ */ |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 3369 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 3370 | // upb_Encode: parsing from a upb_Message using a upb_MiniTable. |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3371 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 3372 | #ifndef UPB_WIRE_ENCODE_H_ |
| 3373 | #define UPB_WIRE_ENCODE_H_ |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3374 | |
| 3375 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3376 | // Must be last. |
| 3377 | |
| 3378 | #ifdef __cplusplus |
| 3379 | extern "C" { |
| 3380 | #endif |
| 3381 | |
| 3382 | enum { |
| 3383 | /* If set, the results of serializing will be deterministic across all |
| 3384 | * instances of this binary. There are no guarantees across different |
| 3385 | * binary builds. |
| 3386 | * |
| 3387 | * If your proto contains maps, the encoder will need to malloc()/free() |
| 3388 | * memory during encode. */ |
| 3389 | kUpb_EncodeOption_Deterministic = 1, |
| 3390 | |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 3391 | // When set, unknown fields are not printed. |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3392 | kUpb_EncodeOption_SkipUnknown = 2, |
| 3393 | |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 3394 | // When set, the encode will fail if any required fields are missing. |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3395 | kUpb_EncodeOption_CheckRequired = 4, |
| 3396 | }; |
| 3397 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3398 | typedef enum { |
| 3399 | kUpb_EncodeStatus_Ok = 0, |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 3400 | kUpb_EncodeStatus_OutOfMemory = 1, // Arena alloc failed |
| 3401 | kUpb_EncodeStatus_MaxDepthExceeded = 2, |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3402 | |
| 3403 | // kUpb_EncodeOption_CheckRequired failed but the parse otherwise succeeded. |
| 3404 | kUpb_EncodeStatus_MissingRequired = 3, |
| 3405 | } upb_EncodeStatus; |
| 3406 | |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 3407 | UPB_INLINE uint32_t upb_EncodeOptions_MaxDepth(uint16_t depth) { |
| 3408 | return (uint32_t)depth << 16; |
| 3409 | } |
| 3410 | |
| 3411 | UPB_INLINE uint16_t upb_EncodeOptions_GetMaxDepth(uint32_t options) { |
| 3412 | return options >> 16; |
| 3413 | } |
| 3414 | |
| 3415 | // Enforce an upper bound on recursion depth. |
| 3416 | UPB_INLINE int upb_Encode_LimitDepth(uint32_t encode_options, uint32_t limit) { |
| 3417 | uint32_t max_depth = upb_EncodeOptions_GetMaxDepth(encode_options); |
| 3418 | if (max_depth > limit) max_depth = limit; |
| 3419 | return upb_EncodeOptions_MaxDepth(max_depth) | (encode_options & 0xffff); |
| 3420 | } |
| 3421 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3422 | upb_EncodeStatus upb_Encode(const void* msg, const upb_MiniTable* l, |
| 3423 | int options, upb_Arena* arena, char** buf, |
| 3424 | size_t* size); |
| 3425 | |
| 3426 | #ifdef __cplusplus |
| 3427 | } /* extern "C" */ |
| 3428 | #endif |
| 3429 | |
| 3430 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 3431 | #endif /* UPB_WIRE_ENCODE_H_ */ |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3432 | |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 3433 | // Must be last. |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3434 | |
| 3435 | #ifdef __cplusplus |
| 3436 | extern "C" { |
| 3437 | #endif |
| 3438 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3439 | typedef struct google_protobuf_FileDescriptorSet google_protobuf_FileDescriptorSet; |
| 3440 | typedef struct google_protobuf_FileDescriptorProto google_protobuf_FileDescriptorProto; |
| 3441 | typedef struct google_protobuf_DescriptorProto google_protobuf_DescriptorProto; |
| 3442 | typedef struct google_protobuf_DescriptorProto_ExtensionRange google_protobuf_DescriptorProto_ExtensionRange; |
| 3443 | typedef struct google_protobuf_DescriptorProto_ReservedRange google_protobuf_DescriptorProto_ReservedRange; |
| 3444 | typedef struct google_protobuf_ExtensionRangeOptions google_protobuf_ExtensionRangeOptions; |
Mike Kruskal | 145900f | 2023-03-27 09:55:52 -0700 | [diff] [blame] | 3445 | typedef struct google_protobuf_ExtensionRangeOptions_Declaration google_protobuf_ExtensionRangeOptions_Declaration; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3446 | typedef struct google_protobuf_FieldDescriptorProto google_protobuf_FieldDescriptorProto; |
| 3447 | typedef struct google_protobuf_OneofDescriptorProto google_protobuf_OneofDescriptorProto; |
| 3448 | typedef struct google_protobuf_EnumDescriptorProto google_protobuf_EnumDescriptorProto; |
| 3449 | typedef struct google_protobuf_EnumDescriptorProto_EnumReservedRange google_protobuf_EnumDescriptorProto_EnumReservedRange; |
| 3450 | typedef struct google_protobuf_EnumValueDescriptorProto google_protobuf_EnumValueDescriptorProto; |
| 3451 | typedef struct google_protobuf_ServiceDescriptorProto google_protobuf_ServiceDescriptorProto; |
| 3452 | typedef struct google_protobuf_MethodDescriptorProto google_protobuf_MethodDescriptorProto; |
| 3453 | typedef struct google_protobuf_FileOptions google_protobuf_FileOptions; |
| 3454 | typedef struct google_protobuf_MessageOptions google_protobuf_MessageOptions; |
| 3455 | typedef struct google_protobuf_FieldOptions google_protobuf_FieldOptions; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 3456 | typedef struct google_protobuf_FieldOptions_EditionDefault google_protobuf_FieldOptions_EditionDefault; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3457 | typedef struct google_protobuf_OneofOptions google_protobuf_OneofOptions; |
| 3458 | typedef struct google_protobuf_EnumOptions google_protobuf_EnumOptions; |
| 3459 | typedef struct google_protobuf_EnumValueOptions google_protobuf_EnumValueOptions; |
| 3460 | typedef struct google_protobuf_ServiceOptions google_protobuf_ServiceOptions; |
| 3461 | typedef struct google_protobuf_MethodOptions google_protobuf_MethodOptions; |
| 3462 | typedef struct google_protobuf_UninterpretedOption google_protobuf_UninterpretedOption; |
| 3463 | typedef struct google_protobuf_UninterpretedOption_NamePart google_protobuf_UninterpretedOption_NamePart; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 3464 | typedef struct google_protobuf_FeatureSet google_protobuf_FeatureSet; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3465 | typedef struct google_protobuf_SourceCodeInfo google_protobuf_SourceCodeInfo; |
| 3466 | typedef struct google_protobuf_SourceCodeInfo_Location google_protobuf_SourceCodeInfo_Location; |
| 3467 | typedef struct google_protobuf_GeneratedCodeInfo google_protobuf_GeneratedCodeInfo; |
| 3468 | typedef struct google_protobuf_GeneratedCodeInfo_Annotation google_protobuf_GeneratedCodeInfo_Annotation; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3469 | extern const upb_MiniTable google_protobuf_FileDescriptorSet_msg_init; |
| 3470 | extern const upb_MiniTable google_protobuf_FileDescriptorProto_msg_init; |
| 3471 | extern const upb_MiniTable google_protobuf_DescriptorProto_msg_init; |
| 3472 | extern const upb_MiniTable google_protobuf_DescriptorProto_ExtensionRange_msg_init; |
| 3473 | extern const upb_MiniTable google_protobuf_DescriptorProto_ReservedRange_msg_init; |
| 3474 | extern const upb_MiniTable google_protobuf_ExtensionRangeOptions_msg_init; |
Mike Kruskal | 145900f | 2023-03-27 09:55:52 -0700 | [diff] [blame] | 3475 | extern const upb_MiniTable google_protobuf_ExtensionRangeOptions_Declaration_msg_init; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3476 | extern const upb_MiniTable google_protobuf_FieldDescriptorProto_msg_init; |
| 3477 | extern const upb_MiniTable google_protobuf_OneofDescriptorProto_msg_init; |
| 3478 | extern const upb_MiniTable google_protobuf_EnumDescriptorProto_msg_init; |
| 3479 | extern const upb_MiniTable google_protobuf_EnumDescriptorProto_EnumReservedRange_msg_init; |
| 3480 | extern const upb_MiniTable google_protobuf_EnumValueDescriptorProto_msg_init; |
| 3481 | extern const upb_MiniTable google_protobuf_ServiceDescriptorProto_msg_init; |
| 3482 | extern const upb_MiniTable google_protobuf_MethodDescriptorProto_msg_init; |
| 3483 | extern const upb_MiniTable google_protobuf_FileOptions_msg_init; |
| 3484 | extern const upb_MiniTable google_protobuf_MessageOptions_msg_init; |
| 3485 | extern const upb_MiniTable google_protobuf_FieldOptions_msg_init; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 3486 | extern const upb_MiniTable google_protobuf_FieldOptions_EditionDefault_msg_init; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3487 | extern const upb_MiniTable google_protobuf_OneofOptions_msg_init; |
| 3488 | extern const upb_MiniTable google_protobuf_EnumOptions_msg_init; |
| 3489 | extern const upb_MiniTable google_protobuf_EnumValueOptions_msg_init; |
| 3490 | extern const upb_MiniTable google_protobuf_ServiceOptions_msg_init; |
| 3491 | extern const upb_MiniTable google_protobuf_MethodOptions_msg_init; |
| 3492 | extern const upb_MiniTable google_protobuf_UninterpretedOption_msg_init; |
| 3493 | extern const upb_MiniTable google_protobuf_UninterpretedOption_NamePart_msg_init; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 3494 | extern const upb_MiniTable google_protobuf_FeatureSet_msg_init; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3495 | extern const upb_MiniTable google_protobuf_SourceCodeInfo_msg_init; |
| 3496 | extern const upb_MiniTable google_protobuf_SourceCodeInfo_Location_msg_init; |
| 3497 | extern const upb_MiniTable google_protobuf_GeneratedCodeInfo_msg_init; |
| 3498 | extern const upb_MiniTable google_protobuf_GeneratedCodeInfo_Annotation_msg_init; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3499 | |
| 3500 | typedef enum { |
Protobuf Team Bot | 469f027 | 2023-04-21 18:12:45 -0700 | [diff] [blame] | 3501 | google_protobuf_ExtensionRangeOptions_DECLARATION = 0, |
| 3502 | google_protobuf_ExtensionRangeOptions_UNVERIFIED = 1 |
| 3503 | } google_protobuf_ExtensionRangeOptions_VerificationState; |
| 3504 | |
| 3505 | typedef enum { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 3506 | google_protobuf_FeatureSet_ENUM_TYPE_UNKNOWN = 0, |
| 3507 | google_protobuf_FeatureSet_OPEN = 1, |
| 3508 | google_protobuf_FeatureSet_CLOSED = 2 |
| 3509 | } google_protobuf_FeatureSet_EnumType; |
| 3510 | |
| 3511 | typedef enum { |
| 3512 | google_protobuf_FeatureSet_FIELD_PRESENCE_UNKNOWN = 0, |
| 3513 | google_protobuf_FeatureSet_EXPLICIT = 1, |
| 3514 | google_protobuf_FeatureSet_IMPLICIT = 2, |
| 3515 | google_protobuf_FeatureSet_LEGACY_REQUIRED = 3 |
| 3516 | } google_protobuf_FeatureSet_FieldPresence; |
| 3517 | |
| 3518 | typedef enum { |
| 3519 | google_protobuf_FeatureSet_JSON_FORMAT_UNKNOWN = 0, |
| 3520 | google_protobuf_FeatureSet_ALLOW = 1, |
| 3521 | google_protobuf_FeatureSet_LEGACY_BEST_EFFORT = 2 |
| 3522 | } google_protobuf_FeatureSet_JsonFormat; |
| 3523 | |
| 3524 | typedef enum { |
| 3525 | google_protobuf_FeatureSet_MESSAGE_ENCODING_UNKNOWN = 0, |
| 3526 | google_protobuf_FeatureSet_LENGTH_PREFIXED = 1, |
| 3527 | google_protobuf_FeatureSet_DELIMITED = 2 |
| 3528 | } google_protobuf_FeatureSet_MessageEncoding; |
| 3529 | |
| 3530 | typedef enum { |
| 3531 | google_protobuf_FeatureSet_REPEATED_FIELD_ENCODING_UNKNOWN = 0, |
| 3532 | google_protobuf_FeatureSet_PACKED = 1, |
| 3533 | google_protobuf_FeatureSet_EXPANDED = 2 |
| 3534 | } google_protobuf_FeatureSet_RepeatedFieldEncoding; |
| 3535 | |
| 3536 | typedef enum { |
| 3537 | google_protobuf_FeatureSet_STRING_FIELD_VALIDATION_UNKNOWN = 0, |
| 3538 | google_protobuf_FeatureSet_MANDATORY = 1, |
| 3539 | google_protobuf_FeatureSet_HINT = 2, |
| 3540 | google_protobuf_FeatureSet_NONE = 3 |
| 3541 | } google_protobuf_FeatureSet_StringFieldValidation; |
| 3542 | |
| 3543 | typedef enum { |
Mike Kruskal | ccbdaa7 | 2023-02-02 20:42:14 -0800 | [diff] [blame] | 3544 | google_protobuf_FieldDescriptorProto_LABEL_OPTIONAL = 1, |
| 3545 | google_protobuf_FieldDescriptorProto_LABEL_REQUIRED = 2, |
| 3546 | google_protobuf_FieldDescriptorProto_LABEL_REPEATED = 3 |
| 3547 | } google_protobuf_FieldDescriptorProto_Label; |
| 3548 | |
| 3549 | typedef enum { |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3550 | google_protobuf_FieldDescriptorProto_TYPE_DOUBLE = 1, |
| 3551 | google_protobuf_FieldDescriptorProto_TYPE_FLOAT = 2, |
| 3552 | google_protobuf_FieldDescriptorProto_TYPE_INT64 = 3, |
| 3553 | google_protobuf_FieldDescriptorProto_TYPE_UINT64 = 4, |
| 3554 | google_protobuf_FieldDescriptorProto_TYPE_INT32 = 5, |
| 3555 | google_protobuf_FieldDescriptorProto_TYPE_FIXED64 = 6, |
| 3556 | google_protobuf_FieldDescriptorProto_TYPE_FIXED32 = 7, |
| 3557 | google_protobuf_FieldDescriptorProto_TYPE_BOOL = 8, |
| 3558 | google_protobuf_FieldDescriptorProto_TYPE_STRING = 9, |
| 3559 | google_protobuf_FieldDescriptorProto_TYPE_GROUP = 10, |
| 3560 | google_protobuf_FieldDescriptorProto_TYPE_MESSAGE = 11, |
| 3561 | google_protobuf_FieldDescriptorProto_TYPE_BYTES = 12, |
| 3562 | google_protobuf_FieldDescriptorProto_TYPE_UINT32 = 13, |
| 3563 | google_protobuf_FieldDescriptorProto_TYPE_ENUM = 14, |
| 3564 | google_protobuf_FieldDescriptorProto_TYPE_SFIXED32 = 15, |
| 3565 | google_protobuf_FieldDescriptorProto_TYPE_SFIXED64 = 16, |
| 3566 | google_protobuf_FieldDescriptorProto_TYPE_SINT32 = 17, |
| 3567 | google_protobuf_FieldDescriptorProto_TYPE_SINT64 = 18 |
| 3568 | } google_protobuf_FieldDescriptorProto_Type; |
| 3569 | |
| 3570 | typedef enum { |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3571 | google_protobuf_FieldOptions_STRING = 0, |
| 3572 | google_protobuf_FieldOptions_CORD = 1, |
| 3573 | google_protobuf_FieldOptions_STRING_PIECE = 2 |
| 3574 | } google_protobuf_FieldOptions_CType; |
| 3575 | |
| 3576 | typedef enum { |
| 3577 | google_protobuf_FieldOptions_JS_NORMAL = 0, |
| 3578 | google_protobuf_FieldOptions_JS_STRING = 1, |
| 3579 | google_protobuf_FieldOptions_JS_NUMBER = 2 |
| 3580 | } google_protobuf_FieldOptions_JSType; |
| 3581 | |
| 3582 | typedef enum { |
Adam Cozzette | 90ff32c | 2023-01-21 15:04:56 -0800 | [diff] [blame] | 3583 | google_protobuf_FieldOptions_RETENTION_UNKNOWN = 0, |
| 3584 | google_protobuf_FieldOptions_RETENTION_RUNTIME = 1, |
| 3585 | google_protobuf_FieldOptions_RETENTION_SOURCE = 2 |
| 3586 | } google_protobuf_FieldOptions_OptionRetention; |
| 3587 | |
| 3588 | typedef enum { |
| 3589 | google_protobuf_FieldOptions_TARGET_TYPE_UNKNOWN = 0, |
| 3590 | google_protobuf_FieldOptions_TARGET_TYPE_FILE = 1, |
| 3591 | google_protobuf_FieldOptions_TARGET_TYPE_EXTENSION_RANGE = 2, |
| 3592 | google_protobuf_FieldOptions_TARGET_TYPE_MESSAGE = 3, |
| 3593 | google_protobuf_FieldOptions_TARGET_TYPE_FIELD = 4, |
| 3594 | google_protobuf_FieldOptions_TARGET_TYPE_ONEOF = 5, |
| 3595 | google_protobuf_FieldOptions_TARGET_TYPE_ENUM = 6, |
| 3596 | google_protobuf_FieldOptions_TARGET_TYPE_ENUM_ENTRY = 7, |
| 3597 | google_protobuf_FieldOptions_TARGET_TYPE_SERVICE = 8, |
| 3598 | google_protobuf_FieldOptions_TARGET_TYPE_METHOD = 9 |
| 3599 | } google_protobuf_FieldOptions_OptionTargetType; |
| 3600 | |
| 3601 | typedef enum { |
Mike Kruskal | ccbdaa7 | 2023-02-02 20:42:14 -0800 | [diff] [blame] | 3602 | google_protobuf_FileOptions_SPEED = 1, |
| 3603 | google_protobuf_FileOptions_CODE_SIZE = 2, |
| 3604 | google_protobuf_FileOptions_LITE_RUNTIME = 3 |
| 3605 | } google_protobuf_FileOptions_OptimizeMode; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3606 | |
| 3607 | typedef enum { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3608 | google_protobuf_GeneratedCodeInfo_Annotation_NONE = 0, |
| 3609 | google_protobuf_GeneratedCodeInfo_Annotation_SET = 1, |
| 3610 | google_protobuf_GeneratedCodeInfo_Annotation_ALIAS = 2 |
| 3611 | } google_protobuf_GeneratedCodeInfo_Annotation_Semantic; |
| 3612 | |
Mike Kruskal | ccbdaa7 | 2023-02-02 20:42:14 -0800 | [diff] [blame] | 3613 | typedef enum { |
| 3614 | google_protobuf_MethodOptions_IDEMPOTENCY_UNKNOWN = 0, |
| 3615 | google_protobuf_MethodOptions_NO_SIDE_EFFECTS = 1, |
| 3616 | google_protobuf_MethodOptions_IDEMPOTENT = 2 |
| 3617 | } google_protobuf_MethodOptions_IdempotencyLevel; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3618 | |
Mike Kruskal | ccbdaa7 | 2023-02-02 20:42:14 -0800 | [diff] [blame] | 3619 | |
Protobuf Team Bot | 469f027 | 2023-04-21 18:12:45 -0700 | [diff] [blame] | 3620 | extern const upb_MiniTableEnum google_protobuf_ExtensionRangeOptions_VerificationState_enum_init; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 3621 | extern const upb_MiniTableEnum google_protobuf_FeatureSet_EnumType_enum_init; |
| 3622 | extern const upb_MiniTableEnum google_protobuf_FeatureSet_FieldPresence_enum_init; |
| 3623 | extern const upb_MiniTableEnum google_protobuf_FeatureSet_JsonFormat_enum_init; |
| 3624 | extern const upb_MiniTableEnum google_protobuf_FeatureSet_MessageEncoding_enum_init; |
| 3625 | extern const upb_MiniTableEnum google_protobuf_FeatureSet_RepeatedFieldEncoding_enum_init; |
| 3626 | extern const upb_MiniTableEnum google_protobuf_FeatureSet_StringFieldValidation_enum_init; |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 3627 | extern const upb_MiniTableEnum google_protobuf_FieldDescriptorProto_Label_enum_init; |
Mike Kruskal | ccbdaa7 | 2023-02-02 20:42:14 -0800 | [diff] [blame] | 3628 | extern const upb_MiniTableEnum google_protobuf_FieldDescriptorProto_Type_enum_init; |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 3629 | extern const upb_MiniTableEnum google_protobuf_FieldOptions_CType_enum_init; |
| 3630 | extern const upb_MiniTableEnum google_protobuf_FieldOptions_JSType_enum_init; |
Adam Cozzette | 90ff32c | 2023-01-21 15:04:56 -0800 | [diff] [blame] | 3631 | extern const upb_MiniTableEnum google_protobuf_FieldOptions_OptionRetention_enum_init; |
| 3632 | extern const upb_MiniTableEnum google_protobuf_FieldOptions_OptionTargetType_enum_init; |
Mike Kruskal | ccbdaa7 | 2023-02-02 20:42:14 -0800 | [diff] [blame] | 3633 | extern const upb_MiniTableEnum google_protobuf_FileOptions_OptimizeMode_enum_init; |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 3634 | extern const upb_MiniTableEnum google_protobuf_GeneratedCodeInfo_Annotation_Semantic_enum_init; |
Mike Kruskal | ccbdaa7 | 2023-02-02 20:42:14 -0800 | [diff] [blame] | 3635 | extern const upb_MiniTableEnum google_protobuf_MethodOptions_IdempotencyLevel_enum_init; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 3636 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3637 | /* google.protobuf.FileDescriptorSet */ |
| 3638 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 3639 | UPB_INLINE google_protobuf_FileDescriptorSet* google_protobuf_FileDescriptorSet_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3640 | 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] | 3641 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 3642 | UPB_INLINE google_protobuf_FileDescriptorSet* google_protobuf_FileDescriptorSet_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 3643 | google_protobuf_FileDescriptorSet* ret = google_protobuf_FileDescriptorSet_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 3644 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3645 | 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] | 3646 | return NULL; |
| 3647 | } |
| 3648 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3649 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 3650 | UPB_INLINE google_protobuf_FileDescriptorSet* google_protobuf_FileDescriptorSet_parse_ex(const char* buf, size_t size, |
| 3651 | const upb_ExtensionRegistry* extreg, |
| 3652 | int options, upb_Arena* arena) { |
| 3653 | google_protobuf_FileDescriptorSet* ret = google_protobuf_FileDescriptorSet_new(arena); |
| 3654 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3655 | 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] | 3656 | kUpb_DecodeStatus_Ok) { |
| 3657 | return NULL; |
| 3658 | } |
| 3659 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3660 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 3661 | 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] | 3662 | char* ptr; |
| 3663 | (void)upb_Encode(msg, &google_protobuf_FileDescriptorSet_msg_init, 0, arena, &ptr, len); |
| 3664 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 3665 | } |
| 3666 | UPB_INLINE char* google_protobuf_FileDescriptorSet_serialize_ex(const google_protobuf_FileDescriptorSet* msg, int options, |
| 3667 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3668 | char* ptr; |
| 3669 | (void)upb_Encode(msg, &google_protobuf_FileDescriptorSet_msg_init, options, arena, &ptr, len); |
| 3670 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 3671 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 3672 | UPB_INLINE void google_protobuf_FileDescriptorSet_clear_file(google_protobuf_FileDescriptorSet* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 3673 | 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] | 3674 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3675 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 3676 | 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] | 3677 | 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] | 3678 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 3679 | if (arr) { |
| 3680 | if (size) *size = arr->size; |
| 3681 | return (const google_protobuf_FileDescriptorProto* const*)_upb_array_constptr(arr); |
| 3682 | } else { |
| 3683 | if (size) *size = 0; |
| 3684 | return NULL; |
| 3685 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 3686 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 3687 | 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] | 3688 | 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] | 3689 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 3690 | if (size) { |
| 3691 | *size = arr ? arr->size : 0; |
| 3692 | } |
| 3693 | return arr; |
| 3694 | } |
| 3695 | 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] | 3696 | 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] | 3697 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 3698 | (upb_Message*)msg, &field, arena); |
| 3699 | if (size) { |
| 3700 | *size = arr ? arr->size : 0; |
| 3701 | } |
| 3702 | return arr; |
| 3703 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 3704 | UPB_INLINE bool google_protobuf_FileDescriptorSet_has_file(const google_protobuf_FileDescriptorSet* msg) { |
| 3705 | size_t size; |
| 3706 | google_protobuf_FileDescriptorSet_file(msg, &size); |
| 3707 | return size != 0; |
| 3708 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3709 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 3710 | 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] | 3711 | 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] | 3712 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 3713 | if (arr) { |
| 3714 | if (size) *size = arr->size; |
| 3715 | return (google_protobuf_FileDescriptorProto**)_upb_array_ptr(arr); |
| 3716 | } else { |
| 3717 | if (size) *size = 0; |
| 3718 | return NULL; |
| 3719 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3720 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 3721 | 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] | 3722 | 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] | 3723 | return (google_protobuf_FileDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3724 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 3725 | 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] | 3726 | 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] | 3727 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 3728 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 3729 | return NULL; |
| 3730 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3731 | 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] | 3732 | if (!arr || !sub) return NULL; |
| 3733 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3734 | return sub; |
| 3735 | } |
| 3736 | |
| 3737 | /* google.protobuf.FileDescriptorProto */ |
| 3738 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 3739 | UPB_INLINE google_protobuf_FileDescriptorProto* google_protobuf_FileDescriptorProto_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3740 | 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] | 3741 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 3742 | UPB_INLINE google_protobuf_FileDescriptorProto* google_protobuf_FileDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 3743 | google_protobuf_FileDescriptorProto* ret = google_protobuf_FileDescriptorProto_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 3744 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3745 | 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] | 3746 | return NULL; |
| 3747 | } |
| 3748 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3749 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 3750 | UPB_INLINE google_protobuf_FileDescriptorProto* google_protobuf_FileDescriptorProto_parse_ex(const char* buf, size_t size, |
| 3751 | const upb_ExtensionRegistry* extreg, |
| 3752 | int options, upb_Arena* arena) { |
| 3753 | google_protobuf_FileDescriptorProto* ret = google_protobuf_FileDescriptorProto_new(arena); |
| 3754 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3755 | 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] | 3756 | kUpb_DecodeStatus_Ok) { |
| 3757 | return NULL; |
| 3758 | } |
| 3759 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 3760 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 3761 | 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] | 3762 | char* ptr; |
| 3763 | (void)upb_Encode(msg, &google_protobuf_FileDescriptorProto_msg_init, 0, arena, &ptr, len); |
| 3764 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 3765 | } |
| 3766 | UPB_INLINE char* google_protobuf_FileDescriptorProto_serialize_ex(const google_protobuf_FileDescriptorProto* msg, int options, |
| 3767 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3768 | char* ptr; |
| 3769 | (void)upb_Encode(msg, &google_protobuf_FileDescriptorProto_msg_init, options, arena, &ptr, len); |
| 3770 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 3771 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 3772 | UPB_INLINE void google_protobuf_FileDescriptorProto_clear_name(google_protobuf_FileDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 3773 | 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] | 3774 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3775 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 3776 | 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] | 3777 | upb_StringView default_val = upb_StringView_FromString(""); |
| 3778 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 3779 | 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] | 3780 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 3781 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 3782 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 3783 | UPB_INLINE bool google_protobuf_FileDescriptorProto_has_name(const google_protobuf_FileDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 3784 | 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] | 3785 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 3786 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 3787 | UPB_INLINE void google_protobuf_FileDescriptorProto_clear_package(google_protobuf_FileDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 3788 | const upb_MiniTableField field = {2, UPB_SIZE(48, 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] | 3789 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3790 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 3791 | 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] | 3792 | upb_StringView default_val = upb_StringView_FromString(""); |
| 3793 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 3794 | const upb_MiniTableField field = {2, UPB_SIZE(48, 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] | 3795 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 3796 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 3797 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 3798 | UPB_INLINE bool google_protobuf_FileDescriptorProto_has_package(const google_protobuf_FileDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 3799 | const upb_MiniTableField field = {2, UPB_SIZE(48, 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] | 3800 | return _upb_Message_HasNonExtensionField(msg, &field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 3801 | } |
| 3802 | UPB_INLINE void google_protobuf_FileDescriptorProto_clear_dependency(google_protobuf_FileDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 3803 | 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] | 3804 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3805 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 3806 | 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] | 3807 | 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] | 3808 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 3809 | if (arr) { |
| 3810 | if (size) *size = arr->size; |
| 3811 | return (upb_StringView const*)_upb_array_constptr(arr); |
| 3812 | } else { |
| 3813 | if (size) *size = 0; |
| 3814 | return NULL; |
| 3815 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 3816 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 3817 | 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] | 3818 | 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] | 3819 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 3820 | if (size) { |
| 3821 | *size = arr ? arr->size : 0; |
| 3822 | } |
| 3823 | return arr; |
| 3824 | } |
| 3825 | 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] | 3826 | 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] | 3827 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 3828 | (upb_Message*)msg, &field, arena); |
| 3829 | if (size) { |
| 3830 | *size = arr ? arr->size : 0; |
| 3831 | } |
| 3832 | return arr; |
| 3833 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 3834 | UPB_INLINE bool google_protobuf_FileDescriptorProto_has_dependency(const google_protobuf_FileDescriptorProto* msg) { |
| 3835 | size_t size; |
| 3836 | google_protobuf_FileDescriptorProto_dependency(msg, &size); |
| 3837 | return size != 0; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3838 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 3839 | 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] | 3840 | 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] | 3841 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 3842 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 3843 | 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] | 3844 | 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] | 3845 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 3846 | if (arr) { |
| 3847 | if (size) *size = arr->size; |
| 3848 | return (const google_protobuf_DescriptorProto* const*)_upb_array_constptr(arr); |
| 3849 | } else { |
| 3850 | if (size) *size = 0; |
| 3851 | return NULL; |
| 3852 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 3853 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 3854 | 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] | 3855 | 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] | 3856 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 3857 | if (size) { |
| 3858 | *size = arr ? arr->size : 0; |
| 3859 | } |
| 3860 | return arr; |
| 3861 | } |
| 3862 | 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] | 3863 | 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] | 3864 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 3865 | (upb_Message*)msg, &field, arena); |
| 3866 | if (size) { |
| 3867 | *size = arr ? arr->size : 0; |
| 3868 | } |
| 3869 | return arr; |
| 3870 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 3871 | UPB_INLINE bool google_protobuf_FileDescriptorProto_has_message_type(const google_protobuf_FileDescriptorProto* msg) { |
| 3872 | size_t size; |
| 3873 | google_protobuf_FileDescriptorProto_message_type(msg, &size); |
| 3874 | return size != 0; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3875 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 3876 | 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] | 3877 | 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] | 3878 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 3879 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 3880 | 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] | 3881 | 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] | 3882 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 3883 | if (arr) { |
| 3884 | if (size) *size = arr->size; |
| 3885 | return (const google_protobuf_EnumDescriptorProto* const*)_upb_array_constptr(arr); |
| 3886 | } else { |
| 3887 | if (size) *size = 0; |
| 3888 | return NULL; |
| 3889 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 3890 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 3891 | 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] | 3892 | 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] | 3893 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 3894 | if (size) { |
| 3895 | *size = arr ? arr->size : 0; |
| 3896 | } |
| 3897 | return arr; |
| 3898 | } |
| 3899 | 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] | 3900 | 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] | 3901 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 3902 | (upb_Message*)msg, &field, arena); |
| 3903 | if (size) { |
| 3904 | *size = arr ? arr->size : 0; |
| 3905 | } |
| 3906 | return arr; |
| 3907 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 3908 | UPB_INLINE bool google_protobuf_FileDescriptorProto_has_enum_type(const google_protobuf_FileDescriptorProto* msg) { |
| 3909 | size_t size; |
| 3910 | google_protobuf_FileDescriptorProto_enum_type(msg, &size); |
| 3911 | return size != 0; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3912 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 3913 | UPB_INLINE void google_protobuf_FileDescriptorProto_clear_service(google_protobuf_FileDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 3914 | 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] | 3915 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 3916 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 3917 | 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] | 3918 | 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] | 3919 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 3920 | if (arr) { |
| 3921 | if (size) *size = arr->size; |
| 3922 | return (const google_protobuf_ServiceDescriptorProto* const*)_upb_array_constptr(arr); |
| 3923 | } else { |
| 3924 | if (size) *size = 0; |
| 3925 | return NULL; |
| 3926 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 3927 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 3928 | 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] | 3929 | 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] | 3930 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 3931 | if (size) { |
| 3932 | *size = arr ? arr->size : 0; |
| 3933 | } |
| 3934 | return arr; |
| 3935 | } |
| 3936 | 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] | 3937 | 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] | 3938 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 3939 | (upb_Message*)msg, &field, arena); |
| 3940 | if (size) { |
| 3941 | *size = arr ? arr->size : 0; |
| 3942 | } |
| 3943 | return arr; |
| 3944 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 3945 | UPB_INLINE bool google_protobuf_FileDescriptorProto_has_service(const google_protobuf_FileDescriptorProto* msg) { |
| 3946 | size_t size; |
| 3947 | google_protobuf_FileDescriptorProto_service(msg, &size); |
| 3948 | return size != 0; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3949 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 3950 | UPB_INLINE void google_protobuf_FileDescriptorProto_clear_extension(google_protobuf_FileDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 3951 | 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] | 3952 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 3953 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 3954 | 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] | 3955 | 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] | 3956 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 3957 | if (arr) { |
| 3958 | if (size) *size = arr->size; |
| 3959 | return (const google_protobuf_FieldDescriptorProto* const*)_upb_array_constptr(arr); |
| 3960 | } else { |
| 3961 | if (size) *size = 0; |
| 3962 | return NULL; |
| 3963 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 3964 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 3965 | 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] | 3966 | 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] | 3967 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 3968 | if (size) { |
| 3969 | *size = arr ? arr->size : 0; |
| 3970 | } |
| 3971 | return arr; |
| 3972 | } |
| 3973 | 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] | 3974 | 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] | 3975 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 3976 | (upb_Message*)msg, &field, arena); |
| 3977 | if (size) { |
| 3978 | *size = arr ? arr->size : 0; |
| 3979 | } |
| 3980 | return arr; |
| 3981 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 3982 | UPB_INLINE bool google_protobuf_FileDescriptorProto_has_extension(const google_protobuf_FileDescriptorProto* msg) { |
| 3983 | size_t size; |
| 3984 | google_protobuf_FileDescriptorProto_extension(msg, &size); |
| 3985 | return size != 0; |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 3986 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 3987 | UPB_INLINE void google_protobuf_FileDescriptorProto_clear_options(google_protobuf_FileDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 3988 | 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] | 3989 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 3990 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 3991 | 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] | 3992 | const google_protobuf_FileOptions* default_val = NULL; |
| 3993 | const google_protobuf_FileOptions* ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 3994 | 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] | 3995 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 3996 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 3997 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 3998 | 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] | 3999 | 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] | 4000 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4001 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4002 | 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] | 4003 | 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] | 4004 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4005 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4006 | 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] | 4007 | const google_protobuf_SourceCodeInfo* default_val = NULL; |
| 4008 | const google_protobuf_SourceCodeInfo* ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4009 | 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] | 4010 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 4011 | return ret; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4012 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4013 | 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] | 4014 | 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] | 4015 | return _upb_Message_HasNonExtensionField(msg, &field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4016 | } |
| 4017 | 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] | 4018 | 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] | 4019 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4020 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4021 | 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] | 4022 | 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] | 4023 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4024 | if (arr) { |
| 4025 | if (size) *size = arr->size; |
| 4026 | return (int32_t const*)_upb_array_constptr(arr); |
| 4027 | } else { |
| 4028 | if (size) *size = 0; |
| 4029 | return NULL; |
| 4030 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4031 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 4032 | 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] | 4033 | 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] | 4034 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4035 | if (size) { |
| 4036 | *size = arr ? arr->size : 0; |
| 4037 | } |
| 4038 | return arr; |
| 4039 | } |
| 4040 | 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] | 4041 | 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] | 4042 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 4043 | (upb_Message*)msg, &field, arena); |
| 4044 | if (size) { |
| 4045 | *size = arr ? arr->size : 0; |
| 4046 | } |
| 4047 | return arr; |
| 4048 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4049 | UPB_INLINE bool google_protobuf_FileDescriptorProto_has_public_dependency(const google_protobuf_FileDescriptorProto* msg) { |
| 4050 | size_t size; |
| 4051 | google_protobuf_FileDescriptorProto_public_dependency(msg, &size); |
| 4052 | return size != 0; |
| 4053 | } |
| 4054 | 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] | 4055 | 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] | 4056 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4057 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4058 | 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] | 4059 | 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] | 4060 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4061 | if (arr) { |
| 4062 | if (size) *size = arr->size; |
| 4063 | return (int32_t const*)_upb_array_constptr(arr); |
| 4064 | } else { |
| 4065 | if (size) *size = 0; |
| 4066 | return NULL; |
| 4067 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4068 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 4069 | 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] | 4070 | 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] | 4071 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4072 | if (size) { |
| 4073 | *size = arr ? arr->size : 0; |
| 4074 | } |
| 4075 | return arr; |
| 4076 | } |
| 4077 | 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] | 4078 | 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] | 4079 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 4080 | (upb_Message*)msg, &field, arena); |
| 4081 | if (size) { |
| 4082 | *size = arr ? arr->size : 0; |
| 4083 | } |
| 4084 | return arr; |
| 4085 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4086 | UPB_INLINE bool google_protobuf_FileDescriptorProto_has_weak_dependency(const google_protobuf_FileDescriptorProto* msg) { |
| 4087 | size_t size; |
| 4088 | google_protobuf_FileDescriptorProto_weak_dependency(msg, &size); |
| 4089 | return size != 0; |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4090 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4091 | UPB_INLINE void google_protobuf_FileDescriptorProto_clear_syntax(google_protobuf_FileDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4092 | const upb_MiniTableField field = {12, UPB_SIZE(56, 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] | 4093 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4094 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4095 | 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] | 4096 | upb_StringView default_val = upb_StringView_FromString(""); |
| 4097 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4098 | const upb_MiniTableField field = {12, UPB_SIZE(56, 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] | 4099 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 4100 | return ret; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4101 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4102 | UPB_INLINE bool google_protobuf_FileDescriptorProto_has_syntax(const google_protobuf_FileDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4103 | const upb_MiniTableField field = {12, UPB_SIZE(56, 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] | 4104 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4105 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4106 | UPB_INLINE void google_protobuf_FileDescriptorProto_clear_edition(google_protobuf_FileDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4107 | const upb_MiniTableField field = {13, UPB_SIZE(64, 128), 6, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 4108 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4109 | } |
| 4110 | UPB_INLINE upb_StringView google_protobuf_FileDescriptorProto_edition(const google_protobuf_FileDescriptorProto* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 4111 | upb_StringView default_val = upb_StringView_FromString(""); |
| 4112 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4113 | const upb_MiniTableField field = {13, UPB_SIZE(64, 128), 6, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 4114 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 4115 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4116 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4117 | UPB_INLINE bool google_protobuf_FileDescriptorProto_has_edition(const google_protobuf_FileDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4118 | const upb_MiniTableField field = {13, UPB_SIZE(64, 128), 6, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 4119 | return _upb_Message_HasNonExtensionField(msg, &field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4120 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4121 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4122 | UPB_INLINE void google_protobuf_FileDescriptorProto_set_name(google_protobuf_FileDescriptorProto *msg, upb_StringView value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4123 | 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] | 4124 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 4125 | } |
| 4126 | UPB_INLINE void google_protobuf_FileDescriptorProto_set_package(google_protobuf_FileDescriptorProto *msg, upb_StringView value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4127 | const upb_MiniTableField field = {2, UPB_SIZE(48, 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] | 4128 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 4129 | } |
| 4130 | 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] | 4131 | 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] | 4132 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 4133 | if (arr) { |
| 4134 | if (size) *size = arr->size; |
| 4135 | return (upb_StringView*)_upb_array_ptr(arr); |
| 4136 | } else { |
| 4137 | if (size) *size = 0; |
| 4138 | return NULL; |
| 4139 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4140 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4141 | 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] | 4142 | 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] | 4143 | return (upb_StringView*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4144 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4145 | 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] | 4146 | 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] | 4147 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 4148 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 4149 | return false; |
| 4150 | } |
| 4151 | _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val)); |
| 4152 | return true; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4153 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4154 | 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] | 4155 | 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] | 4156 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 4157 | if (arr) { |
| 4158 | if (size) *size = arr->size; |
| 4159 | return (google_protobuf_DescriptorProto**)_upb_array_ptr(arr); |
| 4160 | } else { |
| 4161 | if (size) *size = 0; |
| 4162 | return NULL; |
| 4163 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4164 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4165 | 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] | 4166 | 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] | 4167 | return (google_protobuf_DescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4168 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4169 | 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] | 4170 | 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] | 4171 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 4172 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 4173 | return NULL; |
| 4174 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4175 | 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] | 4176 | if (!arr || !sub) return NULL; |
| 4177 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4178 | return sub; |
| 4179 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4180 | 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] | 4181 | 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] | 4182 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 4183 | if (arr) { |
| 4184 | if (size) *size = arr->size; |
| 4185 | return (google_protobuf_EnumDescriptorProto**)_upb_array_ptr(arr); |
| 4186 | } else { |
| 4187 | if (size) *size = 0; |
| 4188 | return NULL; |
| 4189 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4190 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4191 | 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] | 4192 | 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] | 4193 | return (google_protobuf_EnumDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4194 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4195 | 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] | 4196 | 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] | 4197 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 4198 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 4199 | return NULL; |
| 4200 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4201 | 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] | 4202 | if (!arr || !sub) return NULL; |
| 4203 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4204 | return sub; |
| 4205 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4206 | 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] | 4207 | 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] | 4208 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 4209 | if (arr) { |
| 4210 | if (size) *size = arr->size; |
| 4211 | return (google_protobuf_ServiceDescriptorProto**)_upb_array_ptr(arr); |
| 4212 | } else { |
| 4213 | if (size) *size = 0; |
| 4214 | return NULL; |
| 4215 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4216 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4217 | 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] | 4218 | 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] | 4219 | return (google_protobuf_ServiceDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4220 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4221 | 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] | 4222 | 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] | 4223 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 4224 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 4225 | return NULL; |
| 4226 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4227 | 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] | 4228 | if (!arr || !sub) return NULL; |
| 4229 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4230 | return sub; |
| 4231 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4232 | 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] | 4233 | 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] | 4234 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 4235 | if (arr) { |
| 4236 | if (size) *size = arr->size; |
| 4237 | return (google_protobuf_FieldDescriptorProto**)_upb_array_ptr(arr); |
| 4238 | } else { |
| 4239 | if (size) *size = 0; |
| 4240 | return NULL; |
| 4241 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4242 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4243 | 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] | 4244 | 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] | 4245 | return (google_protobuf_FieldDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4246 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4247 | 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] | 4248 | 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] | 4249 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 4250 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 4251 | return NULL; |
| 4252 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4253 | 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] | 4254 | if (!arr || !sub) return NULL; |
| 4255 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4256 | return sub; |
| 4257 | } |
| 4258 | 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] | 4259 | 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] | 4260 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 4261 | } |
| 4262 | 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] | 4263 | struct google_protobuf_FileOptions* sub = (struct google_protobuf_FileOptions*)google_protobuf_FileDescriptorProto_options(msg); |
| 4264 | if (sub == NULL) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4265 | 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] | 4266 | if (sub) google_protobuf_FileDescriptorProto_set_options(msg, sub); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4267 | } |
| 4268 | return sub; |
| 4269 | } |
| 4270 | 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] | 4271 | 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] | 4272 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 4273 | } |
| 4274 | 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] | 4275 | struct google_protobuf_SourceCodeInfo* sub = (struct google_protobuf_SourceCodeInfo*)google_protobuf_FileDescriptorProto_source_code_info(msg); |
| 4276 | if (sub == NULL) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4277 | 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] | 4278 | if (sub) google_protobuf_FileDescriptorProto_set_source_code_info(msg, sub); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4279 | } |
| 4280 | return sub; |
| 4281 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4282 | 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] | 4283 | 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] | 4284 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 4285 | if (arr) { |
| 4286 | if (size) *size = arr->size; |
| 4287 | return (int32_t*)_upb_array_ptr(arr); |
| 4288 | } else { |
| 4289 | if (size) *size = 0; |
| 4290 | return NULL; |
| 4291 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4292 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4293 | 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] | 4294 | 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] | 4295 | return (int32_t*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4296 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4297 | 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] | 4298 | 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] | 4299 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 4300 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 4301 | return false; |
| 4302 | } |
| 4303 | _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val)); |
| 4304 | return true; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4305 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4306 | 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] | 4307 | 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] | 4308 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 4309 | if (arr) { |
| 4310 | if (size) *size = arr->size; |
| 4311 | return (int32_t*)_upb_array_ptr(arr); |
| 4312 | } else { |
| 4313 | if (size) *size = 0; |
| 4314 | return NULL; |
| 4315 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4316 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4317 | 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] | 4318 | 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] | 4319 | return (int32_t*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4320 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4321 | 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] | 4322 | 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] | 4323 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 4324 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 4325 | return false; |
| 4326 | } |
| 4327 | _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val)); |
| 4328 | return true; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4329 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4330 | UPB_INLINE void google_protobuf_FileDescriptorProto_set_syntax(google_protobuf_FileDescriptorProto *msg, upb_StringView value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4331 | const upb_MiniTableField field = {12, UPB_SIZE(56, 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] | 4332 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 4333 | } |
| 4334 | UPB_INLINE void google_protobuf_FileDescriptorProto_set_edition(google_protobuf_FileDescriptorProto *msg, upb_StringView value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4335 | const upb_MiniTableField field = {13, UPB_SIZE(64, 128), 6, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 4336 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4337 | } |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 4338 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4339 | /* google.protobuf.DescriptorProto */ |
| 4340 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4341 | UPB_INLINE google_protobuf_DescriptorProto* google_protobuf_DescriptorProto_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4342 | 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] | 4343 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4344 | UPB_INLINE google_protobuf_DescriptorProto* google_protobuf_DescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 4345 | google_protobuf_DescriptorProto* ret = google_protobuf_DescriptorProto_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 4346 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4347 | 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] | 4348 | return NULL; |
| 4349 | } |
| 4350 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4351 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4352 | UPB_INLINE google_protobuf_DescriptorProto* google_protobuf_DescriptorProto_parse_ex(const char* buf, size_t size, |
| 4353 | const upb_ExtensionRegistry* extreg, |
| 4354 | int options, upb_Arena* arena) { |
| 4355 | google_protobuf_DescriptorProto* ret = google_protobuf_DescriptorProto_new(arena); |
| 4356 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4357 | 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] | 4358 | kUpb_DecodeStatus_Ok) { |
| 4359 | return NULL; |
| 4360 | } |
| 4361 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4362 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4363 | 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] | 4364 | char* ptr; |
| 4365 | (void)upb_Encode(msg, &google_protobuf_DescriptorProto_msg_init, 0, arena, &ptr, len); |
| 4366 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4367 | } |
| 4368 | UPB_INLINE char* google_protobuf_DescriptorProto_serialize_ex(const google_protobuf_DescriptorProto* msg, int options, |
| 4369 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4370 | char* ptr; |
| 4371 | (void)upb_Encode(msg, &google_protobuf_DescriptorProto_msg_init, options, arena, &ptr, len); |
| 4372 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4373 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4374 | UPB_INLINE void google_protobuf_DescriptorProto_clear_name(google_protobuf_DescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4375 | 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] | 4376 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4377 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4378 | 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] | 4379 | upb_StringView default_val = upb_StringView_FromString(""); |
| 4380 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4381 | 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] | 4382 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 4383 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4384 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4385 | 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] | 4386 | 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] | 4387 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4388 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4389 | UPB_INLINE void google_protobuf_DescriptorProto_clear_field(google_protobuf_DescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4390 | 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] | 4391 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4392 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4393 | 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] | 4394 | 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] | 4395 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4396 | if (arr) { |
| 4397 | if (size) *size = arr->size; |
| 4398 | return (const google_protobuf_FieldDescriptorProto* const*)_upb_array_constptr(arr); |
| 4399 | } else { |
| 4400 | if (size) *size = 0; |
| 4401 | return NULL; |
| 4402 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4403 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 4404 | 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] | 4405 | 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] | 4406 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4407 | if (size) { |
| 4408 | *size = arr ? arr->size : 0; |
| 4409 | } |
| 4410 | return arr; |
| 4411 | } |
| 4412 | 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] | 4413 | 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] | 4414 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 4415 | (upb_Message*)msg, &field, arena); |
| 4416 | if (size) { |
| 4417 | *size = arr ? arr->size : 0; |
| 4418 | } |
| 4419 | return arr; |
| 4420 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4421 | UPB_INLINE bool google_protobuf_DescriptorProto_has_field(const google_protobuf_DescriptorProto* msg) { |
| 4422 | size_t size; |
| 4423 | google_protobuf_DescriptorProto_field(msg, &size); |
| 4424 | return size != 0; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4425 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4426 | 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] | 4427 | 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] | 4428 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4429 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4430 | 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] | 4431 | 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] | 4432 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4433 | if (arr) { |
| 4434 | if (size) *size = arr->size; |
| 4435 | return (const google_protobuf_DescriptorProto* const*)_upb_array_constptr(arr); |
| 4436 | } else { |
| 4437 | if (size) *size = 0; |
| 4438 | return NULL; |
| 4439 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4440 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 4441 | 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] | 4442 | 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] | 4443 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4444 | if (size) { |
| 4445 | *size = arr ? arr->size : 0; |
| 4446 | } |
| 4447 | return arr; |
| 4448 | } |
| 4449 | 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] | 4450 | 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] | 4451 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 4452 | (upb_Message*)msg, &field, arena); |
| 4453 | if (size) { |
| 4454 | *size = arr ? arr->size : 0; |
| 4455 | } |
| 4456 | return arr; |
| 4457 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4458 | UPB_INLINE bool google_protobuf_DescriptorProto_has_nested_type(const google_protobuf_DescriptorProto* msg) { |
| 4459 | size_t size; |
| 4460 | google_protobuf_DescriptorProto_nested_type(msg, &size); |
| 4461 | return size != 0; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4462 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4463 | 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] | 4464 | 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] | 4465 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4466 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4467 | 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] | 4468 | 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] | 4469 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4470 | if (arr) { |
| 4471 | if (size) *size = arr->size; |
| 4472 | return (const google_protobuf_EnumDescriptorProto* const*)_upb_array_constptr(arr); |
| 4473 | } else { |
| 4474 | if (size) *size = 0; |
| 4475 | return NULL; |
| 4476 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4477 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 4478 | 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] | 4479 | 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] | 4480 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4481 | if (size) { |
| 4482 | *size = arr ? arr->size : 0; |
| 4483 | } |
| 4484 | return arr; |
| 4485 | } |
| 4486 | 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] | 4487 | 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] | 4488 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 4489 | (upb_Message*)msg, &field, arena); |
| 4490 | if (size) { |
| 4491 | *size = arr ? arr->size : 0; |
| 4492 | } |
| 4493 | return arr; |
| 4494 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4495 | UPB_INLINE bool google_protobuf_DescriptorProto_has_enum_type(const google_protobuf_DescriptorProto* msg) { |
| 4496 | size_t size; |
| 4497 | google_protobuf_DescriptorProto_enum_type(msg, &size); |
| 4498 | return size != 0; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4499 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4500 | 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] | 4501 | 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] | 4502 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4503 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4504 | 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] | 4505 | 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] | 4506 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4507 | if (arr) { |
| 4508 | if (size) *size = arr->size; |
| 4509 | return (const google_protobuf_DescriptorProto_ExtensionRange* const*)_upb_array_constptr(arr); |
| 4510 | } else { |
| 4511 | if (size) *size = 0; |
| 4512 | return NULL; |
| 4513 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4514 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 4515 | 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] | 4516 | 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] | 4517 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4518 | if (size) { |
| 4519 | *size = arr ? arr->size : 0; |
| 4520 | } |
| 4521 | return arr; |
| 4522 | } |
| 4523 | 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] | 4524 | 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] | 4525 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 4526 | (upb_Message*)msg, &field, arena); |
| 4527 | if (size) { |
| 4528 | *size = arr ? arr->size : 0; |
| 4529 | } |
| 4530 | return arr; |
| 4531 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4532 | UPB_INLINE bool google_protobuf_DescriptorProto_has_extension_range(const google_protobuf_DescriptorProto* msg) { |
| 4533 | size_t size; |
| 4534 | google_protobuf_DescriptorProto_extension_range(msg, &size); |
| 4535 | return size != 0; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4536 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4537 | UPB_INLINE void google_protobuf_DescriptorProto_clear_extension(google_protobuf_DescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4538 | 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] | 4539 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4540 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4541 | 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] | 4542 | 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] | 4543 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4544 | if (arr) { |
| 4545 | if (size) *size = arr->size; |
| 4546 | return (const google_protobuf_FieldDescriptorProto* const*)_upb_array_constptr(arr); |
| 4547 | } else { |
| 4548 | if (size) *size = 0; |
| 4549 | return NULL; |
| 4550 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4551 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 4552 | 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] | 4553 | 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] | 4554 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4555 | if (size) { |
| 4556 | *size = arr ? arr->size : 0; |
| 4557 | } |
| 4558 | return arr; |
| 4559 | } |
| 4560 | 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] | 4561 | 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] | 4562 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 4563 | (upb_Message*)msg, &field, arena); |
| 4564 | if (size) { |
| 4565 | *size = arr ? arr->size : 0; |
| 4566 | } |
| 4567 | return arr; |
| 4568 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4569 | UPB_INLINE bool google_protobuf_DescriptorProto_has_extension(const google_protobuf_DescriptorProto* msg) { |
| 4570 | size_t size; |
| 4571 | google_protobuf_DescriptorProto_extension(msg, &size); |
| 4572 | return size != 0; |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4573 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4574 | UPB_INLINE void google_protobuf_DescriptorProto_clear_options(google_protobuf_DescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4575 | 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] | 4576 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4577 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4578 | 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] | 4579 | const google_protobuf_MessageOptions* default_val = NULL; |
| 4580 | const google_protobuf_MessageOptions* ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4581 | 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] | 4582 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 4583 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4584 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4585 | 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] | 4586 | 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] | 4587 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4588 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4589 | 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] | 4590 | 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] | 4591 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4592 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4593 | 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] | 4594 | 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] | 4595 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4596 | if (arr) { |
| 4597 | if (size) *size = arr->size; |
| 4598 | return (const google_protobuf_OneofDescriptorProto* const*)_upb_array_constptr(arr); |
| 4599 | } else { |
| 4600 | if (size) *size = 0; |
| 4601 | return NULL; |
| 4602 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4603 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 4604 | 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] | 4605 | 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] | 4606 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4607 | if (size) { |
| 4608 | *size = arr ? arr->size : 0; |
| 4609 | } |
| 4610 | return arr; |
| 4611 | } |
| 4612 | 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] | 4613 | 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] | 4614 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 4615 | (upb_Message*)msg, &field, arena); |
| 4616 | if (size) { |
| 4617 | *size = arr ? arr->size : 0; |
| 4618 | } |
| 4619 | return arr; |
| 4620 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4621 | UPB_INLINE bool google_protobuf_DescriptorProto_has_oneof_decl(const google_protobuf_DescriptorProto* msg) { |
| 4622 | size_t size; |
| 4623 | google_protobuf_DescriptorProto_oneof_decl(msg, &size); |
| 4624 | return size != 0; |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4625 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4626 | 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] | 4627 | 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] | 4628 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4629 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4630 | 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] | 4631 | 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] | 4632 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4633 | if (arr) { |
| 4634 | if (size) *size = arr->size; |
| 4635 | return (const google_protobuf_DescriptorProto_ReservedRange* const*)_upb_array_constptr(arr); |
| 4636 | } else { |
| 4637 | if (size) *size = 0; |
| 4638 | return NULL; |
| 4639 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4640 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 4641 | 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] | 4642 | 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] | 4643 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4644 | if (size) { |
| 4645 | *size = arr ? arr->size : 0; |
| 4646 | } |
| 4647 | return arr; |
| 4648 | } |
| 4649 | 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] | 4650 | 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] | 4651 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 4652 | (upb_Message*)msg, &field, arena); |
| 4653 | if (size) { |
| 4654 | *size = arr ? arr->size : 0; |
| 4655 | } |
| 4656 | return arr; |
| 4657 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4658 | UPB_INLINE bool google_protobuf_DescriptorProto_has_reserved_range(const google_protobuf_DescriptorProto* msg) { |
| 4659 | size_t size; |
| 4660 | google_protobuf_DescriptorProto_reserved_range(msg, &size); |
| 4661 | return size != 0; |
| 4662 | } |
| 4663 | 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] | 4664 | 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] | 4665 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4666 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4667 | 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] | 4668 | 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] | 4669 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4670 | if (arr) { |
| 4671 | if (size) *size = arr->size; |
| 4672 | return (upb_StringView const*)_upb_array_constptr(arr); |
| 4673 | } else { |
| 4674 | if (size) *size = 0; |
| 4675 | return NULL; |
| 4676 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4677 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 4678 | 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] | 4679 | 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] | 4680 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 4681 | if (size) { |
| 4682 | *size = arr ? arr->size : 0; |
| 4683 | } |
| 4684 | return arr; |
| 4685 | } |
| 4686 | 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] | 4687 | 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] | 4688 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 4689 | (upb_Message*)msg, &field, arena); |
| 4690 | if (size) { |
| 4691 | *size = arr ? arr->size : 0; |
| 4692 | } |
| 4693 | return arr; |
| 4694 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4695 | UPB_INLINE bool google_protobuf_DescriptorProto_has_reserved_name(const google_protobuf_DescriptorProto* msg) { |
| 4696 | size_t size; |
| 4697 | google_protobuf_DescriptorProto_reserved_name(msg, &size); |
| 4698 | return size != 0; |
| 4699 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4700 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4701 | 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] | 4702 | 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] | 4703 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 4704 | } |
| 4705 | 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] | 4706 | 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] | 4707 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 4708 | if (arr) { |
| 4709 | if (size) *size = arr->size; |
| 4710 | return (google_protobuf_FieldDescriptorProto**)_upb_array_ptr(arr); |
| 4711 | } else { |
| 4712 | if (size) *size = 0; |
| 4713 | return NULL; |
| 4714 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4715 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4716 | 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] | 4717 | 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] | 4718 | return (google_protobuf_FieldDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4719 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4720 | 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] | 4721 | 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] | 4722 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 4723 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 4724 | return NULL; |
| 4725 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4726 | 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] | 4727 | if (!arr || !sub) return NULL; |
| 4728 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4729 | return sub; |
| 4730 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4731 | 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] | 4732 | 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] | 4733 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 4734 | if (arr) { |
| 4735 | if (size) *size = arr->size; |
| 4736 | return (google_protobuf_DescriptorProto**)_upb_array_ptr(arr); |
| 4737 | } else { |
| 4738 | if (size) *size = 0; |
| 4739 | return NULL; |
| 4740 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4741 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4742 | 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] | 4743 | 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] | 4744 | return (google_protobuf_DescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4745 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4746 | 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] | 4747 | 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] | 4748 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 4749 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 4750 | return NULL; |
| 4751 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4752 | 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] | 4753 | if (!arr || !sub) return NULL; |
| 4754 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4755 | return sub; |
| 4756 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4757 | 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] | 4758 | 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] | 4759 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 4760 | if (arr) { |
| 4761 | if (size) *size = arr->size; |
| 4762 | return (google_protobuf_EnumDescriptorProto**)_upb_array_ptr(arr); |
| 4763 | } else { |
| 4764 | if (size) *size = 0; |
| 4765 | return NULL; |
| 4766 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4767 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4768 | 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] | 4769 | 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] | 4770 | return (google_protobuf_EnumDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4771 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4772 | 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] | 4773 | 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] | 4774 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 4775 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 4776 | return NULL; |
| 4777 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4778 | 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] | 4779 | if (!arr || !sub) return NULL; |
| 4780 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4781 | return sub; |
| 4782 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4783 | 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] | 4784 | 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] | 4785 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 4786 | if (arr) { |
| 4787 | if (size) *size = arr->size; |
| 4788 | return (google_protobuf_DescriptorProto_ExtensionRange**)_upb_array_ptr(arr); |
| 4789 | } else { |
| 4790 | if (size) *size = 0; |
| 4791 | return NULL; |
| 4792 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4793 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4794 | 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] | 4795 | 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] | 4796 | return (google_protobuf_DescriptorProto_ExtensionRange**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4797 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4798 | 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] | 4799 | 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] | 4800 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 4801 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 4802 | return NULL; |
| 4803 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4804 | 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] | 4805 | if (!arr || !sub) return NULL; |
| 4806 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4807 | return sub; |
| 4808 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4809 | 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] | 4810 | 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] | 4811 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 4812 | if (arr) { |
| 4813 | if (size) *size = arr->size; |
| 4814 | return (google_protobuf_FieldDescriptorProto**)_upb_array_ptr(arr); |
| 4815 | } else { |
| 4816 | if (size) *size = 0; |
| 4817 | return NULL; |
| 4818 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4819 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4820 | 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] | 4821 | 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] | 4822 | return (google_protobuf_FieldDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4823 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4824 | 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] | 4825 | 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] | 4826 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 4827 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 4828 | return NULL; |
| 4829 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4830 | 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] | 4831 | if (!arr || !sub) return NULL; |
| 4832 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4833 | return sub; |
| 4834 | } |
| 4835 | 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] | 4836 | 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] | 4837 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 4838 | } |
| 4839 | 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] | 4840 | struct google_protobuf_MessageOptions* sub = (struct google_protobuf_MessageOptions*)google_protobuf_DescriptorProto_options(msg); |
| 4841 | if (sub == NULL) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4842 | 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] | 4843 | if (sub) google_protobuf_DescriptorProto_set_options(msg, sub); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4844 | } |
| 4845 | return sub; |
| 4846 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4847 | 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] | 4848 | 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] | 4849 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 4850 | if (arr) { |
| 4851 | if (size) *size = arr->size; |
| 4852 | return (google_protobuf_OneofDescriptorProto**)_upb_array_ptr(arr); |
| 4853 | } else { |
| 4854 | if (size) *size = 0; |
| 4855 | return NULL; |
| 4856 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4857 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4858 | 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] | 4859 | 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] | 4860 | return (google_protobuf_OneofDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4861 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4862 | 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] | 4863 | 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] | 4864 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 4865 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 4866 | return NULL; |
| 4867 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4868 | 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] | 4869 | if (!arr || !sub) return NULL; |
| 4870 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4871 | return sub; |
| 4872 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4873 | 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] | 4874 | 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] | 4875 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 4876 | if (arr) { |
| 4877 | if (size) *size = arr->size; |
| 4878 | return (google_protobuf_DescriptorProto_ReservedRange**)_upb_array_ptr(arr); |
| 4879 | } else { |
| 4880 | if (size) *size = 0; |
| 4881 | return NULL; |
| 4882 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4883 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4884 | 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] | 4885 | 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] | 4886 | return (google_protobuf_DescriptorProto_ReservedRange**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4887 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4888 | 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] | 4889 | 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] | 4890 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 4891 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 4892 | return NULL; |
| 4893 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4894 | 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] | 4895 | if (!arr || !sub) return NULL; |
| 4896 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4897 | return sub; |
| 4898 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4899 | 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] | 4900 | 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] | 4901 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 4902 | if (arr) { |
| 4903 | if (size) *size = arr->size; |
| 4904 | return (upb_StringView*)_upb_array_ptr(arr); |
| 4905 | } else { |
| 4906 | if (size) *size = 0; |
| 4907 | return NULL; |
| 4908 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4909 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 4910 | 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] | 4911 | 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] | 4912 | return (upb_StringView*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4913 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4914 | 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] | 4915 | 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] | 4916 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 4917 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 4918 | return false; |
| 4919 | } |
| 4920 | _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val)); |
| 4921 | return true; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4922 | } |
| 4923 | |
| 4924 | /* google.protobuf.DescriptorProto.ExtensionRange */ |
| 4925 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4926 | UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange* google_protobuf_DescriptorProto_ExtensionRange_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4927 | 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] | 4928 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4929 | UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange* google_protobuf_DescriptorProto_ExtensionRange_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 4930 | google_protobuf_DescriptorProto_ExtensionRange* ret = google_protobuf_DescriptorProto_ExtensionRange_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 4931 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4932 | 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] | 4933 | return NULL; |
| 4934 | } |
| 4935 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4936 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4937 | UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange* google_protobuf_DescriptorProto_ExtensionRange_parse_ex(const char* buf, size_t size, |
| 4938 | const upb_ExtensionRegistry* extreg, |
| 4939 | int options, upb_Arena* arena) { |
| 4940 | google_protobuf_DescriptorProto_ExtensionRange* ret = google_protobuf_DescriptorProto_ExtensionRange_new(arena); |
| 4941 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4942 | 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] | 4943 | kUpb_DecodeStatus_Ok) { |
| 4944 | return NULL; |
| 4945 | } |
| 4946 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 4947 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4948 | 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] | 4949 | char* ptr; |
| 4950 | (void)upb_Encode(msg, &google_protobuf_DescriptorProto_ExtensionRange_msg_init, 0, arena, &ptr, len); |
| 4951 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4952 | } |
| 4953 | UPB_INLINE char* google_protobuf_DescriptorProto_ExtensionRange_serialize_ex(const google_protobuf_DescriptorProto_ExtensionRange* msg, int options, |
| 4954 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4955 | char* ptr; |
| 4956 | (void)upb_Encode(msg, &google_protobuf_DescriptorProto_ExtensionRange_msg_init, options, arena, &ptr, len); |
| 4957 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4958 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4959 | 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] | 4960 | 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] | 4961 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4962 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4963 | 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] | 4964 | int32_t default_val = (int32_t)0; |
| 4965 | int32_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4966 | 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] | 4967 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 4968 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4969 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4970 | 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] | 4971 | 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] | 4972 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4973 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4974 | 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] | 4975 | 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] | 4976 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4977 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4978 | 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] | 4979 | int32_t default_val = (int32_t)0; |
| 4980 | int32_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4981 | 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] | 4982 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 4983 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4984 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4985 | 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] | 4986 | 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] | 4987 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 4988 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 4989 | 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] | 4990 | 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] | 4991 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 4992 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4993 | 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] | 4994 | const google_protobuf_ExtensionRangeOptions* default_val = NULL; |
| 4995 | const google_protobuf_ExtensionRangeOptions* ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 4996 | 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] | 4997 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 4998 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 4999 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5000 | 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] | 5001 | 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] | 5002 | return _upb_Message_HasNonExtensionField(msg, &field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5003 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5004 | |
| 5005 | 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] | 5006 | 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] | 5007 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 5008 | } |
| 5009 | 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] | 5010 | 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] | 5011 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 5012 | } |
| 5013 | 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] | 5014 | 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] | 5015 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 5016 | } |
| 5017 | 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] | 5018 | struct google_protobuf_ExtensionRangeOptions* sub = (struct google_protobuf_ExtensionRangeOptions*)google_protobuf_DescriptorProto_ExtensionRange_options(msg); |
| 5019 | if (sub == NULL) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5020 | 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] | 5021 | if (sub) google_protobuf_DescriptorProto_ExtensionRange_set_options(msg, sub); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5022 | } |
| 5023 | return sub; |
| 5024 | } |
| 5025 | |
| 5026 | /* google.protobuf.DescriptorProto.ReservedRange */ |
| 5027 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5028 | UPB_INLINE google_protobuf_DescriptorProto_ReservedRange* google_protobuf_DescriptorProto_ReservedRange_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5029 | 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] | 5030 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5031 | UPB_INLINE google_protobuf_DescriptorProto_ReservedRange* google_protobuf_DescriptorProto_ReservedRange_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 5032 | google_protobuf_DescriptorProto_ReservedRange* ret = google_protobuf_DescriptorProto_ReservedRange_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 5033 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5034 | 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] | 5035 | return NULL; |
| 5036 | } |
| 5037 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5038 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5039 | UPB_INLINE google_protobuf_DescriptorProto_ReservedRange* google_protobuf_DescriptorProto_ReservedRange_parse_ex(const char* buf, size_t size, |
| 5040 | const upb_ExtensionRegistry* extreg, |
| 5041 | int options, upb_Arena* arena) { |
| 5042 | google_protobuf_DescriptorProto_ReservedRange* ret = google_protobuf_DescriptorProto_ReservedRange_new(arena); |
| 5043 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5044 | 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] | 5045 | kUpb_DecodeStatus_Ok) { |
| 5046 | return NULL; |
| 5047 | } |
| 5048 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5049 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5050 | 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] | 5051 | char* ptr; |
| 5052 | (void)upb_Encode(msg, &google_protobuf_DescriptorProto_ReservedRange_msg_init, 0, arena, &ptr, len); |
| 5053 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5054 | } |
| 5055 | UPB_INLINE char* google_protobuf_DescriptorProto_ReservedRange_serialize_ex(const google_protobuf_DescriptorProto_ReservedRange* msg, int options, |
| 5056 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5057 | char* ptr; |
| 5058 | (void)upb_Encode(msg, &google_protobuf_DescriptorProto_ReservedRange_msg_init, options, arena, &ptr, len); |
| 5059 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5060 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5061 | 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] | 5062 | 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] | 5063 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5064 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5065 | 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] | 5066 | int32_t default_val = (int32_t)0; |
| 5067 | int32_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5068 | 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] | 5069 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 5070 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5071 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5072 | 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] | 5073 | 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] | 5074 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5075 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5076 | 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] | 5077 | 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] | 5078 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5079 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5080 | 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] | 5081 | int32_t default_val = (int32_t)0; |
| 5082 | int32_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5083 | 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] | 5084 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 5085 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5086 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5087 | 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] | 5088 | 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] | 5089 | return _upb_Message_HasNonExtensionField(msg, &field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5090 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5091 | |
| 5092 | 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] | 5093 | 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] | 5094 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 5095 | } |
| 5096 | 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] | 5097 | 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] | 5098 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5099 | } |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 5100 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5101 | /* google.protobuf.ExtensionRangeOptions */ |
| 5102 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5103 | UPB_INLINE google_protobuf_ExtensionRangeOptions* google_protobuf_ExtensionRangeOptions_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5104 | 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] | 5105 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5106 | UPB_INLINE google_protobuf_ExtensionRangeOptions* google_protobuf_ExtensionRangeOptions_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 5107 | google_protobuf_ExtensionRangeOptions* ret = google_protobuf_ExtensionRangeOptions_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 5108 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5109 | 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] | 5110 | return NULL; |
| 5111 | } |
| 5112 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5113 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5114 | UPB_INLINE google_protobuf_ExtensionRangeOptions* google_protobuf_ExtensionRangeOptions_parse_ex(const char* buf, size_t size, |
| 5115 | const upb_ExtensionRegistry* extreg, |
| 5116 | int options, upb_Arena* arena) { |
| 5117 | google_protobuf_ExtensionRangeOptions* ret = google_protobuf_ExtensionRangeOptions_new(arena); |
| 5118 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5119 | 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] | 5120 | kUpb_DecodeStatus_Ok) { |
| 5121 | return NULL; |
| 5122 | } |
| 5123 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5124 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5125 | UPB_INLINE 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] | 5126 | char* ptr; |
| 5127 | (void)upb_Encode(msg, &google_protobuf_ExtensionRangeOptions_msg_init, 0, arena, &ptr, len); |
| 5128 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5129 | } |
| 5130 | UPB_INLINE char* google_protobuf_ExtensionRangeOptions_serialize_ex(const google_protobuf_ExtensionRangeOptions* msg, int options, |
| 5131 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5132 | char* ptr; |
| 5133 | (void)upb_Encode(msg, &google_protobuf_ExtensionRangeOptions_msg_init, options, arena, &ptr, len); |
| 5134 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5135 | } |
Mike Kruskal | 145900f | 2023-03-27 09:55:52 -0700 | [diff] [blame] | 5136 | UPB_INLINE void google_protobuf_ExtensionRangeOptions_clear_declaration(google_protobuf_ExtensionRangeOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5137 | 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] | 5138 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 5139 | } |
| 5140 | 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] | 5141 | 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] | 5142 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 5143 | if (arr) { |
| 5144 | if (size) *size = arr->size; |
| 5145 | return (const google_protobuf_ExtensionRangeOptions_Declaration* const*)_upb_array_constptr(arr); |
| 5146 | } else { |
| 5147 | if (size) *size = 0; |
| 5148 | return NULL; |
| 5149 | } |
| 5150 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 5151 | 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] | 5152 | 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] | 5153 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 5154 | if (size) { |
| 5155 | *size = arr ? arr->size : 0; |
| 5156 | } |
| 5157 | return arr; |
| 5158 | } |
| 5159 | 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] | 5160 | 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] | 5161 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 5162 | (upb_Message*)msg, &field, arena); |
| 5163 | if (size) { |
| 5164 | *size = arr ? arr->size : 0; |
| 5165 | } |
| 5166 | return arr; |
| 5167 | } |
Mike Kruskal | 145900f | 2023-03-27 09:55:52 -0700 | [diff] [blame] | 5168 | UPB_INLINE bool google_protobuf_ExtensionRangeOptions_has_declaration(const google_protobuf_ExtensionRangeOptions* msg) { |
| 5169 | size_t size; |
| 5170 | google_protobuf_ExtensionRangeOptions_declaration(msg, &size); |
| 5171 | return size != 0; |
| 5172 | } |
Protobuf Team Bot | 469f027 | 2023-04-21 18:12:45 -0700 | [diff] [blame] | 5173 | UPB_INLINE void google_protobuf_ExtensionRangeOptions_clear_verification(google_protobuf_ExtensionRangeOptions* msg) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 5174 | 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] | 5175 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 5176 | } |
| 5177 | UPB_INLINE int32_t google_protobuf_ExtensionRangeOptions_verification(const google_protobuf_ExtensionRangeOptions* msg) { |
| 5178 | int32_t default_val = 1; |
| 5179 | int32_t ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 5180 | 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] | 5181 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 5182 | return ret; |
| 5183 | } |
| 5184 | 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] | 5185 | const upb_MiniTableField field = {3, UPB_SIZE(8, 4), 1, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
| 5186 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 5187 | } |
| 5188 | UPB_INLINE void google_protobuf_ExtensionRangeOptions_clear_features(google_protobuf_ExtensionRangeOptions* msg) { |
| 5189 | 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)}; |
| 5190 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 5191 | } |
| 5192 | UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_ExtensionRangeOptions_features(const google_protobuf_ExtensionRangeOptions* msg) { |
| 5193 | const google_protobuf_FeatureSet* default_val = NULL; |
| 5194 | const google_protobuf_FeatureSet* ret; |
| 5195 | 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)}; |
| 5196 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 5197 | return ret; |
| 5198 | } |
| 5199 | UPB_INLINE bool google_protobuf_ExtensionRangeOptions_has_features(const google_protobuf_ExtensionRangeOptions* msg) { |
| 5200 | 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] | 5201 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 5202 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5203 | 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] | 5204 | 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] | 5205 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5206 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5207 | 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] | 5208 | 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] | 5209 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 5210 | if (arr) { |
| 5211 | if (size) *size = arr->size; |
| 5212 | return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr); |
| 5213 | } else { |
| 5214 | if (size) *size = 0; |
| 5215 | return NULL; |
| 5216 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5217 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 5218 | 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] | 5219 | 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] | 5220 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 5221 | if (size) { |
| 5222 | *size = arr ? arr->size : 0; |
| 5223 | } |
| 5224 | return arr; |
| 5225 | } |
| 5226 | 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] | 5227 | 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] | 5228 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 5229 | (upb_Message*)msg, &field, arena); |
| 5230 | if (size) { |
| 5231 | *size = arr ? arr->size : 0; |
| 5232 | } |
| 5233 | return arr; |
| 5234 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5235 | UPB_INLINE bool google_protobuf_ExtensionRangeOptions_has_uninterpreted_option(const google_protobuf_ExtensionRangeOptions* msg) { |
| 5236 | size_t size; |
| 5237 | google_protobuf_ExtensionRangeOptions_uninterpreted_option(msg, &size); |
| 5238 | return size != 0; |
| 5239 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5240 | |
Mike Kruskal | 145900f | 2023-03-27 09:55:52 -0700 | [diff] [blame] | 5241 | 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] | 5242 | 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] | 5243 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 5244 | if (arr) { |
| 5245 | if (size) *size = arr->size; |
| 5246 | return (google_protobuf_ExtensionRangeOptions_Declaration**)_upb_array_ptr(arr); |
| 5247 | } else { |
| 5248 | if (size) *size = 0; |
| 5249 | return NULL; |
| 5250 | } |
| 5251 | } |
| 5252 | 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] | 5253 | 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] | 5254 | return (google_protobuf_ExtensionRangeOptions_Declaration**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Mike Kruskal | 145900f | 2023-03-27 09:55:52 -0700 | [diff] [blame] | 5255 | } |
| 5256 | 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] | 5257 | 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] | 5258 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 5259 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 5260 | return NULL; |
| 5261 | } |
| 5262 | struct google_protobuf_ExtensionRangeOptions_Declaration* sub = (struct google_protobuf_ExtensionRangeOptions_Declaration*)_upb_Message_New(&google_protobuf_ExtensionRangeOptions_Declaration_msg_init, arena); |
| 5263 | if (!arr || !sub) return NULL; |
| 5264 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
| 5265 | return sub; |
| 5266 | } |
Protobuf Team Bot | 469f027 | 2023-04-21 18:12:45 -0700 | [diff] [blame] | 5267 | 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] | 5268 | 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] | 5269 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 5270 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 5271 | UPB_INLINE void google_protobuf_ExtensionRangeOptions_set_features(google_protobuf_ExtensionRangeOptions *msg, google_protobuf_FeatureSet* value) { |
| 5272 | 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)}; |
| 5273 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 5274 | } |
| 5275 | UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_ExtensionRangeOptions_mutable_features(google_protobuf_ExtensionRangeOptions* msg, upb_Arena* arena) { |
| 5276 | struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_ExtensionRangeOptions_features(msg); |
| 5277 | if (sub == NULL) { |
| 5278 | sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google_protobuf_FeatureSet_msg_init, arena); |
| 5279 | if (sub) google_protobuf_ExtensionRangeOptions_set_features(msg, sub); |
| 5280 | } |
| 5281 | return sub; |
| 5282 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5283 | 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] | 5284 | 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] | 5285 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 5286 | if (arr) { |
| 5287 | if (size) *size = arr->size; |
| 5288 | return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr); |
| 5289 | } else { |
| 5290 | if (size) *size = 0; |
| 5291 | return NULL; |
| 5292 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5293 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5294 | 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] | 5295 | 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] | 5296 | return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5297 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5298 | 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] | 5299 | 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] | 5300 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 5301 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 5302 | return NULL; |
| 5303 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5304 | 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] | 5305 | if (!arr || !sub) return NULL; |
| 5306 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5307 | return sub; |
| 5308 | } |
| 5309 | |
Mike Kruskal | 145900f | 2023-03-27 09:55:52 -0700 | [diff] [blame] | 5310 | /* google.protobuf.ExtensionRangeOptions.Declaration */ |
| 5311 | |
| 5312 | UPB_INLINE google_protobuf_ExtensionRangeOptions_Declaration* google_protobuf_ExtensionRangeOptions_Declaration_new(upb_Arena* arena) { |
| 5313 | return (google_protobuf_ExtensionRangeOptions_Declaration*)_upb_Message_New(&google_protobuf_ExtensionRangeOptions_Declaration_msg_init, arena); |
| 5314 | } |
| 5315 | UPB_INLINE google_protobuf_ExtensionRangeOptions_Declaration* google_protobuf_ExtensionRangeOptions_Declaration_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 5316 | google_protobuf_ExtensionRangeOptions_Declaration* ret = google_protobuf_ExtensionRangeOptions_Declaration_new(arena); |
| 5317 | if (!ret) return NULL; |
| 5318 | if (upb_Decode(buf, size, ret, &google_protobuf_ExtensionRangeOptions_Declaration_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { |
| 5319 | return NULL; |
| 5320 | } |
| 5321 | return ret; |
| 5322 | } |
| 5323 | UPB_INLINE google_protobuf_ExtensionRangeOptions_Declaration* google_protobuf_ExtensionRangeOptions_Declaration_parse_ex(const char* buf, size_t size, |
| 5324 | const upb_ExtensionRegistry* extreg, |
| 5325 | int options, upb_Arena* arena) { |
| 5326 | google_protobuf_ExtensionRangeOptions_Declaration* ret = google_protobuf_ExtensionRangeOptions_Declaration_new(arena); |
| 5327 | if (!ret) return NULL; |
| 5328 | if (upb_Decode(buf, size, ret, &google_protobuf_ExtensionRangeOptions_Declaration_msg_init, extreg, options, arena) != |
| 5329 | kUpb_DecodeStatus_Ok) { |
| 5330 | return NULL; |
| 5331 | } |
| 5332 | return ret; |
| 5333 | } |
| 5334 | UPB_INLINE char* google_protobuf_ExtensionRangeOptions_Declaration_serialize(const google_protobuf_ExtensionRangeOptions_Declaration* msg, upb_Arena* arena, size_t* len) { |
| 5335 | char* ptr; |
| 5336 | (void)upb_Encode(msg, &google_protobuf_ExtensionRangeOptions_Declaration_msg_init, 0, arena, &ptr, len); |
| 5337 | return ptr; |
| 5338 | } |
| 5339 | UPB_INLINE char* google_protobuf_ExtensionRangeOptions_Declaration_serialize_ex(const google_protobuf_ExtensionRangeOptions_Declaration* msg, int options, |
| 5340 | upb_Arena* arena, size_t* len) { |
| 5341 | char* ptr; |
| 5342 | (void)upb_Encode(msg, &google_protobuf_ExtensionRangeOptions_Declaration_msg_init, options, arena, &ptr, len); |
| 5343 | return ptr; |
| 5344 | } |
| 5345 | 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] | 5346 | 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] | 5347 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 5348 | } |
| 5349 | UPB_INLINE int32_t google_protobuf_ExtensionRangeOptions_Declaration_number(const google_protobuf_ExtensionRangeOptions_Declaration* msg) { |
| 5350 | int32_t default_val = (int32_t)0; |
| 5351 | int32_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5352 | 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] | 5353 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 5354 | return ret; |
| 5355 | } |
| 5356 | 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] | 5357 | 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] | 5358 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 5359 | } |
| 5360 | 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] | 5361 | 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] | 5362 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 5363 | } |
| 5364 | UPB_INLINE upb_StringView google_protobuf_ExtensionRangeOptions_Declaration_full_name(const google_protobuf_ExtensionRangeOptions_Declaration* msg) { |
| 5365 | upb_StringView default_val = upb_StringView_FromString(""); |
| 5366 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5367 | 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] | 5368 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 5369 | return ret; |
| 5370 | } |
| 5371 | 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] | 5372 | 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] | 5373 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 5374 | } |
| 5375 | 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] | 5376 | 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] | 5377 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 5378 | } |
| 5379 | UPB_INLINE upb_StringView google_protobuf_ExtensionRangeOptions_Declaration_type(const google_protobuf_ExtensionRangeOptions_Declaration* msg) { |
| 5380 | upb_StringView default_val = upb_StringView_FromString(""); |
| 5381 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5382 | 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] | 5383 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 5384 | return ret; |
| 5385 | } |
| 5386 | 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] | 5387 | 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] | 5388 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 5389 | } |
| 5390 | UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_clear_is_repeated(google_protobuf_ExtensionRangeOptions_Declaration* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5391 | const upb_MiniTableField field = {4, 8, 4, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 145900f | 2023-03-27 09:55:52 -0700 | [diff] [blame] | 5392 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 5393 | } |
| 5394 | UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_is_repeated(const google_protobuf_ExtensionRangeOptions_Declaration* msg) { |
| 5395 | bool default_val = false; |
| 5396 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5397 | const upb_MiniTableField field = {4, 8, 4, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 145900f | 2023-03-27 09:55:52 -0700 | [diff] [blame] | 5398 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 5399 | return ret; |
| 5400 | } |
| 5401 | UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_has_is_repeated(const google_protobuf_ExtensionRangeOptions_Declaration* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5402 | const upb_MiniTableField field = {4, 8, 4, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 145900f | 2023-03-27 09:55:52 -0700 | [diff] [blame] | 5403 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 5404 | } |
Protobuf Team Bot | 41287bd | 2023-04-10 18:57:14 -0700 | [diff] [blame] | 5405 | UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_clear_reserved(google_protobuf_ExtensionRangeOptions_Declaration* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5406 | const upb_MiniTableField field = {5, 9, 5, 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] | 5407 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 5408 | } |
| 5409 | UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_reserved(const google_protobuf_ExtensionRangeOptions_Declaration* msg) { |
| 5410 | bool default_val = false; |
| 5411 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5412 | const upb_MiniTableField field = {5, 9, 5, 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] | 5413 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 5414 | return ret; |
| 5415 | } |
| 5416 | UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_has_reserved(const google_protobuf_ExtensionRangeOptions_Declaration* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5417 | const upb_MiniTableField field = {5, 9, 5, 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] | 5418 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 5419 | } |
Protobuf Team Bot | 469f027 | 2023-04-21 18:12:45 -0700 | [diff] [blame] | 5420 | UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_clear_repeated(google_protobuf_ExtensionRangeOptions_Declaration* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5421 | const upb_MiniTableField field = {6, 10, 6, 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] | 5422 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 5423 | } |
| 5424 | UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_repeated(const google_protobuf_ExtensionRangeOptions_Declaration* msg) { |
| 5425 | bool default_val = false; |
| 5426 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5427 | const upb_MiniTableField field = {6, 10, 6, 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] | 5428 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 5429 | return ret; |
| 5430 | } |
| 5431 | UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_has_repeated(const google_protobuf_ExtensionRangeOptions_Declaration* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5432 | const upb_MiniTableField field = {6, 10, 6, 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] | 5433 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 5434 | } |
Mike Kruskal | 145900f | 2023-03-27 09:55:52 -0700 | [diff] [blame] | 5435 | |
| 5436 | 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] | 5437 | 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] | 5438 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 5439 | } |
| 5440 | 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] | 5441 | 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] | 5442 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 5443 | } |
| 5444 | 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] | 5445 | 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] | 5446 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 5447 | } |
| 5448 | UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_set_is_repeated(google_protobuf_ExtensionRangeOptions_Declaration *msg, bool value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5449 | const upb_MiniTableField field = {4, 8, 4, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | 145900f | 2023-03-27 09:55:52 -0700 | [diff] [blame] | 5450 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 5451 | } |
Protobuf Team Bot | 41287bd | 2023-04-10 18:57:14 -0700 | [diff] [blame] | 5452 | UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_set_reserved(google_protobuf_ExtensionRangeOptions_Declaration *msg, bool value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5453 | const upb_MiniTableField field = {5, 9, 5, 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] | 5454 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 5455 | } |
Protobuf Team Bot | 469f027 | 2023-04-21 18:12:45 -0700 | [diff] [blame] | 5456 | UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_set_repeated(google_protobuf_ExtensionRangeOptions_Declaration *msg, bool value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5457 | const upb_MiniTableField field = {6, 10, 6, 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] | 5458 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 5459 | } |
Mike Kruskal | 145900f | 2023-03-27 09:55:52 -0700 | [diff] [blame] | 5460 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5461 | /* google.protobuf.FieldDescriptorProto */ |
| 5462 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5463 | UPB_INLINE google_protobuf_FieldDescriptorProto* google_protobuf_FieldDescriptorProto_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5464 | 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] | 5465 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5466 | UPB_INLINE google_protobuf_FieldDescriptorProto* google_protobuf_FieldDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 5467 | google_protobuf_FieldDescriptorProto* ret = google_protobuf_FieldDescriptorProto_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 5468 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5469 | 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] | 5470 | return NULL; |
| 5471 | } |
| 5472 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5473 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5474 | UPB_INLINE google_protobuf_FieldDescriptorProto* google_protobuf_FieldDescriptorProto_parse_ex(const char* buf, size_t size, |
| 5475 | const upb_ExtensionRegistry* extreg, |
| 5476 | int options, upb_Arena* arena) { |
| 5477 | google_protobuf_FieldDescriptorProto* ret = google_protobuf_FieldDescriptorProto_new(arena); |
| 5478 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5479 | 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] | 5480 | kUpb_DecodeStatus_Ok) { |
| 5481 | return NULL; |
| 5482 | } |
| 5483 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5484 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5485 | 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] | 5486 | char* ptr; |
| 5487 | (void)upb_Encode(msg, &google_protobuf_FieldDescriptorProto_msg_init, 0, arena, &ptr, len); |
| 5488 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5489 | } |
| 5490 | UPB_INLINE char* google_protobuf_FieldDescriptorProto_serialize_ex(const google_protobuf_FieldDescriptorProto* msg, int options, |
| 5491 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5492 | char* ptr; |
| 5493 | (void)upb_Encode(msg, &google_protobuf_FieldDescriptorProto_msg_init, options, arena, &ptr, len); |
| 5494 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5495 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5496 | UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_name(google_protobuf_FieldDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5497 | 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] | 5498 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5499 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5500 | 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] | 5501 | upb_StringView default_val = upb_StringView_FromString(""); |
| 5502 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5503 | 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] | 5504 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 5505 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5506 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5507 | 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] | 5508 | 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] | 5509 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5510 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5511 | UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_extendee(google_protobuf_FieldDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5512 | 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] | 5513 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5514 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5515 | 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] | 5516 | upb_StringView default_val = upb_StringView_FromString(""); |
| 5517 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5518 | 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] | 5519 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 5520 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5521 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5522 | 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] | 5523 | 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] | 5524 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5525 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5526 | UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_number(google_protobuf_FieldDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5527 | 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] | 5528 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5529 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5530 | 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] | 5531 | int32_t default_val = (int32_t)0; |
| 5532 | int32_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5533 | 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] | 5534 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 5535 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5536 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5537 | 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] | 5538 | 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] | 5539 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5540 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5541 | UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_label(google_protobuf_FieldDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5542 | 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] | 5543 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5544 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5545 | 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] | 5546 | int32_t default_val = 1; |
| 5547 | int32_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5548 | 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] | 5549 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 5550 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5551 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5552 | 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] | 5553 | 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] | 5554 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5555 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5556 | UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_type(google_protobuf_FieldDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5557 | 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] | 5558 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5559 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5560 | 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] | 5561 | int32_t default_val = 1; |
| 5562 | int32_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5563 | 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] | 5564 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 5565 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5566 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5567 | 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] | 5568 | 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] | 5569 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5570 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5571 | 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] | 5572 | 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] | 5573 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5574 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5575 | 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] | 5576 | upb_StringView default_val = upb_StringView_FromString(""); |
| 5577 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5578 | 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] | 5579 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 5580 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5581 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5582 | 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] | 5583 | 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] | 5584 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5585 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5586 | 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] | 5587 | 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] | 5588 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5589 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5590 | 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] | 5591 | upb_StringView default_val = upb_StringView_FromString(""); |
| 5592 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5593 | 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] | 5594 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 5595 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5596 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5597 | 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] | 5598 | 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] | 5599 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5600 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5601 | UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_options(google_protobuf_FieldDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5602 | 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] | 5603 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5604 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5605 | 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] | 5606 | const google_protobuf_FieldOptions* default_val = NULL; |
| 5607 | const google_protobuf_FieldOptions* ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5608 | 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] | 5609 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 5610 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5611 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5612 | 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] | 5613 | 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] | 5614 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5615 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5616 | 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] | 5617 | 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] | 5618 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5619 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5620 | 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] | 5621 | int32_t default_val = (int32_t)0; |
| 5622 | int32_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5623 | 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] | 5624 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 5625 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5626 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5627 | 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] | 5628 | 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] | 5629 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5630 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5631 | 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] | 5632 | 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] | 5633 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5634 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5635 | 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] | 5636 | upb_StringView default_val = upb_StringView_FromString(""); |
| 5637 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5638 | 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] | 5639 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 5640 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5641 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5642 | 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] | 5643 | 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] | 5644 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5645 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5646 | 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] | 5647 | 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] | 5648 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5649 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5650 | 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] | 5651 | bool default_val = false; |
| 5652 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5653 | 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] | 5654 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 5655 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5656 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5657 | 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] | 5658 | 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] | 5659 | return _upb_Message_HasNonExtensionField(msg, &field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5660 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5661 | |
| 5662 | 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] | 5663 | 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] | 5664 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 5665 | } |
| 5666 | 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] | 5667 | 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] | 5668 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 5669 | } |
| 5670 | 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] | 5671 | 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] | 5672 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 5673 | } |
| 5674 | 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] | 5675 | 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] | 5676 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 5677 | } |
| 5678 | 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] | 5679 | 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] | 5680 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 5681 | } |
| 5682 | 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] | 5683 | 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] | 5684 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 5685 | } |
| 5686 | 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] | 5687 | 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] | 5688 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 5689 | } |
| 5690 | 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] | 5691 | 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] | 5692 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 5693 | } |
| 5694 | 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] | 5695 | struct google_protobuf_FieldOptions* sub = (struct google_protobuf_FieldOptions*)google_protobuf_FieldDescriptorProto_options(msg); |
| 5696 | if (sub == NULL) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5697 | 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] | 5698 | if (sub) google_protobuf_FieldDescriptorProto_set_options(msg, sub); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5699 | } |
| 5700 | return sub; |
| 5701 | } |
| 5702 | 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] | 5703 | 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] | 5704 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 5705 | } |
| 5706 | 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] | 5707 | 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] | 5708 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 5709 | } |
| 5710 | 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] | 5711 | 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] | 5712 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5713 | } |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 5714 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5715 | /* google.protobuf.OneofDescriptorProto */ |
| 5716 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5717 | UPB_INLINE google_protobuf_OneofDescriptorProto* google_protobuf_OneofDescriptorProto_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5718 | 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] | 5719 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5720 | UPB_INLINE google_protobuf_OneofDescriptorProto* google_protobuf_OneofDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 5721 | google_protobuf_OneofDescriptorProto* ret = google_protobuf_OneofDescriptorProto_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 5722 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5723 | 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] | 5724 | return NULL; |
| 5725 | } |
| 5726 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5727 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5728 | UPB_INLINE google_protobuf_OneofDescriptorProto* google_protobuf_OneofDescriptorProto_parse_ex(const char* buf, size_t size, |
| 5729 | const upb_ExtensionRegistry* extreg, |
| 5730 | int options, upb_Arena* arena) { |
| 5731 | google_protobuf_OneofDescriptorProto* ret = google_protobuf_OneofDescriptorProto_new(arena); |
| 5732 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5733 | 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] | 5734 | kUpb_DecodeStatus_Ok) { |
| 5735 | return NULL; |
| 5736 | } |
| 5737 | return ret; |
| 5738 | } |
| 5739 | 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] | 5740 | char* ptr; |
| 5741 | (void)upb_Encode(msg, &google_protobuf_OneofDescriptorProto_msg_init, 0, arena, &ptr, len); |
| 5742 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5743 | } |
| 5744 | UPB_INLINE char* google_protobuf_OneofDescriptorProto_serialize_ex(const google_protobuf_OneofDescriptorProto* msg, int options, |
| 5745 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5746 | char* ptr; |
| 5747 | (void)upb_Encode(msg, &google_protobuf_OneofDescriptorProto_msg_init, options, arena, &ptr, len); |
| 5748 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5749 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5750 | UPB_INLINE void google_protobuf_OneofDescriptorProto_clear_name(google_protobuf_OneofDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5751 | 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] | 5752 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5753 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5754 | 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] | 5755 | upb_StringView default_val = upb_StringView_FromString(""); |
| 5756 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5757 | 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] | 5758 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 5759 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5760 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5761 | 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] | 5762 | 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] | 5763 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5764 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5765 | UPB_INLINE void google_protobuf_OneofDescriptorProto_clear_options(google_protobuf_OneofDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5766 | 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] | 5767 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5768 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5769 | 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] | 5770 | const google_protobuf_OneofOptions* default_val = NULL; |
| 5771 | const google_protobuf_OneofOptions* ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5772 | 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] | 5773 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 5774 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5775 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5776 | 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] | 5777 | 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] | 5778 | return _upb_Message_HasNonExtensionField(msg, &field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5779 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5780 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5781 | 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] | 5782 | 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] | 5783 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 5784 | } |
| 5785 | 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] | 5786 | 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] | 5787 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 5788 | } |
| 5789 | 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] | 5790 | struct google_protobuf_OneofOptions* sub = (struct google_protobuf_OneofOptions*)google_protobuf_OneofDescriptorProto_options(msg); |
| 5791 | if (sub == NULL) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5792 | 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] | 5793 | if (sub) google_protobuf_OneofDescriptorProto_set_options(msg, sub); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5794 | } |
| 5795 | return sub; |
| 5796 | } |
| 5797 | |
| 5798 | /* google.protobuf.EnumDescriptorProto */ |
| 5799 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5800 | UPB_INLINE google_protobuf_EnumDescriptorProto* google_protobuf_EnumDescriptorProto_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5801 | 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] | 5802 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5803 | UPB_INLINE google_protobuf_EnumDescriptorProto* google_protobuf_EnumDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 5804 | google_protobuf_EnumDescriptorProto* ret = google_protobuf_EnumDescriptorProto_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 5805 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5806 | 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] | 5807 | return NULL; |
| 5808 | } |
| 5809 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5810 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5811 | UPB_INLINE google_protobuf_EnumDescriptorProto* google_protobuf_EnumDescriptorProto_parse_ex(const char* buf, size_t size, |
| 5812 | const upb_ExtensionRegistry* extreg, |
| 5813 | int options, upb_Arena* arena) { |
| 5814 | google_protobuf_EnumDescriptorProto* ret = google_protobuf_EnumDescriptorProto_new(arena); |
| 5815 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5816 | 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] | 5817 | kUpb_DecodeStatus_Ok) { |
| 5818 | return NULL; |
| 5819 | } |
| 5820 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5821 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5822 | 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] | 5823 | char* ptr; |
| 5824 | (void)upb_Encode(msg, &google_protobuf_EnumDescriptorProto_msg_init, 0, arena, &ptr, len); |
| 5825 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5826 | } |
| 5827 | UPB_INLINE char* google_protobuf_EnumDescriptorProto_serialize_ex(const google_protobuf_EnumDescriptorProto* msg, int options, |
| 5828 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5829 | char* ptr; |
| 5830 | (void)upb_Encode(msg, &google_protobuf_EnumDescriptorProto_msg_init, options, arena, &ptr, len); |
| 5831 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5832 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5833 | UPB_INLINE void google_protobuf_EnumDescriptorProto_clear_name(google_protobuf_EnumDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5834 | 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] | 5835 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5836 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5837 | 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] | 5838 | upb_StringView default_val = upb_StringView_FromString(""); |
| 5839 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5840 | 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] | 5841 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 5842 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5843 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5844 | 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] | 5845 | 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] | 5846 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5847 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5848 | UPB_INLINE void google_protobuf_EnumDescriptorProto_clear_value(google_protobuf_EnumDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5849 | 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] | 5850 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5851 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5852 | 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] | 5853 | 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] | 5854 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 5855 | if (arr) { |
| 5856 | if (size) *size = arr->size; |
| 5857 | return (const google_protobuf_EnumValueDescriptorProto* const*)_upb_array_constptr(arr); |
| 5858 | } else { |
| 5859 | if (size) *size = 0; |
| 5860 | return NULL; |
| 5861 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5862 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 5863 | 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] | 5864 | 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] | 5865 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 5866 | if (size) { |
| 5867 | *size = arr ? arr->size : 0; |
| 5868 | } |
| 5869 | return arr; |
| 5870 | } |
| 5871 | 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] | 5872 | 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] | 5873 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 5874 | (upb_Message*)msg, &field, arena); |
| 5875 | if (size) { |
| 5876 | *size = arr ? arr->size : 0; |
| 5877 | } |
| 5878 | return arr; |
| 5879 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5880 | UPB_INLINE bool google_protobuf_EnumDescriptorProto_has_value(const google_protobuf_EnumDescriptorProto* msg) { |
| 5881 | size_t size; |
| 5882 | google_protobuf_EnumDescriptorProto_value(msg, &size); |
| 5883 | return size != 0; |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5884 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5885 | UPB_INLINE void google_protobuf_EnumDescriptorProto_clear_options(google_protobuf_EnumDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5886 | 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] | 5887 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5888 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5889 | 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] | 5890 | const google_protobuf_EnumOptions* default_val = NULL; |
| 5891 | const google_protobuf_EnumOptions* ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 5892 | 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] | 5893 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 5894 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5895 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5896 | 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] | 5897 | 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] | 5898 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5899 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5900 | 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] | 5901 | 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] | 5902 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5903 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5904 | 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] | 5905 | 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] | 5906 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 5907 | if (arr) { |
| 5908 | if (size) *size = arr->size; |
| 5909 | return (const google_protobuf_EnumDescriptorProto_EnumReservedRange* const*)_upb_array_constptr(arr); |
| 5910 | } else { |
| 5911 | if (size) *size = 0; |
| 5912 | return NULL; |
| 5913 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5914 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 5915 | 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] | 5916 | 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] | 5917 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 5918 | if (size) { |
| 5919 | *size = arr ? arr->size : 0; |
| 5920 | } |
| 5921 | return arr; |
| 5922 | } |
| 5923 | 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] | 5924 | 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] | 5925 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 5926 | (upb_Message*)msg, &field, arena); |
| 5927 | if (size) { |
| 5928 | *size = arr ? arr->size : 0; |
| 5929 | } |
| 5930 | return arr; |
| 5931 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5932 | UPB_INLINE bool google_protobuf_EnumDescriptorProto_has_reserved_range(const google_protobuf_EnumDescriptorProto* msg) { |
| 5933 | size_t size; |
| 5934 | google_protobuf_EnumDescriptorProto_reserved_range(msg, &size); |
| 5935 | return size != 0; |
| 5936 | } |
| 5937 | 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] | 5938 | 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] | 5939 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 5940 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5941 | 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] | 5942 | 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] | 5943 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 5944 | if (arr) { |
| 5945 | if (size) *size = arr->size; |
| 5946 | return (upb_StringView const*)_upb_array_constptr(arr); |
| 5947 | } else { |
| 5948 | if (size) *size = 0; |
| 5949 | return NULL; |
| 5950 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5951 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 5952 | 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] | 5953 | 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] | 5954 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 5955 | if (size) { |
| 5956 | *size = arr ? arr->size : 0; |
| 5957 | } |
| 5958 | return arr; |
| 5959 | } |
| 5960 | 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] | 5961 | 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] | 5962 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 5963 | (upb_Message*)msg, &field, arena); |
| 5964 | if (size) { |
| 5965 | *size = arr ? arr->size : 0; |
| 5966 | } |
| 5967 | return arr; |
| 5968 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 5969 | UPB_INLINE bool google_protobuf_EnumDescriptorProto_has_reserved_name(const google_protobuf_EnumDescriptorProto* msg) { |
| 5970 | size_t size; |
| 5971 | google_protobuf_EnumDescriptorProto_reserved_name(msg, &size); |
| 5972 | return size != 0; |
| 5973 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5974 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 5975 | 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] | 5976 | 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] | 5977 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 5978 | } |
| 5979 | 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] | 5980 | 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] | 5981 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 5982 | if (arr) { |
| 5983 | if (size) *size = arr->size; |
| 5984 | return (google_protobuf_EnumValueDescriptorProto**)_upb_array_ptr(arr); |
| 5985 | } else { |
| 5986 | if (size) *size = 0; |
| 5987 | return NULL; |
| 5988 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5989 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 5990 | 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] | 5991 | 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] | 5992 | return (google_protobuf_EnumValueDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 5993 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 5994 | 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] | 5995 | 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] | 5996 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 5997 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 5998 | return NULL; |
| 5999 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6000 | 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] | 6001 | if (!arr || !sub) return NULL; |
| 6002 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6003 | return sub; |
| 6004 | } |
| 6005 | 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] | 6006 | 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] | 6007 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6008 | } |
| 6009 | 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] | 6010 | struct google_protobuf_EnumOptions* sub = (struct google_protobuf_EnumOptions*)google_protobuf_EnumDescriptorProto_options(msg); |
| 6011 | if (sub == NULL) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6012 | 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] | 6013 | if (sub) google_protobuf_EnumDescriptorProto_set_options(msg, sub); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6014 | } |
| 6015 | return sub; |
| 6016 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 6017 | 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] | 6018 | 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] | 6019 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 6020 | if (arr) { |
| 6021 | if (size) *size = arr->size; |
| 6022 | return (google_protobuf_EnumDescriptorProto_EnumReservedRange**)_upb_array_ptr(arr); |
| 6023 | } else { |
| 6024 | if (size) *size = 0; |
| 6025 | return NULL; |
| 6026 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6027 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 6028 | 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] | 6029 | 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] | 6030 | return (google_protobuf_EnumDescriptorProto_EnumReservedRange**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6031 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6032 | 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] | 6033 | 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] | 6034 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 6035 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 6036 | return NULL; |
| 6037 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6038 | 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] | 6039 | if (!arr || !sub) return NULL; |
| 6040 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6041 | return sub; |
| 6042 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 6043 | 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] | 6044 | 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] | 6045 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 6046 | if (arr) { |
| 6047 | if (size) *size = arr->size; |
| 6048 | return (upb_StringView*)_upb_array_ptr(arr); |
| 6049 | } else { |
| 6050 | if (size) *size = 0; |
| 6051 | return NULL; |
| 6052 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6053 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 6054 | 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] | 6055 | 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] | 6056 | return (upb_StringView*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6057 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6058 | 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] | 6059 | 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] | 6060 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 6061 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 6062 | return false; |
| 6063 | } |
| 6064 | _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val)); |
| 6065 | return true; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6066 | } |
| 6067 | |
| 6068 | /* google.protobuf.EnumDescriptorProto.EnumReservedRange */ |
| 6069 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6070 | UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange* google_protobuf_EnumDescriptorProto_EnumReservedRange_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6071 | 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] | 6072 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6073 | UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange* google_protobuf_EnumDescriptorProto_EnumReservedRange_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 6074 | google_protobuf_EnumDescriptorProto_EnumReservedRange* ret = google_protobuf_EnumDescriptorProto_EnumReservedRange_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 6075 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6076 | 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] | 6077 | return NULL; |
| 6078 | } |
| 6079 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6080 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6081 | UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange* google_protobuf_EnumDescriptorProto_EnumReservedRange_parse_ex(const char* buf, size_t size, |
| 6082 | const upb_ExtensionRegistry* extreg, |
| 6083 | int options, upb_Arena* arena) { |
| 6084 | google_protobuf_EnumDescriptorProto_EnumReservedRange* ret = google_protobuf_EnumDescriptorProto_EnumReservedRange_new(arena); |
| 6085 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6086 | 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] | 6087 | kUpb_DecodeStatus_Ok) { |
| 6088 | return NULL; |
| 6089 | } |
| 6090 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6091 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6092 | 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] | 6093 | char* ptr; |
| 6094 | (void)upb_Encode(msg, &google_protobuf_EnumDescriptorProto_EnumReservedRange_msg_init, 0, arena, &ptr, len); |
| 6095 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6096 | } |
| 6097 | UPB_INLINE char* google_protobuf_EnumDescriptorProto_EnumReservedRange_serialize_ex(const google_protobuf_EnumDescriptorProto_EnumReservedRange* msg, int options, |
| 6098 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6099 | char* ptr; |
| 6100 | (void)upb_Encode(msg, &google_protobuf_EnumDescriptorProto_EnumReservedRange_msg_init, options, arena, &ptr, len); |
| 6101 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6102 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6103 | 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] | 6104 | 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] | 6105 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6106 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6107 | 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] | 6108 | int32_t default_val = (int32_t)0; |
| 6109 | int32_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6110 | 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] | 6111 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6112 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6113 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6114 | 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] | 6115 | 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] | 6116 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6117 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6118 | 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] | 6119 | 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] | 6120 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6121 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6122 | 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] | 6123 | int32_t default_val = (int32_t)0; |
| 6124 | int32_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6125 | const upb_MiniTableField field = {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] | 6126 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6127 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6128 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6129 | 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] | 6130 | 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] | 6131 | return _upb_Message_HasNonExtensionField(msg, &field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6132 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6133 | |
| 6134 | 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] | 6135 | 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] | 6136 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6137 | } |
| 6138 | 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] | 6139 | 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] | 6140 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6141 | } |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6142 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6143 | /* google.protobuf.EnumValueDescriptorProto */ |
| 6144 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6145 | UPB_INLINE google_protobuf_EnumValueDescriptorProto* google_protobuf_EnumValueDescriptorProto_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6146 | 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] | 6147 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6148 | UPB_INLINE google_protobuf_EnumValueDescriptorProto* google_protobuf_EnumValueDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 6149 | google_protobuf_EnumValueDescriptorProto* ret = google_protobuf_EnumValueDescriptorProto_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 6150 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6151 | 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] | 6152 | return NULL; |
| 6153 | } |
| 6154 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6155 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6156 | UPB_INLINE google_protobuf_EnumValueDescriptorProto* google_protobuf_EnumValueDescriptorProto_parse_ex(const char* buf, size_t size, |
| 6157 | const upb_ExtensionRegistry* extreg, |
| 6158 | int options, upb_Arena* arena) { |
| 6159 | google_protobuf_EnumValueDescriptorProto* ret = google_protobuf_EnumValueDescriptorProto_new(arena); |
| 6160 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6161 | 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] | 6162 | kUpb_DecodeStatus_Ok) { |
| 6163 | return NULL; |
| 6164 | } |
| 6165 | return ret; |
| 6166 | } |
| 6167 | 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] | 6168 | char* ptr; |
| 6169 | (void)upb_Encode(msg, &google_protobuf_EnumValueDescriptorProto_msg_init, 0, arena, &ptr, len); |
| 6170 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6171 | } |
| 6172 | UPB_INLINE char* google_protobuf_EnumValueDescriptorProto_serialize_ex(const google_protobuf_EnumValueDescriptorProto* msg, int options, |
| 6173 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6174 | char* ptr; |
| 6175 | (void)upb_Encode(msg, &google_protobuf_EnumValueDescriptorProto_msg_init, options, arena, &ptr, len); |
| 6176 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6177 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6178 | UPB_INLINE void google_protobuf_EnumValueDescriptorProto_clear_name(google_protobuf_EnumValueDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6179 | 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] | 6180 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6181 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6182 | 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] | 6183 | upb_StringView default_val = upb_StringView_FromString(""); |
| 6184 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6185 | 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] | 6186 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6187 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6188 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6189 | 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] | 6190 | 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] | 6191 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6192 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6193 | UPB_INLINE void google_protobuf_EnumValueDescriptorProto_clear_number(google_protobuf_EnumValueDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6194 | 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] | 6195 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6196 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6197 | 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] | 6198 | int32_t default_val = (int32_t)0; |
| 6199 | int32_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6200 | 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] | 6201 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6202 | return ret; |
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 bool google_protobuf_EnumValueDescriptorProto_has_number(const google_protobuf_EnumValueDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6205 | 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] | 6206 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6207 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6208 | UPB_INLINE void google_protobuf_EnumValueDescriptorProto_clear_options(google_protobuf_EnumValueDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6209 | 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] | 6210 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6211 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6212 | 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] | 6213 | const google_protobuf_EnumValueOptions* default_val = NULL; |
| 6214 | const google_protobuf_EnumValueOptions* ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6215 | 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] | 6216 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6217 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6218 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6219 | 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] | 6220 | 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] | 6221 | return _upb_Message_HasNonExtensionField(msg, &field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6222 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6223 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6224 | 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] | 6225 | 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] | 6226 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6227 | } |
| 6228 | 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] | 6229 | 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] | 6230 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6231 | } |
| 6232 | 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] | 6233 | 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] | 6234 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6235 | } |
| 6236 | 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] | 6237 | struct google_protobuf_EnumValueOptions* sub = (struct google_protobuf_EnumValueOptions*)google_protobuf_EnumValueDescriptorProto_options(msg); |
| 6238 | if (sub == NULL) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6239 | 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] | 6240 | if (sub) google_protobuf_EnumValueDescriptorProto_set_options(msg, sub); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6241 | } |
| 6242 | return sub; |
| 6243 | } |
| 6244 | |
| 6245 | /* google.protobuf.ServiceDescriptorProto */ |
| 6246 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6247 | UPB_INLINE google_protobuf_ServiceDescriptorProto* google_protobuf_ServiceDescriptorProto_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6248 | 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] | 6249 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6250 | UPB_INLINE google_protobuf_ServiceDescriptorProto* google_protobuf_ServiceDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 6251 | google_protobuf_ServiceDescriptorProto* ret = google_protobuf_ServiceDescriptorProto_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 6252 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6253 | 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] | 6254 | return NULL; |
| 6255 | } |
| 6256 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6257 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6258 | UPB_INLINE google_protobuf_ServiceDescriptorProto* google_protobuf_ServiceDescriptorProto_parse_ex(const char* buf, size_t size, |
| 6259 | const upb_ExtensionRegistry* extreg, |
| 6260 | int options, upb_Arena* arena) { |
| 6261 | google_protobuf_ServiceDescriptorProto* ret = google_protobuf_ServiceDescriptorProto_new(arena); |
| 6262 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6263 | 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] | 6264 | kUpb_DecodeStatus_Ok) { |
| 6265 | return NULL; |
| 6266 | } |
| 6267 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6268 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6269 | 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] | 6270 | char* ptr; |
| 6271 | (void)upb_Encode(msg, &google_protobuf_ServiceDescriptorProto_msg_init, 0, arena, &ptr, len); |
| 6272 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6273 | } |
| 6274 | UPB_INLINE char* google_protobuf_ServiceDescriptorProto_serialize_ex(const google_protobuf_ServiceDescriptorProto* msg, int options, |
| 6275 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6276 | char* ptr; |
| 6277 | (void)upb_Encode(msg, &google_protobuf_ServiceDescriptorProto_msg_init, options, arena, &ptr, len); |
| 6278 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6279 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6280 | UPB_INLINE void google_protobuf_ServiceDescriptorProto_clear_name(google_protobuf_ServiceDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6281 | 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] | 6282 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6283 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6284 | UPB_INLINE upb_StringView google_protobuf_ServiceDescriptorProto_name(const google_protobuf_ServiceDescriptorProto* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6285 | upb_StringView default_val = upb_StringView_FromString(""); |
| 6286 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6287 | 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] | 6288 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6289 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6290 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6291 | UPB_INLINE bool google_protobuf_ServiceDescriptorProto_has_name(const google_protobuf_ServiceDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6292 | 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] | 6293 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6294 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6295 | UPB_INLINE void google_protobuf_ServiceDescriptorProto_clear_method(google_protobuf_ServiceDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6296 | 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] | 6297 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6298 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 6299 | 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] | 6300 | 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] | 6301 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 6302 | if (arr) { |
| 6303 | if (size) *size = arr->size; |
| 6304 | return (const google_protobuf_MethodDescriptorProto* const*)_upb_array_constptr(arr); |
| 6305 | } else { |
| 6306 | if (size) *size = 0; |
| 6307 | return NULL; |
| 6308 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6309 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 6310 | 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] | 6311 | 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] | 6312 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 6313 | if (size) { |
| 6314 | *size = arr ? arr->size : 0; |
| 6315 | } |
| 6316 | return arr; |
| 6317 | } |
| 6318 | 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] | 6319 | 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] | 6320 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 6321 | (upb_Message*)msg, &field, arena); |
| 6322 | if (size) { |
| 6323 | *size = arr ? arr->size : 0; |
| 6324 | } |
| 6325 | return arr; |
| 6326 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6327 | UPB_INLINE bool google_protobuf_ServiceDescriptorProto_has_method(const google_protobuf_ServiceDescriptorProto* msg) { |
| 6328 | size_t size; |
| 6329 | google_protobuf_ServiceDescriptorProto_method(msg, &size); |
| 6330 | return size != 0; |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6331 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6332 | UPB_INLINE void google_protobuf_ServiceDescriptorProto_clear_options(google_protobuf_ServiceDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6333 | 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] | 6334 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6335 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6336 | 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] | 6337 | const google_protobuf_ServiceOptions* default_val = NULL; |
| 6338 | const google_protobuf_ServiceOptions* ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6339 | 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] | 6340 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6341 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6342 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6343 | 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] | 6344 | 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] | 6345 | return _upb_Message_HasNonExtensionField(msg, &field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6346 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6347 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6348 | 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] | 6349 | 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] | 6350 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6351 | } |
| 6352 | 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] | 6353 | 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] | 6354 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 6355 | if (arr) { |
| 6356 | if (size) *size = arr->size; |
| 6357 | return (google_protobuf_MethodDescriptorProto**)_upb_array_ptr(arr); |
| 6358 | } else { |
| 6359 | if (size) *size = 0; |
| 6360 | return NULL; |
| 6361 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6362 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 6363 | 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] | 6364 | 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] | 6365 | return (google_protobuf_MethodDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6366 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6367 | 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] | 6368 | 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] | 6369 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 6370 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 6371 | return NULL; |
| 6372 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6373 | 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] | 6374 | if (!arr || !sub) return NULL; |
| 6375 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6376 | return sub; |
| 6377 | } |
| 6378 | 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] | 6379 | 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] | 6380 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6381 | } |
| 6382 | 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] | 6383 | struct google_protobuf_ServiceOptions* sub = (struct google_protobuf_ServiceOptions*)google_protobuf_ServiceDescriptorProto_options(msg); |
| 6384 | if (sub == NULL) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6385 | 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] | 6386 | if (sub) google_protobuf_ServiceDescriptorProto_set_options(msg, sub); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6387 | } |
| 6388 | return sub; |
| 6389 | } |
| 6390 | |
| 6391 | /* google.protobuf.MethodDescriptorProto */ |
| 6392 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6393 | UPB_INLINE google_protobuf_MethodDescriptorProto* google_protobuf_MethodDescriptorProto_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6394 | 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] | 6395 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6396 | UPB_INLINE google_protobuf_MethodDescriptorProto* google_protobuf_MethodDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 6397 | google_protobuf_MethodDescriptorProto* ret = google_protobuf_MethodDescriptorProto_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 6398 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6399 | 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] | 6400 | return NULL; |
| 6401 | } |
| 6402 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6403 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6404 | UPB_INLINE google_protobuf_MethodDescriptorProto* google_protobuf_MethodDescriptorProto_parse_ex(const char* buf, size_t size, |
| 6405 | const upb_ExtensionRegistry* extreg, |
| 6406 | int options, upb_Arena* arena) { |
| 6407 | google_protobuf_MethodDescriptorProto* ret = google_protobuf_MethodDescriptorProto_new(arena); |
| 6408 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6409 | 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] | 6410 | kUpb_DecodeStatus_Ok) { |
| 6411 | return NULL; |
| 6412 | } |
| 6413 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6414 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6415 | 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] | 6416 | char* ptr; |
| 6417 | (void)upb_Encode(msg, &google_protobuf_MethodDescriptorProto_msg_init, 0, arena, &ptr, len); |
| 6418 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6419 | } |
| 6420 | UPB_INLINE char* google_protobuf_MethodDescriptorProto_serialize_ex(const google_protobuf_MethodDescriptorProto* msg, int options, |
| 6421 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6422 | char* ptr; |
| 6423 | (void)upb_Encode(msg, &google_protobuf_MethodDescriptorProto_msg_init, options, arena, &ptr, len); |
| 6424 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6425 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6426 | UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_name(google_protobuf_MethodDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6427 | 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] | 6428 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6429 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6430 | 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] | 6431 | upb_StringView default_val = upb_StringView_FromString(""); |
| 6432 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6433 | 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] | 6434 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6435 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6436 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6437 | 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] | 6438 | 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] | 6439 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6440 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6441 | 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] | 6442 | 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] | 6443 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6444 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6445 | 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] | 6446 | upb_StringView default_val = upb_StringView_FromString(""); |
| 6447 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6448 | 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] | 6449 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6450 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6451 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6452 | 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] | 6453 | 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] | 6454 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6455 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6456 | 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] | 6457 | 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] | 6458 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6459 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6460 | 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] | 6461 | upb_StringView default_val = upb_StringView_FromString(""); |
| 6462 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6463 | 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] | 6464 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6465 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6466 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6467 | 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] | 6468 | 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] | 6469 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6470 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6471 | UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_options(google_protobuf_MethodDescriptorProto* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6472 | 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] | 6473 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6474 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6475 | 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] | 6476 | const google_protobuf_MethodOptions* default_val = NULL; |
| 6477 | const google_protobuf_MethodOptions* ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6478 | 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] | 6479 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6480 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6481 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6482 | 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] | 6483 | 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] | 6484 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6485 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6486 | 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] | 6487 | 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] | 6488 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6489 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6490 | 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] | 6491 | bool default_val = false; |
| 6492 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6493 | 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] | 6494 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6495 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6496 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6497 | 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] | 6498 | 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] | 6499 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6500 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6501 | 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] | 6502 | 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] | 6503 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6504 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6505 | 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] | 6506 | bool default_val = false; |
| 6507 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6508 | 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] | 6509 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6510 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6511 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6512 | 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] | 6513 | 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] | 6514 | return _upb_Message_HasNonExtensionField(msg, &field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6515 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6516 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6517 | 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] | 6518 | 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] | 6519 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6520 | } |
| 6521 | 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] | 6522 | 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] | 6523 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6524 | } |
| 6525 | 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] | 6526 | 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] | 6527 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6528 | } |
| 6529 | 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] | 6530 | 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] | 6531 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6532 | } |
| 6533 | 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] | 6534 | struct google_protobuf_MethodOptions* sub = (struct google_protobuf_MethodOptions*)google_protobuf_MethodDescriptorProto_options(msg); |
| 6535 | if (sub == NULL) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6536 | 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] | 6537 | if (sub) google_protobuf_MethodDescriptorProto_set_options(msg, sub); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6538 | } |
| 6539 | return sub; |
| 6540 | } |
| 6541 | 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] | 6542 | 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] | 6543 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6544 | } |
| 6545 | 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] | 6546 | 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] | 6547 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6548 | } |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6549 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6550 | /* google.protobuf.FileOptions */ |
| 6551 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6552 | UPB_INLINE google_protobuf_FileOptions* google_protobuf_FileOptions_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6553 | 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] | 6554 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6555 | UPB_INLINE google_protobuf_FileOptions* google_protobuf_FileOptions_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 6556 | google_protobuf_FileOptions* ret = google_protobuf_FileOptions_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 6557 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6558 | 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] | 6559 | return NULL; |
| 6560 | } |
| 6561 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6562 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6563 | UPB_INLINE google_protobuf_FileOptions* google_protobuf_FileOptions_parse_ex(const char* buf, size_t size, |
| 6564 | const upb_ExtensionRegistry* extreg, |
| 6565 | int options, upb_Arena* arena) { |
| 6566 | google_protobuf_FileOptions* ret = google_protobuf_FileOptions_new(arena); |
| 6567 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6568 | 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] | 6569 | kUpb_DecodeStatus_Ok) { |
| 6570 | return NULL; |
| 6571 | } |
| 6572 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6573 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6574 | 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] | 6575 | char* ptr; |
| 6576 | (void)upb_Encode(msg, &google_protobuf_FileOptions_msg_init, 0, arena, &ptr, len); |
| 6577 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6578 | } |
| 6579 | UPB_INLINE char* google_protobuf_FileOptions_serialize_ex(const google_protobuf_FileOptions* msg, int options, |
| 6580 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6581 | char* ptr; |
| 6582 | (void)upb_Encode(msg, &google_protobuf_FileOptions_msg_init, options, arena, &ptr, len); |
| 6583 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6584 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6585 | 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] | 6586 | 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] | 6587 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6588 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6589 | 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] | 6590 | upb_StringView default_val = upb_StringView_FromString(""); |
| 6591 | upb_StringView ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 6592 | 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] | 6593 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6594 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6595 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6596 | 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] | 6597 | 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] | 6598 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6599 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6600 | 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] | 6601 | 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] | 6602 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6603 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6604 | 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] | 6605 | upb_StringView default_val = upb_StringView_FromString(""); |
| 6606 | upb_StringView ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 6607 | 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] | 6608 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6609 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6610 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6611 | 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] | 6612 | 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] | 6613 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6614 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6615 | 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] | 6616 | 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] | 6617 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6618 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6619 | 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] | 6620 | int32_t default_val = 1; |
| 6621 | int32_t ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 6622 | 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] | 6623 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6624 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6625 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6626 | 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] | 6627 | 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] | 6628 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6629 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6630 | 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] | 6631 | 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] | 6632 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6633 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6634 | 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] | 6635 | bool default_val = false; |
| 6636 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6637 | 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] | 6638 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6639 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6640 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6641 | 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] | 6642 | 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] | 6643 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6644 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6645 | 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] | 6646 | 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] | 6647 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6648 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6649 | 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] | 6650 | upb_StringView default_val = upb_StringView_FromString(""); |
| 6651 | upb_StringView ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 6652 | 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] | 6653 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6654 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6655 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6656 | 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] | 6657 | 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] | 6658 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6659 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6660 | 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] | 6661 | 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] | 6662 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6663 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6664 | 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] | 6665 | bool default_val = false; |
| 6666 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6667 | 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] | 6668 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6669 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6670 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6671 | 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] | 6672 | 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] | 6673 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6674 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6675 | 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] | 6676 | 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] | 6677 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6678 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6679 | 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] | 6680 | bool default_val = false; |
| 6681 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6682 | 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] | 6683 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6684 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6685 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6686 | 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] | 6687 | 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] | 6688 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6689 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6690 | 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] | 6691 | 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] | 6692 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6693 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6694 | 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] | 6695 | bool default_val = false; |
| 6696 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6697 | 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] | 6698 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6699 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6700 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6701 | 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] | 6702 | 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] | 6703 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6704 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6705 | 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] | 6706 | 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] | 6707 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6708 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6709 | 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] | 6710 | bool default_val = false; |
| 6711 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6712 | 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] | 6713 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6714 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6715 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6716 | 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] | 6717 | 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] | 6718 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6719 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6720 | UPB_INLINE void google_protobuf_FileOptions_clear_deprecated(google_protobuf_FileOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6721 | 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] | 6722 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6723 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6724 | UPB_INLINE bool google_protobuf_FileOptions_deprecated(const google_protobuf_FileOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6725 | bool default_val = false; |
| 6726 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6727 | 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] | 6728 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6729 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6730 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6731 | 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] | 6732 | 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] | 6733 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6734 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6735 | 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] | 6736 | 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] | 6737 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6738 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6739 | 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] | 6740 | bool default_val = false; |
| 6741 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6742 | 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] | 6743 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6744 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6745 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6746 | 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] | 6747 | 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] | 6748 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6749 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6750 | 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] | 6751 | 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] | 6752 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6753 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6754 | 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] | 6755 | bool default_val = true; |
| 6756 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6757 | 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] | 6758 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6759 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6760 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6761 | 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] | 6762 | 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] | 6763 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6764 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6765 | 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] | 6766 | 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] | 6767 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6768 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6769 | 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] | 6770 | upb_StringView default_val = upb_StringView_FromString(""); |
| 6771 | upb_StringView ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 6772 | 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] | 6773 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6774 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6775 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6776 | 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] | 6777 | 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] | 6778 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6779 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6780 | 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] | 6781 | 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] | 6782 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6783 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6784 | 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] | 6785 | upb_StringView default_val = upb_StringView_FromString(""); |
| 6786 | upb_StringView ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 6787 | 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] | 6788 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6789 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6790 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6791 | 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] | 6792 | 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] | 6793 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6794 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6795 | 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] | 6796 | 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] | 6797 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6798 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6799 | 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] | 6800 | upb_StringView default_val = upb_StringView_FromString(""); |
| 6801 | upb_StringView ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 6802 | 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] | 6803 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6804 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6805 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6806 | 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] | 6807 | 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] | 6808 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6809 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6810 | 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] | 6811 | 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] | 6812 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6813 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6814 | 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] | 6815 | upb_StringView default_val = upb_StringView_FromString(""); |
| 6816 | upb_StringView ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 6817 | 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] | 6818 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6819 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6820 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6821 | 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] | 6822 | 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] | 6823 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6824 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6825 | 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] | 6826 | 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] | 6827 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6828 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6829 | 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] | 6830 | upb_StringView default_val = upb_StringView_FromString(""); |
| 6831 | upb_StringView ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 6832 | 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] | 6833 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6834 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6835 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6836 | 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] | 6837 | 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] | 6838 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6839 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6840 | 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] | 6841 | 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] | 6842 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6843 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6844 | 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] | 6845 | bool default_val = false; |
| 6846 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6847 | 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] | 6848 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6849 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6850 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6851 | 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] | 6852 | 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] | 6853 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6854 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6855 | 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] | 6856 | 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] | 6857 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6858 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6859 | 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] | 6860 | upb_StringView default_val = upb_StringView_FromString(""); |
| 6861 | upb_StringView ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 6862 | 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] | 6863 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6864 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6865 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6866 | 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] | 6867 | 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] | 6868 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6869 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6870 | 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] | 6871 | 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] | 6872 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6873 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6874 | 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] | 6875 | upb_StringView default_val = upb_StringView_FromString(""); |
| 6876 | upb_StringView ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 6877 | 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] | 6878 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 6879 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6880 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6881 | 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] | 6882 | 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)}; |
| 6883 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 6884 | } |
| 6885 | UPB_INLINE void google_protobuf_FileOptions_clear_features(google_protobuf_FileOptions* msg) { |
| 6886 | 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)}; |
| 6887 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 6888 | } |
| 6889 | UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_FileOptions_features(const google_protobuf_FileOptions* msg) { |
| 6890 | const google_protobuf_FeatureSet* default_val = NULL; |
| 6891 | const google_protobuf_FeatureSet* ret; |
| 6892 | 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)}; |
| 6893 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 6894 | return ret; |
| 6895 | } |
| 6896 | UPB_INLINE bool google_protobuf_FileOptions_has_features(const google_protobuf_FileOptions* msg) { |
| 6897 | 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] | 6898 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6899 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6900 | 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] | 6901 | 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] | 6902 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 6903 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 6904 | 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] | 6905 | 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] | 6906 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 6907 | if (arr) { |
| 6908 | if (size) *size = arr->size; |
| 6909 | return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr); |
| 6910 | } else { |
| 6911 | if (size) *size = 0; |
| 6912 | return NULL; |
| 6913 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 6914 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 6915 | 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] | 6916 | 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] | 6917 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 6918 | if (size) { |
| 6919 | *size = arr ? arr->size : 0; |
| 6920 | } |
| 6921 | return arr; |
| 6922 | } |
| 6923 | 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] | 6924 | 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] | 6925 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 6926 | (upb_Message*)msg, &field, arena); |
| 6927 | if (size) { |
| 6928 | *size = arr ? arr->size : 0; |
| 6929 | } |
| 6930 | return arr; |
| 6931 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 6932 | UPB_INLINE bool google_protobuf_FileOptions_has_uninterpreted_option(const google_protobuf_FileOptions* msg) { |
| 6933 | size_t size; |
| 6934 | google_protobuf_FileOptions_uninterpreted_option(msg, &size); |
| 6935 | return size != 0; |
| 6936 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 6937 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 6938 | 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] | 6939 | 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] | 6940 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6941 | } |
| 6942 | 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] | 6943 | 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] | 6944 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6945 | } |
| 6946 | 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] | 6947 | 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] | 6948 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6949 | } |
| 6950 | 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] | 6951 | 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] | 6952 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6953 | } |
| 6954 | 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] | 6955 | 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] | 6956 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6957 | } |
| 6958 | 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] | 6959 | 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] | 6960 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6961 | } |
| 6962 | 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] | 6963 | 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] | 6964 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6965 | } |
| 6966 | 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] | 6967 | 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] | 6968 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6969 | } |
| 6970 | 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] | 6971 | 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] | 6972 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6973 | } |
| 6974 | 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] | 6975 | 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] | 6976 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6977 | } |
| 6978 | 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] | 6979 | 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] | 6980 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6981 | } |
| 6982 | UPB_INLINE void google_protobuf_FileOptions_set_cc_enable_arenas(google_protobuf_FileOptions *msg, bool value) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 6983 | 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] | 6984 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6985 | } |
| 6986 | UPB_INLINE void google_protobuf_FileOptions_set_objc_class_prefix(google_protobuf_FileOptions *msg, upb_StringView value) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 6987 | 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] | 6988 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6989 | } |
| 6990 | 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] | 6991 | 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] | 6992 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6993 | } |
| 6994 | 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] | 6995 | 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] | 6996 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 6997 | } |
| 6998 | 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] | 6999 | 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] | 7000 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7001 | } |
| 7002 | 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] | 7003 | 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] | 7004 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7005 | } |
| 7006 | 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] | 7007 | 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] | 7008 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7009 | } |
| 7010 | 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] | 7011 | 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] | 7012 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7013 | } |
| 7014 | 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] | 7015 | 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] | 7016 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7017 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7018 | UPB_INLINE void google_protobuf_FileOptions_set_features(google_protobuf_FileOptions *msg, google_protobuf_FeatureSet* value) { |
| 7019 | 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)}; |
| 7020 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 7021 | } |
| 7022 | UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_FileOptions_mutable_features(google_protobuf_FileOptions* msg, upb_Arena* arena) { |
| 7023 | struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_FileOptions_features(msg); |
| 7024 | if (sub == NULL) { |
| 7025 | sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google_protobuf_FeatureSet_msg_init, arena); |
| 7026 | if (sub) google_protobuf_FileOptions_set_features(msg, sub); |
| 7027 | } |
| 7028 | return sub; |
| 7029 | } |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7030 | 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] | 7031 | 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] | 7032 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 7033 | if (arr) { |
| 7034 | if (size) *size = arr->size; |
| 7035 | return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr); |
| 7036 | } else { |
| 7037 | if (size) *size = 0; |
| 7038 | return NULL; |
| 7039 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7040 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 7041 | 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] | 7042 | 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] | 7043 | return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7044 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7045 | 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] | 7046 | 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] | 7047 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 7048 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 7049 | return NULL; |
| 7050 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7051 | 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] | 7052 | if (!arr || !sub) return NULL; |
| 7053 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7054 | return sub; |
| 7055 | } |
| 7056 | |
| 7057 | /* google.protobuf.MessageOptions */ |
| 7058 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7059 | UPB_INLINE google_protobuf_MessageOptions* google_protobuf_MessageOptions_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7060 | 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] | 7061 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7062 | UPB_INLINE google_protobuf_MessageOptions* google_protobuf_MessageOptions_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 7063 | google_protobuf_MessageOptions* ret = google_protobuf_MessageOptions_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 7064 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7065 | 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] | 7066 | return NULL; |
| 7067 | } |
| 7068 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7069 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7070 | UPB_INLINE google_protobuf_MessageOptions* google_protobuf_MessageOptions_parse_ex(const char* buf, size_t size, |
| 7071 | const upb_ExtensionRegistry* extreg, |
| 7072 | int options, upb_Arena* arena) { |
| 7073 | google_protobuf_MessageOptions* ret = google_protobuf_MessageOptions_new(arena); |
| 7074 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7075 | 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] | 7076 | kUpb_DecodeStatus_Ok) { |
| 7077 | return NULL; |
| 7078 | } |
| 7079 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7080 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7081 | 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] | 7082 | char* ptr; |
| 7083 | (void)upb_Encode(msg, &google_protobuf_MessageOptions_msg_init, 0, arena, &ptr, len); |
| 7084 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7085 | } |
| 7086 | UPB_INLINE char* google_protobuf_MessageOptions_serialize_ex(const google_protobuf_MessageOptions* msg, int options, |
| 7087 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7088 | char* ptr; |
| 7089 | (void)upb_Encode(msg, &google_protobuf_MessageOptions_msg_init, options, arena, &ptr, len); |
| 7090 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7091 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7092 | 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] | 7093 | 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] | 7094 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7095 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7096 | 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] | 7097 | bool default_val = false; |
| 7098 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7099 | 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] | 7100 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7101 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7102 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7103 | 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] | 7104 | 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] | 7105 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7106 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7107 | 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] | 7108 | 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] | 7109 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7110 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7111 | 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] | 7112 | bool default_val = false; |
| 7113 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7114 | 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] | 7115 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7116 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7117 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7118 | 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] | 7119 | 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] | 7120 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7121 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7122 | UPB_INLINE void google_protobuf_MessageOptions_clear_deprecated(google_protobuf_MessageOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7123 | 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] | 7124 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7125 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7126 | UPB_INLINE bool google_protobuf_MessageOptions_deprecated(const google_protobuf_MessageOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7127 | bool default_val = false; |
| 7128 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7129 | 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] | 7130 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7131 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7132 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7133 | 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] | 7134 | 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] | 7135 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7136 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7137 | 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] | 7138 | 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] | 7139 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7140 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7141 | 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] | 7142 | bool default_val = false; |
| 7143 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7144 | 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] | 7145 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7146 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7147 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7148 | 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] | 7149 | 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] | 7150 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7151 | } |
Mike Kruskal | 6b87d6f | 2022-12-14 10:36:53 -0800 | [diff] [blame] | 7152 | 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] | 7153 | 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] | 7154 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 7155 | } |
| 7156 | UPB_INLINE bool google_protobuf_MessageOptions_deprecated_legacy_json_field_conflicts(const google_protobuf_MessageOptions* msg) { |
| 7157 | bool default_val = false; |
| 7158 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7159 | 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] | 7160 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 7161 | return ret; |
| 7162 | } |
| 7163 | 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] | 7164 | 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] | 7165 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 7166 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7167 | UPB_INLINE void google_protobuf_MessageOptions_clear_features(google_protobuf_MessageOptions* msg) { |
| 7168 | 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)}; |
| 7169 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 7170 | } |
| 7171 | UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_MessageOptions_features(const google_protobuf_MessageOptions* msg) { |
| 7172 | const google_protobuf_FeatureSet* default_val = NULL; |
| 7173 | const google_protobuf_FeatureSet* ret; |
| 7174 | 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)}; |
| 7175 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 7176 | return ret; |
| 7177 | } |
| 7178 | UPB_INLINE bool google_protobuf_MessageOptions_has_features(const google_protobuf_MessageOptions* msg) { |
| 7179 | 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)}; |
| 7180 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 7181 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7182 | 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] | 7183 | 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] | 7184 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7185 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 7186 | 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] | 7187 | 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] | 7188 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 7189 | if (arr) { |
| 7190 | if (size) *size = arr->size; |
| 7191 | return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr); |
| 7192 | } else { |
| 7193 | if (size) *size = 0; |
| 7194 | return NULL; |
| 7195 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7196 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 7197 | 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] | 7198 | 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] | 7199 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 7200 | if (size) { |
| 7201 | *size = arr ? arr->size : 0; |
| 7202 | } |
| 7203 | return arr; |
| 7204 | } |
| 7205 | 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] | 7206 | 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] | 7207 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 7208 | (upb_Message*)msg, &field, arena); |
| 7209 | if (size) { |
| 7210 | *size = arr ? arr->size : 0; |
| 7211 | } |
| 7212 | return arr; |
| 7213 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7214 | UPB_INLINE bool google_protobuf_MessageOptions_has_uninterpreted_option(const google_protobuf_MessageOptions* msg) { |
| 7215 | size_t size; |
| 7216 | google_protobuf_MessageOptions_uninterpreted_option(msg, &size); |
| 7217 | return size != 0; |
| 7218 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7219 | |
| 7220 | 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] | 7221 | 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] | 7222 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7223 | } |
| 7224 | 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] | 7225 | 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] | 7226 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7227 | } |
| 7228 | 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] | 7229 | 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] | 7230 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7231 | } |
| 7232 | 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] | 7233 | 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] | 7234 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7235 | } |
| 7236 | 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] | 7237 | 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] | 7238 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7239 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7240 | UPB_INLINE void google_protobuf_MessageOptions_set_features(google_protobuf_MessageOptions *msg, google_protobuf_FeatureSet* value) { |
| 7241 | 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)}; |
| 7242 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 7243 | } |
| 7244 | UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_MessageOptions_mutable_features(google_protobuf_MessageOptions* msg, upb_Arena* arena) { |
| 7245 | struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_MessageOptions_features(msg); |
| 7246 | if (sub == NULL) { |
| 7247 | sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google_protobuf_FeatureSet_msg_init, arena); |
| 7248 | if (sub) google_protobuf_MessageOptions_set_features(msg, sub); |
| 7249 | } |
| 7250 | return sub; |
| 7251 | } |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7252 | 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] | 7253 | 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] | 7254 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 7255 | if (arr) { |
| 7256 | if (size) *size = arr->size; |
| 7257 | return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr); |
| 7258 | } else { |
| 7259 | if (size) *size = 0; |
| 7260 | return NULL; |
| 7261 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7262 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 7263 | 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] | 7264 | 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] | 7265 | return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7266 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7267 | 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] | 7268 | 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] | 7269 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 7270 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 7271 | return NULL; |
| 7272 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7273 | 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] | 7274 | if (!arr || !sub) return NULL; |
| 7275 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7276 | return sub; |
| 7277 | } |
| 7278 | |
| 7279 | /* google.protobuf.FieldOptions */ |
| 7280 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7281 | UPB_INLINE google_protobuf_FieldOptions* google_protobuf_FieldOptions_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7282 | 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] | 7283 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7284 | UPB_INLINE google_protobuf_FieldOptions* google_protobuf_FieldOptions_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 7285 | google_protobuf_FieldOptions* ret = google_protobuf_FieldOptions_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 7286 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7287 | 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] | 7288 | return NULL; |
| 7289 | } |
| 7290 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7291 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7292 | UPB_INLINE google_protobuf_FieldOptions* google_protobuf_FieldOptions_parse_ex(const char* buf, size_t size, |
| 7293 | const upb_ExtensionRegistry* extreg, |
| 7294 | int options, upb_Arena* arena) { |
| 7295 | google_protobuf_FieldOptions* ret = google_protobuf_FieldOptions_new(arena); |
| 7296 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7297 | 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] | 7298 | kUpb_DecodeStatus_Ok) { |
| 7299 | return NULL; |
| 7300 | } |
| 7301 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7302 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7303 | 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] | 7304 | char* ptr; |
| 7305 | (void)upb_Encode(msg, &google_protobuf_FieldOptions_msg_init, 0, arena, &ptr, len); |
| 7306 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7307 | } |
| 7308 | UPB_INLINE char* google_protobuf_FieldOptions_serialize_ex(const google_protobuf_FieldOptions* msg, int options, |
| 7309 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7310 | char* ptr; |
| 7311 | (void)upb_Encode(msg, &google_protobuf_FieldOptions_msg_init, options, arena, &ptr, len); |
| 7312 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7313 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7314 | UPB_INLINE void google_protobuf_FieldOptions_clear_ctype(google_protobuf_FieldOptions* msg) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7315 | 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] | 7316 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7317 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7318 | 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] | 7319 | int32_t default_val = 0; |
| 7320 | int32_t ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7321 | 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] | 7322 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7323 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7324 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7325 | 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] | 7326 | 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] | 7327 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7328 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7329 | UPB_INLINE void google_protobuf_FieldOptions_clear_packed(google_protobuf_FieldOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7330 | 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] | 7331 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7332 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7333 | UPB_INLINE bool google_protobuf_FieldOptions_packed(const google_protobuf_FieldOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7334 | bool default_val = false; |
| 7335 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7336 | 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] | 7337 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7338 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7339 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7340 | 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] | 7341 | 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] | 7342 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7343 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7344 | UPB_INLINE void google_protobuf_FieldOptions_clear_deprecated(google_protobuf_FieldOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7345 | 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] | 7346 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7347 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7348 | UPB_INLINE bool google_protobuf_FieldOptions_deprecated(const google_protobuf_FieldOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7349 | bool default_val = false; |
| 7350 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7351 | 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] | 7352 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7353 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7354 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7355 | 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] | 7356 | 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] | 7357 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7358 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7359 | UPB_INLINE void google_protobuf_FieldOptions_clear_lazy(google_protobuf_FieldOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7360 | 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] | 7361 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7362 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7363 | UPB_INLINE bool google_protobuf_FieldOptions_lazy(const google_protobuf_FieldOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7364 | bool default_val = false; |
| 7365 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7366 | 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] | 7367 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7368 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7369 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7370 | 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] | 7371 | 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] | 7372 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7373 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7374 | UPB_INLINE void google_protobuf_FieldOptions_clear_jstype(google_protobuf_FieldOptions* msg) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7375 | 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] | 7376 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7377 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7378 | 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] | 7379 | int32_t default_val = 0; |
| 7380 | int32_t ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7381 | 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] | 7382 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7383 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7384 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7385 | 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] | 7386 | 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] | 7387 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7388 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7389 | UPB_INLINE void google_protobuf_FieldOptions_clear_weak(google_protobuf_FieldOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7390 | 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] | 7391 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7392 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7393 | UPB_INLINE bool google_protobuf_FieldOptions_weak(const google_protobuf_FieldOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7394 | bool default_val = false; |
| 7395 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7396 | 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] | 7397 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7398 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7399 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7400 | 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] | 7401 | 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] | 7402 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7403 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7404 | 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] | 7405 | 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] | 7406 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7407 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7408 | 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] | 7409 | bool default_val = false; |
| 7410 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7411 | 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] | 7412 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7413 | return ret; |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7414 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7415 | 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] | 7416 | 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] | 7417 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7418 | } |
Protobuf Team Bot | 9238c48 | 2022-12-16 20:01:55 -0800 | [diff] [blame] | 7419 | 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] | 7420 | 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] | 7421 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 7422 | } |
| 7423 | UPB_INLINE bool google_protobuf_FieldOptions_debug_redact(const google_protobuf_FieldOptions* msg) { |
| 7424 | bool default_val = false; |
| 7425 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7426 | 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] | 7427 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 7428 | return ret; |
| 7429 | } |
| 7430 | 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] | 7431 | 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] | 7432 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 7433 | } |
Adam Cozzette | 5a56837 | 2023-01-24 20:35:59 -0800 | [diff] [blame] | 7434 | UPB_INLINE void google_protobuf_FieldOptions_clear_retention(google_protobuf_FieldOptions* msg) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7435 | 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] | 7436 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 7437 | } |
| 7438 | UPB_INLINE int32_t google_protobuf_FieldOptions_retention(const google_protobuf_FieldOptions* msg) { |
| 7439 | int32_t default_val = 0; |
| 7440 | int32_t ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7441 | 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] | 7442 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 7443 | return ret; |
| 7444 | } |
| 7445 | 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] | 7446 | 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] | 7447 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 7448 | } |
Adam Cozzette | 88b5b19 | 2023-05-03 15:36:48 -0700 | [diff] [blame] | 7449 | UPB_INLINE void google_protobuf_FieldOptions_clear_target_obsolete_do_not_use(google_protobuf_FieldOptions* msg) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7450 | const upb_MiniTableField field = {18, 24, 10, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | d480470 | 2023-03-20 15:08:40 -0700 | [diff] [blame] | 7451 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 7452 | } |
Adam Cozzette | 88b5b19 | 2023-05-03 15:36:48 -0700 | [diff] [blame] | 7453 | UPB_INLINE int32_t google_protobuf_FieldOptions_target_obsolete_do_not_use(const google_protobuf_FieldOptions* msg) { |
Mike Kruskal | d480470 | 2023-03-20 15:08:40 -0700 | [diff] [blame] | 7454 | int32_t default_val = 0; |
| 7455 | int32_t ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7456 | const upb_MiniTableField field = {18, 24, 10, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | d480470 | 2023-03-20 15:08:40 -0700 | [diff] [blame] | 7457 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 7458 | return ret; |
| 7459 | } |
Adam Cozzette | 88b5b19 | 2023-05-03 15:36:48 -0700 | [diff] [blame] | 7460 | UPB_INLINE bool google_protobuf_FieldOptions_has_target_obsolete_do_not_use(const google_protobuf_FieldOptions* msg) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7461 | const upb_MiniTableField field = {18, 24, 10, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | d480470 | 2023-03-20 15:08:40 -0700 | [diff] [blame] | 7462 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 7463 | } |
Mike Kruskal | 0c12139 | 2023-03-18 00:05:41 -0700 | [diff] [blame] | 7464 | UPB_INLINE void google_protobuf_FieldOptions_clear_targets(google_protobuf_FieldOptions* msg) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7465 | const upb_MiniTableField field = {19, UPB_SIZE(28, 32), 0, 7, 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] | 7466 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 7467 | } |
Mike Kruskal | 0c12139 | 2023-03-18 00:05:41 -0700 | [diff] [blame] | 7468 | UPB_INLINE int32_t const* google_protobuf_FieldOptions_targets(const google_protobuf_FieldOptions* msg, size_t* size) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7469 | const upb_MiniTableField field = {19, UPB_SIZE(28, 32), 0, 7, 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] | 7470 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 7471 | if (arr) { |
| 7472 | if (size) *size = arr->size; |
| 7473 | return (int32_t const*)_upb_array_constptr(arr); |
| 7474 | } else { |
| 7475 | if (size) *size = 0; |
| 7476 | return NULL; |
| 7477 | } |
Adam Cozzette | 5a56837 | 2023-01-24 20:35:59 -0800 | [diff] [blame] | 7478 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 7479 | UPB_INLINE const upb_Array* _google_protobuf_FieldOptions_targets_upb_array(const google_protobuf_FieldOptions* msg, size_t* size) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7480 | const upb_MiniTableField field = {19, UPB_SIZE(28, 32), 0, 7, 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] | 7481 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 7482 | if (size) { |
| 7483 | *size = arr ? arr->size : 0; |
| 7484 | } |
| 7485 | return arr; |
| 7486 | } |
| 7487 | UPB_INLINE upb_Array* _google_protobuf_FieldOptions_targets_mutable_upb_array(const google_protobuf_FieldOptions* msg, size_t* size, upb_Arena* arena) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7488 | const upb_MiniTableField field = {19, UPB_SIZE(28, 32), 0, 7, 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] | 7489 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 7490 | (upb_Message*)msg, &field, arena); |
| 7491 | if (size) { |
| 7492 | *size = arr ? arr->size : 0; |
| 7493 | } |
| 7494 | return arr; |
| 7495 | } |
Mike Kruskal | 0c12139 | 2023-03-18 00:05:41 -0700 | [diff] [blame] | 7496 | UPB_INLINE bool google_protobuf_FieldOptions_has_targets(const google_protobuf_FieldOptions* msg) { |
| 7497 | size_t size; |
| 7498 | google_protobuf_FieldOptions_targets(msg, &size); |
| 7499 | return size != 0; |
Adam Cozzette | 5a56837 | 2023-01-24 20:35:59 -0800 | [diff] [blame] | 7500 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7501 | UPB_INLINE void google_protobuf_FieldOptions_clear_edition_defaults(google_protobuf_FieldOptions* msg) { |
| 7502 | const upb_MiniTableField field = {20, UPB_SIZE(32, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
| 7503 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 7504 | } |
| 7505 | UPB_INLINE const google_protobuf_FieldOptions_EditionDefault* const* google_protobuf_FieldOptions_edition_defaults(const google_protobuf_FieldOptions* msg, size_t* size) { |
| 7506 | const upb_MiniTableField field = {20, UPB_SIZE(32, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
| 7507 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 7508 | if (arr) { |
| 7509 | if (size) *size = arr->size; |
| 7510 | return (const google_protobuf_FieldOptions_EditionDefault* const*)_upb_array_constptr(arr); |
| 7511 | } else { |
| 7512 | if (size) *size = 0; |
| 7513 | return NULL; |
| 7514 | } |
| 7515 | } |
| 7516 | UPB_INLINE const upb_Array* _google_protobuf_FieldOptions_edition_defaults_upb_array(const google_protobuf_FieldOptions* msg, size_t* size) { |
| 7517 | const upb_MiniTableField field = {20, UPB_SIZE(32, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
| 7518 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 7519 | if (size) { |
| 7520 | *size = arr ? arr->size : 0; |
| 7521 | } |
| 7522 | return arr; |
| 7523 | } |
| 7524 | UPB_INLINE upb_Array* _google_protobuf_FieldOptions_edition_defaults_mutable_upb_array(const google_protobuf_FieldOptions* msg, size_t* size, upb_Arena* arena) { |
| 7525 | const upb_MiniTableField field = {20, UPB_SIZE(32, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
| 7526 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 7527 | (upb_Message*)msg, &field, arena); |
| 7528 | if (size) { |
| 7529 | *size = arr ? arr->size : 0; |
| 7530 | } |
| 7531 | return arr; |
| 7532 | } |
| 7533 | UPB_INLINE bool google_protobuf_FieldOptions_has_edition_defaults(const google_protobuf_FieldOptions* msg) { |
| 7534 | size_t size; |
| 7535 | google_protobuf_FieldOptions_edition_defaults(msg, &size); |
| 7536 | return size != 0; |
| 7537 | } |
| 7538 | UPB_INLINE void google_protobuf_FieldOptions_clear_features(google_protobuf_FieldOptions* msg) { |
| 7539 | const upb_MiniTableField field = {21, UPB_SIZE(36, 48), 11, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
| 7540 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 7541 | } |
| 7542 | UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_FieldOptions_features(const google_protobuf_FieldOptions* msg) { |
| 7543 | const google_protobuf_FeatureSet* default_val = NULL; |
| 7544 | const google_protobuf_FeatureSet* ret; |
| 7545 | const upb_MiniTableField field = {21, UPB_SIZE(36, 48), 11, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
| 7546 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 7547 | return ret; |
| 7548 | } |
| 7549 | UPB_INLINE bool google_protobuf_FieldOptions_has_features(const google_protobuf_FieldOptions* msg) { |
| 7550 | const upb_MiniTableField field = {21, UPB_SIZE(36, 48), 11, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
| 7551 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 7552 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7553 | UPB_INLINE void google_protobuf_FieldOptions_clear_uninterpreted_option(google_protobuf_FieldOptions* msg) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7554 | const upb_MiniTableField field = {999, UPB_SIZE(40, 56), 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] | 7555 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7556 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 7557 | UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_FieldOptions_uninterpreted_option(const google_protobuf_FieldOptions* msg, size_t* size) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7558 | const upb_MiniTableField field = {999, UPB_SIZE(40, 56), 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] | 7559 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 7560 | if (arr) { |
| 7561 | if (size) *size = arr->size; |
| 7562 | return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr); |
| 7563 | } else { |
| 7564 | if (size) *size = 0; |
| 7565 | return NULL; |
| 7566 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7567 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 7568 | UPB_INLINE const upb_Array* _google_protobuf_FieldOptions_uninterpreted_option_upb_array(const google_protobuf_FieldOptions* msg, size_t* size) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7569 | const upb_MiniTableField field = {999, UPB_SIZE(40, 56), 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] | 7570 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 7571 | if (size) { |
| 7572 | *size = arr ? arr->size : 0; |
| 7573 | } |
| 7574 | return arr; |
| 7575 | } |
| 7576 | UPB_INLINE upb_Array* _google_protobuf_FieldOptions_uninterpreted_option_mutable_upb_array(const google_protobuf_FieldOptions* msg, size_t* size, upb_Arena* arena) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7577 | const upb_MiniTableField field = {999, UPB_SIZE(40, 56), 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] | 7578 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 7579 | (upb_Message*)msg, &field, arena); |
| 7580 | if (size) { |
| 7581 | *size = arr ? arr->size : 0; |
| 7582 | } |
| 7583 | return arr; |
| 7584 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7585 | UPB_INLINE bool google_protobuf_FieldOptions_has_uninterpreted_option(const google_protobuf_FieldOptions* msg) { |
| 7586 | size_t size; |
| 7587 | google_protobuf_FieldOptions_uninterpreted_option(msg, &size); |
| 7588 | return size != 0; |
| 7589 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7590 | |
| 7591 | 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] | 7592 | 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] | 7593 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7594 | } |
| 7595 | 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] | 7596 | 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] | 7597 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7598 | } |
| 7599 | 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] | 7600 | 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] | 7601 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7602 | } |
| 7603 | 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] | 7604 | 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] | 7605 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7606 | } |
| 7607 | 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] | 7608 | 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] | 7609 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7610 | } |
| 7611 | 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] | 7612 | 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] | 7613 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7614 | } |
| 7615 | 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] | 7616 | 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] | 7617 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7618 | } |
| 7619 | 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] | 7620 | 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] | 7621 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7622 | } |
Adam Cozzette | 5a56837 | 2023-01-24 20:35:59 -0800 | [diff] [blame] | 7623 | 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] | 7624 | 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] | 7625 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 7626 | } |
Adam Cozzette | 88b5b19 | 2023-05-03 15:36:48 -0700 | [diff] [blame] | 7627 | UPB_INLINE void google_protobuf_FieldOptions_set_target_obsolete_do_not_use(google_protobuf_FieldOptions *msg, int32_t value) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7628 | const upb_MiniTableField field = {18, 24, 10, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
Mike Kruskal | d480470 | 2023-03-20 15:08:40 -0700 | [diff] [blame] | 7629 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 7630 | } |
Mike Kruskal | 0c12139 | 2023-03-18 00:05:41 -0700 | [diff] [blame] | 7631 | UPB_INLINE int32_t* google_protobuf_FieldOptions_mutable_targets(google_protobuf_FieldOptions* msg, size_t* size) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7632 | upb_MiniTableField field = {19, UPB_SIZE(28, 32), 0, 7, 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] | 7633 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 7634 | if (arr) { |
| 7635 | if (size) *size = arr->size; |
| 7636 | return (int32_t*)_upb_array_ptr(arr); |
| 7637 | } else { |
| 7638 | if (size) *size = 0; |
| 7639 | return NULL; |
| 7640 | } |
| 7641 | } |
| 7642 | UPB_INLINE int32_t* google_protobuf_FieldOptions_resize_targets(google_protobuf_FieldOptions* msg, size_t size, upb_Arena* arena) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7643 | upb_MiniTableField field = {19, UPB_SIZE(28, 32), 0, 7, 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] | 7644 | return (int32_t*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Mike Kruskal | 0c12139 | 2023-03-18 00:05:41 -0700 | [diff] [blame] | 7645 | } |
| 7646 | UPB_INLINE bool google_protobuf_FieldOptions_add_targets(google_protobuf_FieldOptions* msg, int32_t val, upb_Arena* arena) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7647 | upb_MiniTableField field = {19, UPB_SIZE(28, 32), 0, 7, 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] | 7648 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 7649 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 7650 | return false; |
| 7651 | } |
| 7652 | _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val)); |
| 7653 | return true; |
Adam Cozzette | 5a56837 | 2023-01-24 20:35:59 -0800 | [diff] [blame] | 7654 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7655 | UPB_INLINE google_protobuf_FieldOptions_EditionDefault** google_protobuf_FieldOptions_mutable_edition_defaults(google_protobuf_FieldOptions* msg, size_t* size) { |
| 7656 | upb_MiniTableField field = {20, UPB_SIZE(32, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
| 7657 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 7658 | if (arr) { |
| 7659 | if (size) *size = arr->size; |
| 7660 | return (google_protobuf_FieldOptions_EditionDefault**)_upb_array_ptr(arr); |
| 7661 | } else { |
| 7662 | if (size) *size = 0; |
| 7663 | return NULL; |
| 7664 | } |
| 7665 | } |
| 7666 | UPB_INLINE google_protobuf_FieldOptions_EditionDefault** google_protobuf_FieldOptions_resize_edition_defaults(google_protobuf_FieldOptions* msg, size_t size, upb_Arena* arena) { |
| 7667 | upb_MiniTableField field = {20, UPB_SIZE(32, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
| 7668 | return (google_protobuf_FieldOptions_EditionDefault**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
| 7669 | } |
| 7670 | UPB_INLINE struct google_protobuf_FieldOptions_EditionDefault* google_protobuf_FieldOptions_add_edition_defaults(google_protobuf_FieldOptions* msg, upb_Arena* arena) { |
| 7671 | upb_MiniTableField field = {20, UPB_SIZE(32, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
| 7672 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 7673 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 7674 | return NULL; |
| 7675 | } |
| 7676 | struct google_protobuf_FieldOptions_EditionDefault* sub = (struct google_protobuf_FieldOptions_EditionDefault*)_upb_Message_New(&google_protobuf_FieldOptions_EditionDefault_msg_init, arena); |
| 7677 | if (!arr || !sub) return NULL; |
| 7678 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
| 7679 | return sub; |
| 7680 | } |
| 7681 | UPB_INLINE void google_protobuf_FieldOptions_set_features(google_protobuf_FieldOptions *msg, google_protobuf_FeatureSet* value) { |
| 7682 | const upb_MiniTableField field = {21, UPB_SIZE(36, 48), 11, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
| 7683 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 7684 | } |
| 7685 | UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_FieldOptions_mutable_features(google_protobuf_FieldOptions* msg, upb_Arena* arena) { |
| 7686 | struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_FieldOptions_features(msg); |
| 7687 | if (sub == NULL) { |
| 7688 | sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google_protobuf_FeatureSet_msg_init, arena); |
| 7689 | if (sub) google_protobuf_FieldOptions_set_features(msg, sub); |
| 7690 | } |
| 7691 | return sub; |
| 7692 | } |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 7693 | UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FieldOptions_mutable_uninterpreted_option(google_protobuf_FieldOptions* msg, size_t* size) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7694 | upb_MiniTableField field = {999, UPB_SIZE(40, 56), 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] | 7695 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 7696 | if (arr) { |
| 7697 | if (size) *size = arr->size; |
| 7698 | return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr); |
| 7699 | } else { |
| 7700 | if (size) *size = 0; |
| 7701 | return NULL; |
| 7702 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7703 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 7704 | UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FieldOptions_resize_uninterpreted_option(google_protobuf_FieldOptions* msg, size_t size, upb_Arena* arena) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7705 | upb_MiniTableField field = {999, UPB_SIZE(40, 56), 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] | 7706 | return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7707 | } |
| 7708 | UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_FieldOptions_add_uninterpreted_option(google_protobuf_FieldOptions* msg, upb_Arena* arena) { |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7709 | upb_MiniTableField field = {999, UPB_SIZE(40, 56), 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] | 7710 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 7711 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 7712 | return NULL; |
| 7713 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7714 | 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] | 7715 | if (!arr || !sub) return NULL; |
| 7716 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7717 | return sub; |
| 7718 | } |
| 7719 | |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7720 | /* google.protobuf.FieldOptions.EditionDefault */ |
| 7721 | |
| 7722 | UPB_INLINE google_protobuf_FieldOptions_EditionDefault* google_protobuf_FieldOptions_EditionDefault_new(upb_Arena* arena) { |
| 7723 | return (google_protobuf_FieldOptions_EditionDefault*)_upb_Message_New(&google_protobuf_FieldOptions_EditionDefault_msg_init, arena); |
| 7724 | } |
| 7725 | UPB_INLINE google_protobuf_FieldOptions_EditionDefault* google_protobuf_FieldOptions_EditionDefault_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 7726 | google_protobuf_FieldOptions_EditionDefault* ret = google_protobuf_FieldOptions_EditionDefault_new(arena); |
| 7727 | if (!ret) return NULL; |
| 7728 | if (upb_Decode(buf, size, ret, &google_protobuf_FieldOptions_EditionDefault_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { |
| 7729 | return NULL; |
| 7730 | } |
| 7731 | return ret; |
| 7732 | } |
| 7733 | UPB_INLINE google_protobuf_FieldOptions_EditionDefault* google_protobuf_FieldOptions_EditionDefault_parse_ex(const char* buf, size_t size, |
| 7734 | const upb_ExtensionRegistry* extreg, |
| 7735 | int options, upb_Arena* arena) { |
| 7736 | google_protobuf_FieldOptions_EditionDefault* ret = google_protobuf_FieldOptions_EditionDefault_new(arena); |
| 7737 | if (!ret) return NULL; |
| 7738 | if (upb_Decode(buf, size, ret, &google_protobuf_FieldOptions_EditionDefault_msg_init, extreg, options, arena) != |
| 7739 | kUpb_DecodeStatus_Ok) { |
| 7740 | return NULL; |
| 7741 | } |
| 7742 | return ret; |
| 7743 | } |
| 7744 | UPB_INLINE char* google_protobuf_FieldOptions_EditionDefault_serialize(const google_protobuf_FieldOptions_EditionDefault* msg, upb_Arena* arena, size_t* len) { |
| 7745 | char* ptr; |
| 7746 | (void)upb_Encode(msg, &google_protobuf_FieldOptions_EditionDefault_msg_init, 0, arena, &ptr, len); |
| 7747 | return ptr; |
| 7748 | } |
| 7749 | UPB_INLINE char* google_protobuf_FieldOptions_EditionDefault_serialize_ex(const google_protobuf_FieldOptions_EditionDefault* msg, int options, |
| 7750 | upb_Arena* arena, size_t* len) { |
| 7751 | char* ptr; |
| 7752 | (void)upb_Encode(msg, &google_protobuf_FieldOptions_EditionDefault_msg_init, options, arena, &ptr, len); |
| 7753 | return ptr; |
| 7754 | } |
| 7755 | UPB_INLINE void google_protobuf_FieldOptions_EditionDefault_clear_edition(google_protobuf_FieldOptions_EditionDefault* msg) { |
| 7756 | 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)}; |
| 7757 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 7758 | } |
| 7759 | UPB_INLINE upb_StringView google_protobuf_FieldOptions_EditionDefault_edition(const google_protobuf_FieldOptions_EditionDefault* msg) { |
| 7760 | upb_StringView default_val = upb_StringView_FromString(""); |
| 7761 | upb_StringView ret; |
| 7762 | 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)}; |
| 7763 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 7764 | return ret; |
| 7765 | } |
| 7766 | UPB_INLINE bool google_protobuf_FieldOptions_EditionDefault_has_edition(const google_protobuf_FieldOptions_EditionDefault* msg) { |
| 7767 | 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)}; |
| 7768 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 7769 | } |
| 7770 | UPB_INLINE void google_protobuf_FieldOptions_EditionDefault_clear_value(google_protobuf_FieldOptions_EditionDefault* msg) { |
| 7771 | const upb_MiniTableField field = {2, UPB_SIZE(12, 24), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
| 7772 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 7773 | } |
| 7774 | UPB_INLINE upb_StringView google_protobuf_FieldOptions_EditionDefault_value(const google_protobuf_FieldOptions_EditionDefault* msg) { |
| 7775 | upb_StringView default_val = upb_StringView_FromString(""); |
| 7776 | upb_StringView ret; |
| 7777 | const upb_MiniTableField field = {2, UPB_SIZE(12, 24), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
| 7778 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 7779 | return ret; |
| 7780 | } |
| 7781 | UPB_INLINE bool google_protobuf_FieldOptions_EditionDefault_has_value(const google_protobuf_FieldOptions_EditionDefault* msg) { |
| 7782 | const upb_MiniTableField field = {2, UPB_SIZE(12, 24), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
| 7783 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 7784 | } |
| 7785 | |
| 7786 | UPB_INLINE void google_protobuf_FieldOptions_EditionDefault_set_edition(google_protobuf_FieldOptions_EditionDefault *msg, upb_StringView value) { |
| 7787 | 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)}; |
| 7788 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 7789 | } |
| 7790 | UPB_INLINE void google_protobuf_FieldOptions_EditionDefault_set_value(google_protobuf_FieldOptions_EditionDefault *msg, upb_StringView value) { |
| 7791 | const upb_MiniTableField field = {2, UPB_SIZE(12, 24), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
| 7792 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 7793 | } |
| 7794 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7795 | /* google.protobuf.OneofOptions */ |
| 7796 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7797 | UPB_INLINE google_protobuf_OneofOptions* google_protobuf_OneofOptions_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7798 | 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] | 7799 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7800 | UPB_INLINE google_protobuf_OneofOptions* google_protobuf_OneofOptions_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 7801 | google_protobuf_OneofOptions* ret = google_protobuf_OneofOptions_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 7802 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7803 | 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] | 7804 | return NULL; |
| 7805 | } |
| 7806 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7807 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7808 | UPB_INLINE google_protobuf_OneofOptions* google_protobuf_OneofOptions_parse_ex(const char* buf, size_t size, |
| 7809 | const upb_ExtensionRegistry* extreg, |
| 7810 | int options, upb_Arena* arena) { |
| 7811 | google_protobuf_OneofOptions* ret = google_protobuf_OneofOptions_new(arena); |
| 7812 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7813 | 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] | 7814 | kUpb_DecodeStatus_Ok) { |
| 7815 | return NULL; |
| 7816 | } |
| 7817 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7818 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7819 | 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] | 7820 | char* ptr; |
| 7821 | (void)upb_Encode(msg, &google_protobuf_OneofOptions_msg_init, 0, arena, &ptr, len); |
| 7822 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7823 | } |
| 7824 | UPB_INLINE char* google_protobuf_OneofOptions_serialize_ex(const google_protobuf_OneofOptions* msg, int options, |
| 7825 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7826 | char* ptr; |
| 7827 | (void)upb_Encode(msg, &google_protobuf_OneofOptions_msg_init, options, arena, &ptr, len); |
| 7828 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7829 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7830 | UPB_INLINE void google_protobuf_OneofOptions_clear_features(google_protobuf_OneofOptions* msg) { |
| 7831 | 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)}; |
| 7832 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 7833 | } |
| 7834 | UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_OneofOptions_features(const google_protobuf_OneofOptions* msg) { |
| 7835 | const google_protobuf_FeatureSet* default_val = NULL; |
| 7836 | const google_protobuf_FeatureSet* ret; |
| 7837 | 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)}; |
| 7838 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 7839 | return ret; |
| 7840 | } |
| 7841 | UPB_INLINE bool google_protobuf_OneofOptions_has_features(const google_protobuf_OneofOptions* msg) { |
| 7842 | 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)}; |
| 7843 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 7844 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7845 | 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] | 7846 | 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] | 7847 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7848 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 7849 | 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] | 7850 | 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] | 7851 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 7852 | if (arr) { |
| 7853 | if (size) *size = arr->size; |
| 7854 | return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr); |
| 7855 | } else { |
| 7856 | if (size) *size = 0; |
| 7857 | return NULL; |
| 7858 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7859 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 7860 | 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] | 7861 | 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] | 7862 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 7863 | if (size) { |
| 7864 | *size = arr ? arr->size : 0; |
| 7865 | } |
| 7866 | return arr; |
| 7867 | } |
| 7868 | 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] | 7869 | 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] | 7870 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 7871 | (upb_Message*)msg, &field, arena); |
| 7872 | if (size) { |
| 7873 | *size = arr ? arr->size : 0; |
| 7874 | } |
| 7875 | return arr; |
| 7876 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7877 | UPB_INLINE bool google_protobuf_OneofOptions_has_uninterpreted_option(const google_protobuf_OneofOptions* msg) { |
| 7878 | size_t size; |
| 7879 | google_protobuf_OneofOptions_uninterpreted_option(msg, &size); |
| 7880 | return size != 0; |
| 7881 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7882 | |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 7883 | UPB_INLINE void google_protobuf_OneofOptions_set_features(google_protobuf_OneofOptions *msg, google_protobuf_FeatureSet* value) { |
| 7884 | 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)}; |
| 7885 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 7886 | } |
| 7887 | UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_OneofOptions_mutable_features(google_protobuf_OneofOptions* msg, upb_Arena* arena) { |
| 7888 | struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_OneofOptions_features(msg); |
| 7889 | if (sub == NULL) { |
| 7890 | sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google_protobuf_FeatureSet_msg_init, arena); |
| 7891 | if (sub) google_protobuf_OneofOptions_set_features(msg, sub); |
| 7892 | } |
| 7893 | return sub; |
| 7894 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 7895 | 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] | 7896 | 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] | 7897 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 7898 | if (arr) { |
| 7899 | if (size) *size = arr->size; |
| 7900 | return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr); |
| 7901 | } else { |
| 7902 | if (size) *size = 0; |
| 7903 | return NULL; |
| 7904 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7905 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 7906 | 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] | 7907 | 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] | 7908 | return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7909 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7910 | 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] | 7911 | 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] | 7912 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 7913 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 7914 | return NULL; |
| 7915 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7916 | 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] | 7917 | if (!arr || !sub) return NULL; |
| 7918 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7919 | return sub; |
| 7920 | } |
| 7921 | |
| 7922 | /* google.protobuf.EnumOptions */ |
| 7923 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7924 | UPB_INLINE google_protobuf_EnumOptions* google_protobuf_EnumOptions_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7925 | 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] | 7926 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7927 | UPB_INLINE google_protobuf_EnumOptions* google_protobuf_EnumOptions_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 7928 | google_protobuf_EnumOptions* ret = google_protobuf_EnumOptions_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 7929 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7930 | 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] | 7931 | return NULL; |
| 7932 | } |
| 7933 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7934 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7935 | UPB_INLINE google_protobuf_EnumOptions* google_protobuf_EnumOptions_parse_ex(const char* buf, size_t size, |
| 7936 | const upb_ExtensionRegistry* extreg, |
| 7937 | int options, upb_Arena* arena) { |
| 7938 | google_protobuf_EnumOptions* ret = google_protobuf_EnumOptions_new(arena); |
| 7939 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7940 | 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] | 7941 | kUpb_DecodeStatus_Ok) { |
| 7942 | return NULL; |
| 7943 | } |
| 7944 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 7945 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7946 | 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] | 7947 | char* ptr; |
| 7948 | (void)upb_Encode(msg, &google_protobuf_EnumOptions_msg_init, 0, arena, &ptr, len); |
| 7949 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7950 | } |
| 7951 | UPB_INLINE char* google_protobuf_EnumOptions_serialize_ex(const google_protobuf_EnumOptions* msg, int options, |
| 7952 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7953 | char* ptr; |
| 7954 | (void)upb_Encode(msg, &google_protobuf_EnumOptions_msg_init, options, arena, &ptr, len); |
| 7955 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7956 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7957 | 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] | 7958 | 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] | 7959 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7960 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7961 | 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] | 7962 | bool default_val = false; |
| 7963 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7964 | 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] | 7965 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7966 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7967 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7968 | 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] | 7969 | 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] | 7970 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7971 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7972 | UPB_INLINE void google_protobuf_EnumOptions_clear_deprecated(google_protobuf_EnumOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7973 | 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] | 7974 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 7975 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7976 | UPB_INLINE bool google_protobuf_EnumOptions_deprecated(const google_protobuf_EnumOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7977 | bool default_val = false; |
| 7978 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7979 | 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] | 7980 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 7981 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 7982 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 7983 | 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] | 7984 | 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] | 7985 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 7986 | } |
Mike Kruskal | 6b87d6f | 2022-12-14 10:36:53 -0800 | [diff] [blame] | 7987 | 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] | 7988 | 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] | 7989 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 7990 | } |
| 7991 | UPB_INLINE bool google_protobuf_EnumOptions_deprecated_legacy_json_field_conflicts(const google_protobuf_EnumOptions* msg) { |
| 7992 | bool default_val = false; |
| 7993 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 7994 | 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] | 7995 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 7996 | return ret; |
| 7997 | } |
| 7998 | 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] | 7999 | 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] | 8000 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 8001 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8002 | UPB_INLINE void google_protobuf_EnumOptions_clear_features(google_protobuf_EnumOptions* msg) { |
| 8003 | 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)}; |
| 8004 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 8005 | } |
| 8006 | UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_EnumOptions_features(const google_protobuf_EnumOptions* msg) { |
| 8007 | const google_protobuf_FeatureSet* default_val = NULL; |
| 8008 | const google_protobuf_FeatureSet* ret; |
| 8009 | 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)}; |
| 8010 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 8011 | return ret; |
| 8012 | } |
| 8013 | UPB_INLINE bool google_protobuf_EnumOptions_has_features(const google_protobuf_EnumOptions* msg) { |
| 8014 | 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)}; |
| 8015 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 8016 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8017 | 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] | 8018 | 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] | 8019 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8020 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 8021 | 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] | 8022 | 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] | 8023 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 8024 | if (arr) { |
| 8025 | if (size) *size = arr->size; |
| 8026 | return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr); |
| 8027 | } else { |
| 8028 | if (size) *size = 0; |
| 8029 | return NULL; |
| 8030 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8031 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 8032 | 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] | 8033 | 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] | 8034 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 8035 | if (size) { |
| 8036 | *size = arr ? arr->size : 0; |
| 8037 | } |
| 8038 | return arr; |
| 8039 | } |
| 8040 | 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] | 8041 | 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] | 8042 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 8043 | (upb_Message*)msg, &field, arena); |
| 8044 | if (size) { |
| 8045 | *size = arr ? arr->size : 0; |
| 8046 | } |
| 8047 | return arr; |
| 8048 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8049 | UPB_INLINE bool google_protobuf_EnumOptions_has_uninterpreted_option(const google_protobuf_EnumOptions* msg) { |
| 8050 | size_t size; |
| 8051 | google_protobuf_EnumOptions_uninterpreted_option(msg, &size); |
| 8052 | return size != 0; |
| 8053 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8054 | |
| 8055 | 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] | 8056 | 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] | 8057 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8058 | } |
| 8059 | 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] | 8060 | 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] | 8061 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8062 | } |
| 8063 | 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] | 8064 | 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] | 8065 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8066 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8067 | UPB_INLINE void google_protobuf_EnumOptions_set_features(google_protobuf_EnumOptions *msg, google_protobuf_FeatureSet* value) { |
| 8068 | 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)}; |
| 8069 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 8070 | } |
| 8071 | UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_EnumOptions_mutable_features(google_protobuf_EnumOptions* msg, upb_Arena* arena) { |
| 8072 | struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_EnumOptions_features(msg); |
| 8073 | if (sub == NULL) { |
| 8074 | sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google_protobuf_FeatureSet_msg_init, arena); |
| 8075 | if (sub) google_protobuf_EnumOptions_set_features(msg, sub); |
| 8076 | } |
| 8077 | return sub; |
| 8078 | } |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8079 | 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] | 8080 | 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] | 8081 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 8082 | if (arr) { |
| 8083 | if (size) *size = arr->size; |
| 8084 | return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr); |
| 8085 | } else { |
| 8086 | if (size) *size = 0; |
| 8087 | return NULL; |
| 8088 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8089 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 8090 | 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] | 8091 | 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] | 8092 | return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8093 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8094 | 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] | 8095 | 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] | 8096 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 8097 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 8098 | return NULL; |
| 8099 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8100 | 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] | 8101 | if (!arr || !sub) return NULL; |
| 8102 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8103 | return sub; |
| 8104 | } |
| 8105 | |
| 8106 | /* google.protobuf.EnumValueOptions */ |
| 8107 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8108 | UPB_INLINE google_protobuf_EnumValueOptions* google_protobuf_EnumValueOptions_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8109 | 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] | 8110 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8111 | UPB_INLINE google_protobuf_EnumValueOptions* google_protobuf_EnumValueOptions_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 8112 | google_protobuf_EnumValueOptions* ret = google_protobuf_EnumValueOptions_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 8113 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8114 | 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] | 8115 | return NULL; |
| 8116 | } |
| 8117 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8118 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8119 | UPB_INLINE google_protobuf_EnumValueOptions* google_protobuf_EnumValueOptions_parse_ex(const char* buf, size_t size, |
| 8120 | const upb_ExtensionRegistry* extreg, |
| 8121 | int options, upb_Arena* arena) { |
| 8122 | google_protobuf_EnumValueOptions* ret = google_protobuf_EnumValueOptions_new(arena); |
| 8123 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8124 | 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] | 8125 | kUpb_DecodeStatus_Ok) { |
| 8126 | return NULL; |
| 8127 | } |
| 8128 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8129 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8130 | 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] | 8131 | char* ptr; |
| 8132 | (void)upb_Encode(msg, &google_protobuf_EnumValueOptions_msg_init, 0, arena, &ptr, len); |
| 8133 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8134 | } |
| 8135 | UPB_INLINE char* google_protobuf_EnumValueOptions_serialize_ex(const google_protobuf_EnumValueOptions* msg, int options, |
| 8136 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8137 | char* ptr; |
| 8138 | (void)upb_Encode(msg, &google_protobuf_EnumValueOptions_msg_init, options, arena, &ptr, len); |
| 8139 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8140 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8141 | UPB_INLINE void google_protobuf_EnumValueOptions_clear_deprecated(google_protobuf_EnumValueOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8142 | 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] | 8143 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8144 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8145 | UPB_INLINE bool google_protobuf_EnumValueOptions_deprecated(const google_protobuf_EnumValueOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8146 | bool default_val = false; |
| 8147 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8148 | 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] | 8149 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8150 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8151 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8152 | 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] | 8153 | 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] | 8154 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8155 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8156 | UPB_INLINE void google_protobuf_EnumValueOptions_clear_features(google_protobuf_EnumValueOptions* msg) { |
| 8157 | 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)}; |
| 8158 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 8159 | } |
| 8160 | UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_EnumValueOptions_features(const google_protobuf_EnumValueOptions* msg) { |
| 8161 | const google_protobuf_FeatureSet* default_val = NULL; |
| 8162 | const google_protobuf_FeatureSet* ret; |
| 8163 | 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)}; |
| 8164 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 8165 | return ret; |
| 8166 | } |
| 8167 | UPB_INLINE bool google_protobuf_EnumValueOptions_has_features(const google_protobuf_EnumValueOptions* msg) { |
| 8168 | 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)}; |
| 8169 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 8170 | } |
Mike Kruskal | 12e0f1d | 2023-05-31 15:40:54 -0700 | [diff] [blame] | 8171 | 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] | 8172 | 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] | 8173 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 8174 | } |
| 8175 | UPB_INLINE bool google_protobuf_EnumValueOptions_debug_redact(const google_protobuf_EnumValueOptions* msg) { |
| 8176 | bool default_val = false; |
| 8177 | bool ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8178 | 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] | 8179 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 8180 | return ret; |
| 8181 | } |
| 8182 | 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] | 8183 | 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] | 8184 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 8185 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8186 | 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] | 8187 | 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] | 8188 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8189 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 8190 | 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] | 8191 | 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] | 8192 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 8193 | if (arr) { |
| 8194 | if (size) *size = arr->size; |
| 8195 | return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr); |
| 8196 | } else { |
| 8197 | if (size) *size = 0; |
| 8198 | return NULL; |
| 8199 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8200 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 8201 | 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] | 8202 | 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] | 8203 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 8204 | if (size) { |
| 8205 | *size = arr ? arr->size : 0; |
| 8206 | } |
| 8207 | return arr; |
| 8208 | } |
| 8209 | 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] | 8210 | 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] | 8211 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 8212 | (upb_Message*)msg, &field, arena); |
| 8213 | if (size) { |
| 8214 | *size = arr ? arr->size : 0; |
| 8215 | } |
| 8216 | return arr; |
| 8217 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8218 | UPB_INLINE bool google_protobuf_EnumValueOptions_has_uninterpreted_option(const google_protobuf_EnumValueOptions* msg) { |
| 8219 | size_t size; |
| 8220 | google_protobuf_EnumValueOptions_uninterpreted_option(msg, &size); |
| 8221 | return size != 0; |
| 8222 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8223 | |
| 8224 | 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] | 8225 | 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] | 8226 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8227 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8228 | UPB_INLINE void google_protobuf_EnumValueOptions_set_features(google_protobuf_EnumValueOptions *msg, google_protobuf_FeatureSet* value) { |
| 8229 | 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)}; |
| 8230 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 8231 | } |
| 8232 | UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_EnumValueOptions_mutable_features(google_protobuf_EnumValueOptions* msg, upb_Arena* arena) { |
| 8233 | struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_EnumValueOptions_features(msg); |
| 8234 | if (sub == NULL) { |
| 8235 | sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google_protobuf_FeatureSet_msg_init, arena); |
| 8236 | if (sub) google_protobuf_EnumValueOptions_set_features(msg, sub); |
| 8237 | } |
| 8238 | return sub; |
| 8239 | } |
Mike Kruskal | 12e0f1d | 2023-05-31 15:40:54 -0700 | [diff] [blame] | 8240 | 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] | 8241 | 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] | 8242 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 8243 | } |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8244 | 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] | 8245 | 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] | 8246 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 8247 | if (arr) { |
| 8248 | if (size) *size = arr->size; |
| 8249 | return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr); |
| 8250 | } else { |
| 8251 | if (size) *size = 0; |
| 8252 | return NULL; |
| 8253 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8254 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 8255 | 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] | 8256 | 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] | 8257 | return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8258 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8259 | 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] | 8260 | 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] | 8261 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 8262 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 8263 | return NULL; |
| 8264 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8265 | 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] | 8266 | if (!arr || !sub) return NULL; |
| 8267 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8268 | return sub; |
| 8269 | } |
| 8270 | |
| 8271 | /* google.protobuf.ServiceOptions */ |
| 8272 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8273 | UPB_INLINE google_protobuf_ServiceOptions* google_protobuf_ServiceOptions_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8274 | 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] | 8275 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8276 | UPB_INLINE google_protobuf_ServiceOptions* google_protobuf_ServiceOptions_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 8277 | google_protobuf_ServiceOptions* ret = google_protobuf_ServiceOptions_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 8278 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8279 | 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] | 8280 | return NULL; |
| 8281 | } |
| 8282 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8283 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8284 | UPB_INLINE google_protobuf_ServiceOptions* google_protobuf_ServiceOptions_parse_ex(const char* buf, size_t size, |
| 8285 | const upb_ExtensionRegistry* extreg, |
| 8286 | int options, upb_Arena* arena) { |
| 8287 | google_protobuf_ServiceOptions* ret = google_protobuf_ServiceOptions_new(arena); |
| 8288 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8289 | 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] | 8290 | kUpb_DecodeStatus_Ok) { |
| 8291 | return NULL; |
| 8292 | } |
| 8293 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8294 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8295 | 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] | 8296 | char* ptr; |
| 8297 | (void)upb_Encode(msg, &google_protobuf_ServiceOptions_msg_init, 0, arena, &ptr, len); |
| 8298 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8299 | } |
| 8300 | UPB_INLINE char* google_protobuf_ServiceOptions_serialize_ex(const google_protobuf_ServiceOptions* msg, int options, |
| 8301 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8302 | char* ptr; |
| 8303 | (void)upb_Encode(msg, &google_protobuf_ServiceOptions_msg_init, options, arena, &ptr, len); |
| 8304 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8305 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8306 | UPB_INLINE void google_protobuf_ServiceOptions_clear_deprecated(google_protobuf_ServiceOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8307 | 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] | 8308 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8309 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8310 | UPB_INLINE bool google_protobuf_ServiceOptions_deprecated(const google_protobuf_ServiceOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8311 | bool default_val = false; |
| 8312 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8313 | 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] | 8314 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8315 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8316 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8317 | 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] | 8318 | 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] | 8319 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8320 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8321 | UPB_INLINE void google_protobuf_ServiceOptions_clear_features(google_protobuf_ServiceOptions* msg) { |
| 8322 | 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)}; |
| 8323 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 8324 | } |
| 8325 | UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_ServiceOptions_features(const google_protobuf_ServiceOptions* msg) { |
| 8326 | const google_protobuf_FeatureSet* default_val = NULL; |
| 8327 | const google_protobuf_FeatureSet* ret; |
| 8328 | 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)}; |
| 8329 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 8330 | return ret; |
| 8331 | } |
| 8332 | UPB_INLINE bool google_protobuf_ServiceOptions_has_features(const google_protobuf_ServiceOptions* msg) { |
| 8333 | 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)}; |
| 8334 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 8335 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8336 | 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] | 8337 | 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] | 8338 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8339 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 8340 | 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] | 8341 | 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] | 8342 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 8343 | if (arr) { |
| 8344 | if (size) *size = arr->size; |
| 8345 | return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr); |
| 8346 | } else { |
| 8347 | if (size) *size = 0; |
| 8348 | return NULL; |
| 8349 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8350 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 8351 | 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] | 8352 | 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] | 8353 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 8354 | if (size) { |
| 8355 | *size = arr ? arr->size : 0; |
| 8356 | } |
| 8357 | return arr; |
| 8358 | } |
| 8359 | 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] | 8360 | 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] | 8361 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 8362 | (upb_Message*)msg, &field, arena); |
| 8363 | if (size) { |
| 8364 | *size = arr ? arr->size : 0; |
| 8365 | } |
| 8366 | return arr; |
| 8367 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8368 | UPB_INLINE bool google_protobuf_ServiceOptions_has_uninterpreted_option(const google_protobuf_ServiceOptions* msg) { |
| 8369 | size_t size; |
| 8370 | google_protobuf_ServiceOptions_uninterpreted_option(msg, &size); |
| 8371 | return size != 0; |
| 8372 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8373 | |
| 8374 | 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] | 8375 | 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] | 8376 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8377 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8378 | UPB_INLINE void google_protobuf_ServiceOptions_set_features(google_protobuf_ServiceOptions *msg, google_protobuf_FeatureSet* value) { |
| 8379 | 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)}; |
| 8380 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 8381 | } |
| 8382 | UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_ServiceOptions_mutable_features(google_protobuf_ServiceOptions* msg, upb_Arena* arena) { |
| 8383 | struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_ServiceOptions_features(msg); |
| 8384 | if (sub == NULL) { |
| 8385 | sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google_protobuf_FeatureSet_msg_init, arena); |
| 8386 | if (sub) google_protobuf_ServiceOptions_set_features(msg, sub); |
| 8387 | } |
| 8388 | return sub; |
| 8389 | } |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8390 | 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] | 8391 | 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] | 8392 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 8393 | if (arr) { |
| 8394 | if (size) *size = arr->size; |
| 8395 | return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr); |
| 8396 | } else { |
| 8397 | if (size) *size = 0; |
| 8398 | return NULL; |
| 8399 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8400 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 8401 | 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] | 8402 | 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] | 8403 | return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8404 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8405 | 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] | 8406 | 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] | 8407 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 8408 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 8409 | return NULL; |
| 8410 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8411 | 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] | 8412 | if (!arr || !sub) return NULL; |
| 8413 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8414 | return sub; |
| 8415 | } |
| 8416 | |
| 8417 | /* google.protobuf.MethodOptions */ |
| 8418 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8419 | UPB_INLINE google_protobuf_MethodOptions* google_protobuf_MethodOptions_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8420 | 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] | 8421 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8422 | UPB_INLINE google_protobuf_MethodOptions* google_protobuf_MethodOptions_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 8423 | google_protobuf_MethodOptions* ret = google_protobuf_MethodOptions_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 8424 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8425 | 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] | 8426 | return NULL; |
| 8427 | } |
| 8428 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8429 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8430 | UPB_INLINE google_protobuf_MethodOptions* google_protobuf_MethodOptions_parse_ex(const char* buf, size_t size, |
| 8431 | const upb_ExtensionRegistry* extreg, |
| 8432 | int options, upb_Arena* arena) { |
| 8433 | google_protobuf_MethodOptions* ret = google_protobuf_MethodOptions_new(arena); |
| 8434 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8435 | 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] | 8436 | kUpb_DecodeStatus_Ok) { |
| 8437 | return NULL; |
| 8438 | } |
| 8439 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8440 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8441 | 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] | 8442 | char* ptr; |
| 8443 | (void)upb_Encode(msg, &google_protobuf_MethodOptions_msg_init, 0, arena, &ptr, len); |
| 8444 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8445 | } |
| 8446 | UPB_INLINE char* google_protobuf_MethodOptions_serialize_ex(const google_protobuf_MethodOptions* msg, int options, |
| 8447 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8448 | char* ptr; |
| 8449 | (void)upb_Encode(msg, &google_protobuf_MethodOptions_msg_init, options, arena, &ptr, len); |
| 8450 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8451 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8452 | UPB_INLINE void google_protobuf_MethodOptions_clear_deprecated(google_protobuf_MethodOptions* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8453 | 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] | 8454 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8455 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8456 | UPB_INLINE bool google_protobuf_MethodOptions_deprecated(const google_protobuf_MethodOptions* msg) { |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8457 | bool default_val = false; |
| 8458 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8459 | 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] | 8460 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8461 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8462 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8463 | 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] | 8464 | 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] | 8465 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8466 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8467 | 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] | 8468 | 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] | 8469 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8470 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8471 | 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] | 8472 | int32_t default_val = 0; |
| 8473 | int32_t ret; |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8474 | 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] | 8475 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8476 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8477 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8478 | 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] | 8479 | const upb_MiniTableField field = {34, 4, 2, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
| 8480 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 8481 | } |
| 8482 | UPB_INLINE void google_protobuf_MethodOptions_clear_features(google_protobuf_MethodOptions* msg) { |
| 8483 | 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)}; |
| 8484 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 8485 | } |
| 8486 | UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_MethodOptions_features(const google_protobuf_MethodOptions* msg) { |
| 8487 | const google_protobuf_FeatureSet* default_val = NULL; |
| 8488 | const google_protobuf_FeatureSet* ret; |
| 8489 | 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)}; |
| 8490 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 8491 | return ret; |
| 8492 | } |
| 8493 | UPB_INLINE bool google_protobuf_MethodOptions_has_features(const google_protobuf_MethodOptions* msg) { |
| 8494 | 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] | 8495 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8496 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8497 | 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] | 8498 | 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] | 8499 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8500 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 8501 | 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] | 8502 | 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] | 8503 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 8504 | if (arr) { |
| 8505 | if (size) *size = arr->size; |
| 8506 | return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr); |
| 8507 | } else { |
| 8508 | if (size) *size = 0; |
| 8509 | return NULL; |
| 8510 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8511 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 8512 | 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] | 8513 | 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] | 8514 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 8515 | if (size) { |
| 8516 | *size = arr ? arr->size : 0; |
| 8517 | } |
| 8518 | return arr; |
| 8519 | } |
| 8520 | 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] | 8521 | 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] | 8522 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 8523 | (upb_Message*)msg, &field, arena); |
| 8524 | if (size) { |
| 8525 | *size = arr ? arr->size : 0; |
| 8526 | } |
| 8527 | return arr; |
| 8528 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8529 | UPB_INLINE bool google_protobuf_MethodOptions_has_uninterpreted_option(const google_protobuf_MethodOptions* msg) { |
| 8530 | size_t size; |
| 8531 | google_protobuf_MethodOptions_uninterpreted_option(msg, &size); |
| 8532 | return size != 0; |
| 8533 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8534 | |
| 8535 | 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] | 8536 | 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] | 8537 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8538 | } |
| 8539 | 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] | 8540 | 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] | 8541 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8542 | } |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8543 | UPB_INLINE void google_protobuf_MethodOptions_set_features(google_protobuf_MethodOptions *msg, google_protobuf_FeatureSet* value) { |
| 8544 | 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)}; |
| 8545 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 8546 | } |
| 8547 | UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_MethodOptions_mutable_features(google_protobuf_MethodOptions* msg, upb_Arena* arena) { |
| 8548 | struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_MethodOptions_features(msg); |
| 8549 | if (sub == NULL) { |
| 8550 | sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google_protobuf_FeatureSet_msg_init, arena); |
| 8551 | if (sub) google_protobuf_MethodOptions_set_features(msg, sub); |
| 8552 | } |
| 8553 | return sub; |
| 8554 | } |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8555 | 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] | 8556 | 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] | 8557 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 8558 | if (arr) { |
| 8559 | if (size) *size = arr->size; |
| 8560 | return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr); |
| 8561 | } else { |
| 8562 | if (size) *size = 0; |
| 8563 | return NULL; |
| 8564 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8565 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 8566 | 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] | 8567 | 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] | 8568 | return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8569 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8570 | 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] | 8571 | 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] | 8572 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 8573 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 8574 | return NULL; |
| 8575 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8576 | 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] | 8577 | if (!arr || !sub) return NULL; |
| 8578 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8579 | return sub; |
| 8580 | } |
| 8581 | |
| 8582 | /* google.protobuf.UninterpretedOption */ |
| 8583 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8584 | UPB_INLINE google_protobuf_UninterpretedOption* google_protobuf_UninterpretedOption_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8585 | 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] | 8586 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8587 | UPB_INLINE google_protobuf_UninterpretedOption* google_protobuf_UninterpretedOption_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 8588 | google_protobuf_UninterpretedOption* ret = google_protobuf_UninterpretedOption_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 8589 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8590 | 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] | 8591 | return NULL; |
| 8592 | } |
| 8593 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8594 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8595 | UPB_INLINE google_protobuf_UninterpretedOption* google_protobuf_UninterpretedOption_parse_ex(const char* buf, size_t size, |
| 8596 | const upb_ExtensionRegistry* extreg, |
| 8597 | int options, upb_Arena* arena) { |
| 8598 | google_protobuf_UninterpretedOption* ret = google_protobuf_UninterpretedOption_new(arena); |
| 8599 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8600 | 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] | 8601 | kUpb_DecodeStatus_Ok) { |
| 8602 | return NULL; |
| 8603 | } |
| 8604 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8605 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8606 | 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] | 8607 | char* ptr; |
| 8608 | (void)upb_Encode(msg, &google_protobuf_UninterpretedOption_msg_init, 0, arena, &ptr, len); |
| 8609 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8610 | } |
| 8611 | UPB_INLINE char* google_protobuf_UninterpretedOption_serialize_ex(const google_protobuf_UninterpretedOption* msg, int options, |
| 8612 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8613 | char* ptr; |
| 8614 | (void)upb_Encode(msg, &google_protobuf_UninterpretedOption_msg_init, options, arena, &ptr, len); |
| 8615 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8616 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8617 | UPB_INLINE void google_protobuf_UninterpretedOption_clear_name(google_protobuf_UninterpretedOption* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8618 | 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] | 8619 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8620 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 8621 | 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] | 8622 | 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] | 8623 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 8624 | if (arr) { |
| 8625 | if (size) *size = arr->size; |
| 8626 | return (const google_protobuf_UninterpretedOption_NamePart* const*)_upb_array_constptr(arr); |
| 8627 | } else { |
| 8628 | if (size) *size = 0; |
| 8629 | return NULL; |
| 8630 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8631 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 8632 | 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] | 8633 | 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] | 8634 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 8635 | if (size) { |
| 8636 | *size = arr ? arr->size : 0; |
| 8637 | } |
| 8638 | return arr; |
| 8639 | } |
| 8640 | 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] | 8641 | 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] | 8642 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 8643 | (upb_Message*)msg, &field, arena); |
| 8644 | if (size) { |
| 8645 | *size = arr ? arr->size : 0; |
| 8646 | } |
| 8647 | return arr; |
| 8648 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8649 | UPB_INLINE bool google_protobuf_UninterpretedOption_has_name(const google_protobuf_UninterpretedOption* msg) { |
| 8650 | size_t size; |
| 8651 | google_protobuf_UninterpretedOption_name(msg, &size); |
| 8652 | return size != 0; |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8653 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8654 | 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] | 8655 | 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] | 8656 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8657 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8658 | 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] | 8659 | upb_StringView default_val = upb_StringView_FromString(""); |
| 8660 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8661 | 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] | 8662 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8663 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8664 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8665 | 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] | 8666 | 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] | 8667 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8668 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8669 | 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] | 8670 | 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] | 8671 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8672 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8673 | 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] | 8674 | uint64_t default_val = (uint64_t)0ull; |
| 8675 | uint64_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8676 | 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] | 8677 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8678 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8679 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8680 | 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] | 8681 | 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] | 8682 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8683 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8684 | 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] | 8685 | 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] | 8686 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8687 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8688 | 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] | 8689 | int64_t default_val = (int64_t)0ll; |
| 8690 | int64_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8691 | 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] | 8692 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8693 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8694 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8695 | 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] | 8696 | 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] | 8697 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8698 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8699 | 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] | 8700 | 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] | 8701 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8702 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8703 | 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] | 8704 | double default_val = 0; |
| 8705 | double ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8706 | 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] | 8707 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8708 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8709 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8710 | 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] | 8711 | 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] | 8712 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8713 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8714 | 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] | 8715 | 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] | 8716 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8717 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8718 | 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] | 8719 | upb_StringView default_val = upb_StringView_FromString(""); |
| 8720 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8721 | 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] | 8722 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8723 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8724 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8725 | 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] | 8726 | 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] | 8727 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8728 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8729 | 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] | 8730 | 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] | 8731 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8732 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8733 | 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] | 8734 | upb_StringView default_val = upb_StringView_FromString(""); |
| 8735 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8736 | 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] | 8737 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8738 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8739 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8740 | 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] | 8741 | 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] | 8742 | return _upb_Message_HasNonExtensionField(msg, &field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8743 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8744 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 8745 | 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] | 8746 | 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] | 8747 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 8748 | if (arr) { |
| 8749 | if (size) *size = arr->size; |
| 8750 | return (google_protobuf_UninterpretedOption_NamePart**)_upb_array_ptr(arr); |
| 8751 | } else { |
| 8752 | if (size) *size = 0; |
| 8753 | return NULL; |
| 8754 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8755 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 8756 | 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] | 8757 | 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] | 8758 | return (google_protobuf_UninterpretedOption_NamePart**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8759 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8760 | 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] | 8761 | 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] | 8762 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 8763 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 8764 | return NULL; |
| 8765 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8766 | 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] | 8767 | if (!arr || !sub) return NULL; |
| 8768 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8769 | return sub; |
| 8770 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8771 | 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] | 8772 | 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] | 8773 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8774 | } |
| 8775 | 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] | 8776 | 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] | 8777 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8778 | } |
| 8779 | 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] | 8780 | 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] | 8781 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8782 | } |
| 8783 | 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] | 8784 | 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] | 8785 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8786 | } |
| 8787 | 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] | 8788 | 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] | 8789 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8790 | } |
| 8791 | 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] | 8792 | 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] | 8793 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8794 | } |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8795 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8796 | /* google.protobuf.UninterpretedOption.NamePart */ |
| 8797 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8798 | UPB_INLINE google_protobuf_UninterpretedOption_NamePart* google_protobuf_UninterpretedOption_NamePart_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8799 | 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] | 8800 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8801 | UPB_INLINE google_protobuf_UninterpretedOption_NamePart* google_protobuf_UninterpretedOption_NamePart_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 8802 | google_protobuf_UninterpretedOption_NamePart* ret = google_protobuf_UninterpretedOption_NamePart_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 8803 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8804 | 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] | 8805 | return NULL; |
| 8806 | } |
| 8807 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8808 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8809 | UPB_INLINE google_protobuf_UninterpretedOption_NamePart* google_protobuf_UninterpretedOption_NamePart_parse_ex(const char* buf, size_t size, |
| 8810 | const upb_ExtensionRegistry* extreg, |
| 8811 | int options, upb_Arena* arena) { |
| 8812 | google_protobuf_UninterpretedOption_NamePart* ret = google_protobuf_UninterpretedOption_NamePart_new(arena); |
| 8813 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8814 | 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] | 8815 | kUpb_DecodeStatus_Ok) { |
| 8816 | return NULL; |
| 8817 | } |
| 8818 | return ret; |
| 8819 | } |
| 8820 | 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] | 8821 | char* ptr; |
| 8822 | (void)upb_Encode(msg, &google_protobuf_UninterpretedOption_NamePart_msg_init, 0, arena, &ptr, len); |
| 8823 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8824 | } |
| 8825 | UPB_INLINE char* google_protobuf_UninterpretedOption_NamePart_serialize_ex(const google_protobuf_UninterpretedOption_NamePart* msg, int options, |
| 8826 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8827 | char* ptr; |
| 8828 | (void)upb_Encode(msg, &google_protobuf_UninterpretedOption_NamePart_msg_init, options, arena, &ptr, len); |
| 8829 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8830 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8831 | 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] | 8832 | 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] | 8833 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8834 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8835 | 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] | 8836 | upb_StringView default_val = upb_StringView_FromString(""); |
| 8837 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8838 | 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] | 8839 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8840 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8841 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8842 | 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] | 8843 | 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] | 8844 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 8845 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8846 | 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] | 8847 | 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] | 8848 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 8849 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8850 | 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] | 8851 | bool default_val = false; |
| 8852 | bool ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 8853 | 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] | 8854 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 8855 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8856 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8857 | 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] | 8858 | 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] | 8859 | return _upb_Message_HasNonExtensionField(msg, &field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 8860 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8861 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 8862 | 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] | 8863 | 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] | 8864 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8865 | } |
| 8866 | 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] | 8867 | 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] | 8868 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 8869 | } |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 8870 | |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 8871 | /* google.protobuf.FeatureSet */ |
| 8872 | |
| 8873 | UPB_INLINE google_protobuf_FeatureSet* google_protobuf_FeatureSet_new(upb_Arena* arena) { |
| 8874 | return (google_protobuf_FeatureSet*)_upb_Message_New(&google_protobuf_FeatureSet_msg_init, arena); |
| 8875 | } |
| 8876 | UPB_INLINE google_protobuf_FeatureSet* google_protobuf_FeatureSet_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 8877 | google_protobuf_FeatureSet* ret = google_protobuf_FeatureSet_new(arena); |
| 8878 | if (!ret) return NULL; |
| 8879 | if (upb_Decode(buf, size, ret, &google_protobuf_FeatureSet_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) { |
| 8880 | return NULL; |
| 8881 | } |
| 8882 | return ret; |
| 8883 | } |
| 8884 | UPB_INLINE google_protobuf_FeatureSet* google_protobuf_FeatureSet_parse_ex(const char* buf, size_t size, |
| 8885 | const upb_ExtensionRegistry* extreg, |
| 8886 | int options, upb_Arena* arena) { |
| 8887 | google_protobuf_FeatureSet* ret = google_protobuf_FeatureSet_new(arena); |
| 8888 | if (!ret) return NULL; |
| 8889 | if (upb_Decode(buf, size, ret, &google_protobuf_FeatureSet_msg_init, extreg, options, arena) != |
| 8890 | kUpb_DecodeStatus_Ok) { |
| 8891 | return NULL; |
| 8892 | } |
| 8893 | return ret; |
| 8894 | } |
| 8895 | UPB_INLINE char* google_protobuf_FeatureSet_serialize(const google_protobuf_FeatureSet* msg, upb_Arena* arena, size_t* len) { |
| 8896 | char* ptr; |
| 8897 | (void)upb_Encode(msg, &google_protobuf_FeatureSet_msg_init, 0, arena, &ptr, len); |
| 8898 | return ptr; |
| 8899 | } |
| 8900 | UPB_INLINE char* google_protobuf_FeatureSet_serialize_ex(const google_protobuf_FeatureSet* msg, int options, |
| 8901 | upb_Arena* arena, size_t* len) { |
| 8902 | char* ptr; |
| 8903 | (void)upb_Encode(msg, &google_protobuf_FeatureSet_msg_init, options, arena, &ptr, len); |
| 8904 | return ptr; |
| 8905 | } |
| 8906 | UPB_INLINE void google_protobuf_FeatureSet_clear_field_presence(google_protobuf_FeatureSet* msg) { |
| 8907 | const upb_MiniTableField field = {1, 4, 1, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
| 8908 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 8909 | } |
| 8910 | UPB_INLINE int32_t google_protobuf_FeatureSet_field_presence(const google_protobuf_FeatureSet* msg) { |
| 8911 | int32_t default_val = 0; |
| 8912 | int32_t ret; |
| 8913 | const upb_MiniTableField field = {1, 4, 1, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
| 8914 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 8915 | return ret; |
| 8916 | } |
| 8917 | UPB_INLINE bool google_protobuf_FeatureSet_has_field_presence(const google_protobuf_FeatureSet* msg) { |
| 8918 | const upb_MiniTableField field = {1, 4, 1, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
| 8919 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 8920 | } |
| 8921 | UPB_INLINE void google_protobuf_FeatureSet_clear_enum_type(google_protobuf_FeatureSet* msg) { |
| 8922 | const upb_MiniTableField field = {2, 8, 2, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
| 8923 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 8924 | } |
| 8925 | UPB_INLINE int32_t google_protobuf_FeatureSet_enum_type(const google_protobuf_FeatureSet* msg) { |
| 8926 | int32_t default_val = 0; |
| 8927 | int32_t ret; |
| 8928 | const upb_MiniTableField field = {2, 8, 2, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
| 8929 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 8930 | return ret; |
| 8931 | } |
| 8932 | UPB_INLINE bool google_protobuf_FeatureSet_has_enum_type(const google_protobuf_FeatureSet* msg) { |
| 8933 | const upb_MiniTableField field = {2, 8, 2, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
| 8934 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 8935 | } |
| 8936 | UPB_INLINE void google_protobuf_FeatureSet_clear_repeated_field_encoding(google_protobuf_FeatureSet* msg) { |
| 8937 | const upb_MiniTableField field = {3, 12, 3, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
| 8938 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 8939 | } |
| 8940 | UPB_INLINE int32_t google_protobuf_FeatureSet_repeated_field_encoding(const google_protobuf_FeatureSet* msg) { |
| 8941 | int32_t default_val = 0; |
| 8942 | int32_t ret; |
| 8943 | const upb_MiniTableField field = {3, 12, 3, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
| 8944 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 8945 | return ret; |
| 8946 | } |
| 8947 | UPB_INLINE bool google_protobuf_FeatureSet_has_repeated_field_encoding(const google_protobuf_FeatureSet* msg) { |
| 8948 | const upb_MiniTableField field = {3, 12, 3, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
| 8949 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 8950 | } |
| 8951 | UPB_INLINE void google_protobuf_FeatureSet_clear_string_field_validation(google_protobuf_FeatureSet* msg) { |
| 8952 | const upb_MiniTableField field = {4, 16, 4, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
| 8953 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 8954 | } |
| 8955 | UPB_INLINE int32_t google_protobuf_FeatureSet_string_field_validation(const google_protobuf_FeatureSet* msg) { |
| 8956 | int32_t default_val = 0; |
| 8957 | int32_t ret; |
| 8958 | const upb_MiniTableField field = {4, 16, 4, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
| 8959 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 8960 | return ret; |
| 8961 | } |
| 8962 | UPB_INLINE bool google_protobuf_FeatureSet_has_string_field_validation(const google_protobuf_FeatureSet* msg) { |
| 8963 | const upb_MiniTableField field = {4, 16, 4, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
| 8964 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 8965 | } |
| 8966 | UPB_INLINE void google_protobuf_FeatureSet_clear_message_encoding(google_protobuf_FeatureSet* msg) { |
| 8967 | const upb_MiniTableField field = {5, 20, 5, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
| 8968 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 8969 | } |
| 8970 | UPB_INLINE int32_t google_protobuf_FeatureSet_message_encoding(const google_protobuf_FeatureSet* msg) { |
| 8971 | int32_t default_val = 0; |
| 8972 | int32_t ret; |
| 8973 | const upb_MiniTableField field = {5, 20, 5, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
| 8974 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 8975 | return ret; |
| 8976 | } |
| 8977 | UPB_INLINE bool google_protobuf_FeatureSet_has_message_encoding(const google_protobuf_FeatureSet* msg) { |
| 8978 | const upb_MiniTableField field = {5, 20, 5, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
| 8979 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 8980 | } |
| 8981 | UPB_INLINE void google_protobuf_FeatureSet_clear_json_format(google_protobuf_FeatureSet* msg) { |
| 8982 | const upb_MiniTableField field = {6, 24, 6, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
| 8983 | _upb_Message_ClearNonExtensionField(msg, &field); |
| 8984 | } |
| 8985 | UPB_INLINE int32_t google_protobuf_FeatureSet_json_format(const google_protobuf_FeatureSet* msg) { |
| 8986 | int32_t default_val = 0; |
| 8987 | int32_t ret; |
| 8988 | const upb_MiniTableField field = {6, 24, 6, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
| 8989 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
| 8990 | return ret; |
| 8991 | } |
| 8992 | UPB_INLINE bool google_protobuf_FeatureSet_has_json_format(const google_protobuf_FeatureSet* msg) { |
| 8993 | const upb_MiniTableField field = {6, 24, 6, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
| 8994 | return _upb_Message_HasNonExtensionField(msg, &field); |
| 8995 | } |
| 8996 | |
| 8997 | UPB_INLINE void google_protobuf_FeatureSet_set_field_presence(google_protobuf_FeatureSet *msg, int32_t value) { |
| 8998 | const upb_MiniTableField field = {1, 4, 1, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
| 8999 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 9000 | } |
| 9001 | UPB_INLINE void google_protobuf_FeatureSet_set_enum_type(google_protobuf_FeatureSet *msg, int32_t value) { |
| 9002 | const upb_MiniTableField field = {2, 8, 2, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
| 9003 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 9004 | } |
| 9005 | UPB_INLINE void google_protobuf_FeatureSet_set_repeated_field_encoding(google_protobuf_FeatureSet *msg, int32_t value) { |
| 9006 | const upb_MiniTableField field = {3, 12, 3, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
| 9007 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 9008 | } |
| 9009 | UPB_INLINE void google_protobuf_FeatureSet_set_string_field_validation(google_protobuf_FeatureSet *msg, int32_t value) { |
| 9010 | const upb_MiniTableField field = {4, 16, 4, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
| 9011 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 9012 | } |
| 9013 | UPB_INLINE void google_protobuf_FeatureSet_set_message_encoding(google_protobuf_FeatureSet *msg, int32_t value) { |
| 9014 | const upb_MiniTableField field = {5, 20, 5, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
| 9015 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 9016 | } |
| 9017 | UPB_INLINE void google_protobuf_FeatureSet_set_json_format(google_protobuf_FeatureSet *msg, int32_t value) { |
| 9018 | const upb_MiniTableField field = {6, 24, 6, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; |
| 9019 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
| 9020 | } |
| 9021 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9022 | /* google.protobuf.SourceCodeInfo */ |
| 9023 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9024 | UPB_INLINE google_protobuf_SourceCodeInfo* google_protobuf_SourceCodeInfo_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9025 | 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] | 9026 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9027 | UPB_INLINE google_protobuf_SourceCodeInfo* google_protobuf_SourceCodeInfo_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 9028 | google_protobuf_SourceCodeInfo* ret = google_protobuf_SourceCodeInfo_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 9029 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9030 | 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] | 9031 | return NULL; |
| 9032 | } |
| 9033 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9034 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9035 | UPB_INLINE google_protobuf_SourceCodeInfo* google_protobuf_SourceCodeInfo_parse_ex(const char* buf, size_t size, |
| 9036 | const upb_ExtensionRegistry* extreg, |
| 9037 | int options, upb_Arena* arena) { |
| 9038 | google_protobuf_SourceCodeInfo* ret = google_protobuf_SourceCodeInfo_new(arena); |
| 9039 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9040 | 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] | 9041 | kUpb_DecodeStatus_Ok) { |
| 9042 | return NULL; |
| 9043 | } |
| 9044 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9045 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9046 | 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] | 9047 | char* ptr; |
| 9048 | (void)upb_Encode(msg, &google_protobuf_SourceCodeInfo_msg_init, 0, arena, &ptr, len); |
| 9049 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9050 | } |
| 9051 | UPB_INLINE char* google_protobuf_SourceCodeInfo_serialize_ex(const google_protobuf_SourceCodeInfo* msg, int options, |
| 9052 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9053 | char* ptr; |
| 9054 | (void)upb_Encode(msg, &google_protobuf_SourceCodeInfo_msg_init, options, arena, &ptr, len); |
| 9055 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9056 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9057 | UPB_INLINE void google_protobuf_SourceCodeInfo_clear_location(google_protobuf_SourceCodeInfo* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9058 | 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] | 9059 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9060 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9061 | 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] | 9062 | 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] | 9063 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 9064 | if (arr) { |
| 9065 | if (size) *size = arr->size; |
| 9066 | return (const google_protobuf_SourceCodeInfo_Location* const*)_upb_array_constptr(arr); |
| 9067 | } else { |
| 9068 | if (size) *size = 0; |
| 9069 | return NULL; |
| 9070 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9071 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 9072 | 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] | 9073 | 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] | 9074 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 9075 | if (size) { |
| 9076 | *size = arr ? arr->size : 0; |
| 9077 | } |
| 9078 | return arr; |
| 9079 | } |
| 9080 | 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] | 9081 | 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] | 9082 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 9083 | (upb_Message*)msg, &field, arena); |
| 9084 | if (size) { |
| 9085 | *size = arr ? arr->size : 0; |
| 9086 | } |
| 9087 | return arr; |
| 9088 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9089 | UPB_INLINE bool google_protobuf_SourceCodeInfo_has_location(const google_protobuf_SourceCodeInfo* msg) { |
| 9090 | size_t size; |
| 9091 | google_protobuf_SourceCodeInfo_location(msg, &size); |
| 9092 | return size != 0; |
| 9093 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9094 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9095 | 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] | 9096 | 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] | 9097 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 9098 | if (arr) { |
| 9099 | if (size) *size = arr->size; |
| 9100 | return (google_protobuf_SourceCodeInfo_Location**)_upb_array_ptr(arr); |
| 9101 | } else { |
| 9102 | if (size) *size = 0; |
| 9103 | return NULL; |
| 9104 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9105 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9106 | 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] | 9107 | 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] | 9108 | return (google_protobuf_SourceCodeInfo_Location**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9109 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9110 | 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] | 9111 | 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] | 9112 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 9113 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 9114 | return NULL; |
| 9115 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9116 | 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] | 9117 | if (!arr || !sub) return NULL; |
| 9118 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9119 | return sub; |
| 9120 | } |
| 9121 | |
| 9122 | /* google.protobuf.SourceCodeInfo.Location */ |
| 9123 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9124 | UPB_INLINE google_protobuf_SourceCodeInfo_Location* google_protobuf_SourceCodeInfo_Location_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9125 | 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] | 9126 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9127 | UPB_INLINE google_protobuf_SourceCodeInfo_Location* google_protobuf_SourceCodeInfo_Location_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 9128 | google_protobuf_SourceCodeInfo_Location* ret = google_protobuf_SourceCodeInfo_Location_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 9129 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9130 | 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] | 9131 | return NULL; |
| 9132 | } |
| 9133 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9134 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9135 | UPB_INLINE google_protobuf_SourceCodeInfo_Location* google_protobuf_SourceCodeInfo_Location_parse_ex(const char* buf, size_t size, |
| 9136 | const upb_ExtensionRegistry* extreg, |
| 9137 | int options, upb_Arena* arena) { |
| 9138 | google_protobuf_SourceCodeInfo_Location* ret = google_protobuf_SourceCodeInfo_Location_new(arena); |
| 9139 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9140 | 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] | 9141 | kUpb_DecodeStatus_Ok) { |
| 9142 | return NULL; |
| 9143 | } |
| 9144 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9145 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9146 | 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] | 9147 | char* ptr; |
| 9148 | (void)upb_Encode(msg, &google_protobuf_SourceCodeInfo_Location_msg_init, 0, arena, &ptr, len); |
| 9149 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9150 | } |
| 9151 | UPB_INLINE char* google_protobuf_SourceCodeInfo_Location_serialize_ex(const google_protobuf_SourceCodeInfo_Location* msg, int options, |
| 9152 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9153 | char* ptr; |
| 9154 | (void)upb_Encode(msg, &google_protobuf_SourceCodeInfo_Location_msg_init, options, arena, &ptr, len); |
| 9155 | return ptr; |
| 9156 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9157 | 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] | 9158 | 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] | 9159 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9160 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9161 | 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] | 9162 | 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] | 9163 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 9164 | if (arr) { |
| 9165 | if (size) *size = arr->size; |
| 9166 | return (int32_t const*)_upb_array_constptr(arr); |
| 9167 | } else { |
| 9168 | if (size) *size = 0; |
| 9169 | return NULL; |
| 9170 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9171 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 9172 | 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] | 9173 | 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] | 9174 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 9175 | if (size) { |
| 9176 | *size = arr ? arr->size : 0; |
| 9177 | } |
| 9178 | return arr; |
| 9179 | } |
| 9180 | 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] | 9181 | 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] | 9182 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 9183 | (upb_Message*)msg, &field, arena); |
| 9184 | if (size) { |
| 9185 | *size = arr ? arr->size : 0; |
| 9186 | } |
| 9187 | return arr; |
| 9188 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9189 | UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_has_path(const google_protobuf_SourceCodeInfo_Location* msg) { |
| 9190 | size_t size; |
| 9191 | google_protobuf_SourceCodeInfo_Location_path(msg, &size); |
| 9192 | return size != 0; |
| 9193 | } |
| 9194 | 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] | 9195 | 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] | 9196 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9197 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9198 | 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] | 9199 | 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] | 9200 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 9201 | if (arr) { |
| 9202 | if (size) *size = arr->size; |
| 9203 | return (int32_t const*)_upb_array_constptr(arr); |
| 9204 | } else { |
| 9205 | if (size) *size = 0; |
| 9206 | return NULL; |
| 9207 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9208 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 9209 | 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] | 9210 | 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] | 9211 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 9212 | if (size) { |
| 9213 | *size = arr ? arr->size : 0; |
| 9214 | } |
| 9215 | return arr; |
| 9216 | } |
| 9217 | 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] | 9218 | 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] | 9219 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 9220 | (upb_Message*)msg, &field, arena); |
| 9221 | if (size) { |
| 9222 | *size = arr ? arr->size : 0; |
| 9223 | } |
| 9224 | return arr; |
| 9225 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9226 | UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_has_span(const google_protobuf_SourceCodeInfo_Location* msg) { |
| 9227 | size_t size; |
| 9228 | google_protobuf_SourceCodeInfo_Location_span(msg, &size); |
| 9229 | return size != 0; |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9230 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9231 | 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] | 9232 | 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] | 9233 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9234 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9235 | 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] | 9236 | upb_StringView default_val = upb_StringView_FromString(""); |
| 9237 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9238 | 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] | 9239 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 9240 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9241 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9242 | 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] | 9243 | 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] | 9244 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9245 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9246 | 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] | 9247 | 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] | 9248 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9249 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9250 | 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] | 9251 | upb_StringView default_val = upb_StringView_FromString(""); |
| 9252 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9253 | 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] | 9254 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 9255 | return ret; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9256 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9257 | 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] | 9258 | 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] | 9259 | return _upb_Message_HasNonExtensionField(msg, &field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9260 | } |
| 9261 | 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] | 9262 | 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] | 9263 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9264 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9265 | 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] | 9266 | 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] | 9267 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 9268 | if (arr) { |
| 9269 | if (size) *size = arr->size; |
| 9270 | return (upb_StringView const*)_upb_array_constptr(arr); |
| 9271 | } else { |
| 9272 | if (size) *size = 0; |
| 9273 | return NULL; |
| 9274 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9275 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 9276 | 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] | 9277 | 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] | 9278 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 9279 | if (size) { |
| 9280 | *size = arr ? arr->size : 0; |
| 9281 | } |
| 9282 | return arr; |
| 9283 | } |
| 9284 | 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] | 9285 | 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] | 9286 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 9287 | (upb_Message*)msg, &field, arena); |
| 9288 | if (size) { |
| 9289 | *size = arr ? arr->size : 0; |
| 9290 | } |
| 9291 | return arr; |
| 9292 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9293 | UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_has_leading_detached_comments(const google_protobuf_SourceCodeInfo_Location* msg) { |
| 9294 | size_t size; |
| 9295 | google_protobuf_SourceCodeInfo_Location_leading_detached_comments(msg, &size); |
| 9296 | return size != 0; |
| 9297 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9298 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9299 | 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] | 9300 | 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] | 9301 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 9302 | if (arr) { |
| 9303 | if (size) *size = arr->size; |
| 9304 | return (int32_t*)_upb_array_ptr(arr); |
| 9305 | } else { |
| 9306 | if (size) *size = 0; |
| 9307 | return NULL; |
| 9308 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9309 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9310 | 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] | 9311 | 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] | 9312 | return (int32_t*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9313 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9314 | 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] | 9315 | 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] | 9316 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 9317 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 9318 | return false; |
| 9319 | } |
| 9320 | _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val)); |
| 9321 | return true; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9322 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9323 | 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] | 9324 | 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] | 9325 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 9326 | if (arr) { |
| 9327 | if (size) *size = arr->size; |
| 9328 | return (int32_t*)_upb_array_ptr(arr); |
| 9329 | } else { |
| 9330 | if (size) *size = 0; |
| 9331 | return NULL; |
| 9332 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9333 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9334 | 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] | 9335 | 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] | 9336 | return (int32_t*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9337 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9338 | 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] | 9339 | 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] | 9340 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 9341 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 9342 | return false; |
| 9343 | } |
| 9344 | _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val)); |
| 9345 | return true; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9346 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9347 | 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] | 9348 | 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] | 9349 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 9350 | } |
| 9351 | 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] | 9352 | 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] | 9353 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 9354 | } |
| 9355 | 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] | 9356 | 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] | 9357 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 9358 | if (arr) { |
| 9359 | if (size) *size = arr->size; |
| 9360 | return (upb_StringView*)_upb_array_ptr(arr); |
| 9361 | } else { |
| 9362 | if (size) *size = 0; |
| 9363 | return NULL; |
| 9364 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9365 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9366 | 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] | 9367 | 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] | 9368 | return (upb_StringView*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9369 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9370 | 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] | 9371 | 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] | 9372 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 9373 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 9374 | return false; |
| 9375 | } |
| 9376 | _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val)); |
| 9377 | return true; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9378 | } |
| 9379 | |
| 9380 | /* google.protobuf.GeneratedCodeInfo */ |
| 9381 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9382 | UPB_INLINE google_protobuf_GeneratedCodeInfo* google_protobuf_GeneratedCodeInfo_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9383 | 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] | 9384 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9385 | UPB_INLINE google_protobuf_GeneratedCodeInfo* google_protobuf_GeneratedCodeInfo_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 9386 | google_protobuf_GeneratedCodeInfo* ret = google_protobuf_GeneratedCodeInfo_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 9387 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9388 | 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] | 9389 | return NULL; |
| 9390 | } |
| 9391 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9392 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9393 | UPB_INLINE google_protobuf_GeneratedCodeInfo* google_protobuf_GeneratedCodeInfo_parse_ex(const char* buf, size_t size, |
| 9394 | const upb_ExtensionRegistry* extreg, |
| 9395 | int options, upb_Arena* arena) { |
| 9396 | google_protobuf_GeneratedCodeInfo* ret = google_protobuf_GeneratedCodeInfo_new(arena); |
| 9397 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9398 | 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] | 9399 | kUpb_DecodeStatus_Ok) { |
| 9400 | return NULL; |
| 9401 | } |
| 9402 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9403 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9404 | 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] | 9405 | char* ptr; |
| 9406 | (void)upb_Encode(msg, &google_protobuf_GeneratedCodeInfo_msg_init, 0, arena, &ptr, len); |
| 9407 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9408 | } |
| 9409 | UPB_INLINE char* google_protobuf_GeneratedCodeInfo_serialize_ex(const google_protobuf_GeneratedCodeInfo* msg, int options, |
| 9410 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9411 | char* ptr; |
| 9412 | (void)upb_Encode(msg, &google_protobuf_GeneratedCodeInfo_msg_init, options, arena, &ptr, len); |
| 9413 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9414 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9415 | UPB_INLINE void google_protobuf_GeneratedCodeInfo_clear_annotation(google_protobuf_GeneratedCodeInfo* msg) { |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9416 | 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] | 9417 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9418 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9419 | 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] | 9420 | 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] | 9421 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 9422 | if (arr) { |
| 9423 | if (size) *size = arr->size; |
| 9424 | return (const google_protobuf_GeneratedCodeInfo_Annotation* const*)_upb_array_constptr(arr); |
| 9425 | } else { |
| 9426 | if (size) *size = 0; |
| 9427 | return NULL; |
| 9428 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9429 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 9430 | 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] | 9431 | 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] | 9432 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 9433 | if (size) { |
| 9434 | *size = arr ? arr->size : 0; |
| 9435 | } |
| 9436 | return arr; |
| 9437 | } |
| 9438 | 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] | 9439 | 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] | 9440 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 9441 | (upb_Message*)msg, &field, arena); |
| 9442 | if (size) { |
| 9443 | *size = arr ? arr->size : 0; |
| 9444 | } |
| 9445 | return arr; |
| 9446 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9447 | UPB_INLINE bool google_protobuf_GeneratedCodeInfo_has_annotation(const google_protobuf_GeneratedCodeInfo* msg) { |
| 9448 | size_t size; |
| 9449 | google_protobuf_GeneratedCodeInfo_annotation(msg, &size); |
| 9450 | return size != 0; |
| 9451 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9452 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9453 | 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] | 9454 | 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] | 9455 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 9456 | if (arr) { |
| 9457 | if (size) *size = arr->size; |
| 9458 | return (google_protobuf_GeneratedCodeInfo_Annotation**)_upb_array_ptr(arr); |
| 9459 | } else { |
| 9460 | if (size) *size = 0; |
| 9461 | return NULL; |
| 9462 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9463 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9464 | 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] | 9465 | 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] | 9466 | return (google_protobuf_GeneratedCodeInfo_Annotation**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9467 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9468 | 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] | 9469 | 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] | 9470 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 9471 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 9472 | return NULL; |
| 9473 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9474 | 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] | 9475 | if (!arr || !sub) return NULL; |
| 9476 | _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9477 | return sub; |
| 9478 | } |
| 9479 | |
| 9480 | /* google.protobuf.GeneratedCodeInfo.Annotation */ |
| 9481 | |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9482 | UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation* google_protobuf_GeneratedCodeInfo_Annotation_new(upb_Arena* arena) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9483 | 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] | 9484 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9485 | UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation* google_protobuf_GeneratedCodeInfo_Annotation_parse(const char* buf, size_t size, upb_Arena* arena) { |
| 9486 | google_protobuf_GeneratedCodeInfo_Annotation* ret = google_protobuf_GeneratedCodeInfo_Annotation_new(arena); |
Joshua Haberman | 9d578a3 | 2021-08-02 15:32:01 -0700 | [diff] [blame] | 9487 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9488 | 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] | 9489 | return NULL; |
| 9490 | } |
| 9491 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9492 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9493 | UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation* google_protobuf_GeneratedCodeInfo_Annotation_parse_ex(const char* buf, size_t size, |
| 9494 | const upb_ExtensionRegistry* extreg, |
| 9495 | int options, upb_Arena* arena) { |
| 9496 | google_protobuf_GeneratedCodeInfo_Annotation* ret = google_protobuf_GeneratedCodeInfo_Annotation_new(arena); |
| 9497 | if (!ret) return NULL; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9498 | 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] | 9499 | kUpb_DecodeStatus_Ok) { |
| 9500 | return NULL; |
| 9501 | } |
| 9502 | return ret; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9503 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9504 | 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] | 9505 | char* ptr; |
| 9506 | (void)upb_Encode(msg, &google_protobuf_GeneratedCodeInfo_Annotation_msg_init, 0, arena, &ptr, len); |
| 9507 | return ptr; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9508 | } |
| 9509 | UPB_INLINE char* google_protobuf_GeneratedCodeInfo_Annotation_serialize_ex(const google_protobuf_GeneratedCodeInfo_Annotation* msg, int options, |
| 9510 | upb_Arena* arena, size_t* len) { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9511 | char* ptr; |
| 9512 | (void)upb_Encode(msg, &google_protobuf_GeneratedCodeInfo_Annotation_msg_init, options, arena, &ptr, len); |
| 9513 | return ptr; |
| 9514 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9515 | 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] | 9516 | 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] | 9517 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9518 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9519 | 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] | 9520 | 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] | 9521 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 9522 | if (arr) { |
| 9523 | if (size) *size = arr->size; |
| 9524 | return (int32_t const*)_upb_array_constptr(arr); |
| 9525 | } else { |
| 9526 | if (size) *size = 0; |
| 9527 | return NULL; |
| 9528 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9529 | } |
Deanna Garcia | b26afb5 | 2023-04-25 13:37:18 -0700 | [diff] [blame] | 9530 | 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] | 9531 | 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] | 9532 | const upb_Array* arr = upb_Message_GetArray(msg, &field); |
| 9533 | if (size) { |
| 9534 | *size = arr ? arr->size : 0; |
| 9535 | } |
| 9536 | return arr; |
| 9537 | } |
| 9538 | 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] | 9539 | 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] | 9540 | upb_Array* arr = upb_Message_GetOrCreateMutableArray( |
| 9541 | (upb_Message*)msg, &field, arena); |
| 9542 | if (size) { |
| 9543 | *size = arr ? arr->size : 0; |
| 9544 | } |
| 9545 | return arr; |
| 9546 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9547 | UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_path(const google_protobuf_GeneratedCodeInfo_Annotation* msg) { |
| 9548 | size_t size; |
| 9549 | google_protobuf_GeneratedCodeInfo_Annotation_path(msg, &size); |
| 9550 | return size != 0; |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9551 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9552 | 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] | 9553 | 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] | 9554 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9555 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9556 | 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] | 9557 | upb_StringView default_val = upb_StringView_FromString(""); |
| 9558 | upb_StringView ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9559 | 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] | 9560 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 9561 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9562 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9563 | 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] | 9564 | 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] | 9565 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9566 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9567 | 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] | 9568 | 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] | 9569 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9570 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9571 | 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] | 9572 | int32_t default_val = (int32_t)0; |
| 9573 | int32_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9574 | 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] | 9575 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 9576 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9577 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9578 | 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] | 9579 | 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] | 9580 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9581 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9582 | 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] | 9583 | 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] | 9584 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9585 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9586 | 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] | 9587 | int32_t default_val = (int32_t)0; |
| 9588 | int32_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9589 | 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] | 9590 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 9591 | return ret; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9592 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9593 | 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] | 9594 | 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] | 9595 | return _upb_Message_HasNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9596 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9597 | 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] | 9598 | 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] | 9599 | _upb_Message_ClearNonExtensionField(msg, &field); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9600 | } |
| 9601 | 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] | 9602 | int32_t default_val = 0; |
| 9603 | int32_t ret; |
Jie Luo | 3560e23 | 2023-06-12 00:33:50 -0700 | [diff] [blame] | 9604 | 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] | 9605 | _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 9606 | return ret; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 9607 | } |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9608 | 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] | 9609 | 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] | 9610 | return _upb_Message_HasNonExtensionField(msg, &field); |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 9611 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9612 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9613 | 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] | 9614 | 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] | 9615 | upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
| 9616 | if (arr) { |
| 9617 | if (size) *size = arr->size; |
| 9618 | return (int32_t*)_upb_array_ptr(arr); |
| 9619 | } else { |
| 9620 | if (size) *size = 0; |
| 9621 | return NULL; |
| 9622 | } |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9623 | } |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9624 | 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] | 9625 | 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] | 9626 | return (int32_t*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9627 | } |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 9628 | 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] | 9629 | 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] | 9630 | upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
| 9631 | if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
| 9632 | return false; |
| 9633 | } |
| 9634 | _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val)); |
| 9635 | return true; |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9636 | } |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9637 | 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] | 9638 | 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] | 9639 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 9640 | } |
| 9641 | 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] | 9642 | 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] | 9643 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 9644 | } |
| 9645 | 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] | 9646 | 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] | 9647 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 9648 | } |
| 9649 | 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] | 9650 | 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] | 9651 | _upb_Message_SetNonExtensionField(msg, &field, &value); |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9652 | } |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 9653 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 9654 | extern const upb_MiniTableFile google_protobuf_descriptor_proto_upb_file_layout; |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9655 | |
| 9656 | /* Max size 32 is google.protobuf.FileOptions */ |
| 9657 | /* Max size 64 is google.protobuf.FileOptions */ |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 9658 | #define _UPB_MAXOPT_SIZE UPB_SIZE(112, 200) |
Joshua Haberman | f41049a | 2022-01-21 14:41:25 -0800 | [diff] [blame] | 9659 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 9660 | #ifdef __cplusplus |
| 9661 | } /* extern "C" */ |
| 9662 | #endif |
| 9663 | |
| 9664 | |
| 9665 | #endif /* GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_H_ */ |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 9666 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9667 | #ifndef UPB_WIRE_EPS_COPY_INPUT_STREAM_H_ |
| 9668 | #define UPB_WIRE_EPS_COPY_INPUT_STREAM_H_ |
| 9669 | |
| 9670 | #include <string.h> |
| 9671 | |
| 9672 | |
| 9673 | // Must be last. |
| 9674 | |
| 9675 | #ifdef __cplusplus |
| 9676 | extern "C" { |
| 9677 | #endif |
| 9678 | |
| 9679 | // The maximum number of bytes a single protobuf field can take up in the |
| 9680 | // wire format. We only want to do one bounds check per field, so the input |
| 9681 | // stream guarantees that after upb_EpsCopyInputStream_IsDone() is called, |
| 9682 | // the decoder can read this many bytes without performing another bounds |
| 9683 | // check. The stream will copy into a patch buffer as necessary to guarantee |
| 9684 | // this invariant. |
| 9685 | #define kUpb_EpsCopyInputStream_SlopBytes 16 |
| 9686 | |
| 9687 | enum { |
| 9688 | kUpb_EpsCopyInputStream_NoAliasing = 0, |
| 9689 | kUpb_EpsCopyInputStream_OnPatch = 1, |
| 9690 | kUpb_EpsCopyInputStream_NoDelta = 2 |
| 9691 | }; |
| 9692 | |
| 9693 | typedef struct { |
| 9694 | const char* end; // Can read up to SlopBytes bytes beyond this. |
| 9695 | const char* limit_ptr; // For bounds checks, = end + UPB_MIN(limit, 0) |
| 9696 | uintptr_t aliasing; |
| 9697 | int limit; // Submessage limit relative to end |
| 9698 | bool error; // To distinguish between EOF and error. |
| 9699 | char patch[kUpb_EpsCopyInputStream_SlopBytes * 2]; |
| 9700 | } upb_EpsCopyInputStream; |
| 9701 | |
| 9702 | // Returns true if the stream is in the error state. A stream enters the error |
| 9703 | // state when the user reads past a limit (caught in IsDone()) or the |
| 9704 | // ZeroCopyInputStream returns an error. |
| 9705 | UPB_INLINE bool upb_EpsCopyInputStream_IsError(upb_EpsCopyInputStream* e) { |
| 9706 | return e->error; |
| 9707 | } |
| 9708 | |
| 9709 | typedef const char* upb_EpsCopyInputStream_BufferFlipCallback( |
| 9710 | upb_EpsCopyInputStream* e, const char* old_end, const char* new_start); |
| 9711 | |
| 9712 | typedef const char* upb_EpsCopyInputStream_IsDoneFallbackFunc( |
| 9713 | upb_EpsCopyInputStream* e, const char* ptr, int overrun); |
| 9714 | |
| 9715 | // Initializes a upb_EpsCopyInputStream using the contents of the buffer |
| 9716 | // [*ptr, size]. Updates `*ptr` as necessary to guarantee that at least |
| 9717 | // kUpb_EpsCopyInputStream_SlopBytes are available to read. |
| 9718 | UPB_INLINE void upb_EpsCopyInputStream_Init(upb_EpsCopyInputStream* e, |
| 9719 | const char** ptr, size_t size, |
| 9720 | bool enable_aliasing) { |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9721 | if (size <= kUpb_EpsCopyInputStream_SlopBytes) { |
| 9722 | memset(&e->patch, 0, 32); |
| 9723 | if (size) memcpy(&e->patch, *ptr, size); |
| 9724 | e->aliasing = enable_aliasing ? (uintptr_t)*ptr - (uintptr_t)e->patch |
| 9725 | : kUpb_EpsCopyInputStream_NoAliasing; |
| 9726 | *ptr = e->patch; |
| 9727 | e->end = *ptr + size; |
| 9728 | e->limit = 0; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9729 | } else { |
| 9730 | e->end = *ptr + size - kUpb_EpsCopyInputStream_SlopBytes; |
| 9731 | e->limit = kUpb_EpsCopyInputStream_SlopBytes; |
| 9732 | e->aliasing = enable_aliasing ? kUpb_EpsCopyInputStream_NoDelta |
| 9733 | : kUpb_EpsCopyInputStream_NoAliasing; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9734 | } |
| 9735 | e->limit_ptr = e->end; |
| 9736 | e->error = false; |
| 9737 | } |
| 9738 | |
| 9739 | typedef enum { |
| 9740 | // The current stream position is at a limit. |
| 9741 | kUpb_IsDoneStatus_Done, |
| 9742 | |
| 9743 | // The current stream position is not at a limit. |
| 9744 | kUpb_IsDoneStatus_NotDone, |
| 9745 | |
| 9746 | // The current stream position is not at a limit, and the stream needs to |
| 9747 | // be flipped to a new buffer before more data can be read. |
| 9748 | kUpb_IsDoneStatus_NeedFallback, |
| 9749 | } upb_IsDoneStatus; |
| 9750 | |
| 9751 | // Returns the status of the current stream position. This is a low-level |
| 9752 | // function, it is simpler to call upb_EpsCopyInputStream_IsDone() if possible. |
| 9753 | UPB_INLINE upb_IsDoneStatus upb_EpsCopyInputStream_IsDoneStatus( |
| 9754 | upb_EpsCopyInputStream* e, const char* ptr, int* overrun) { |
| 9755 | *overrun = ptr - e->end; |
| 9756 | if (UPB_LIKELY(ptr < e->limit_ptr)) { |
| 9757 | return kUpb_IsDoneStatus_NotDone; |
| 9758 | } else if (UPB_LIKELY(*overrun == e->limit)) { |
| 9759 | return kUpb_IsDoneStatus_Done; |
| 9760 | } else { |
| 9761 | return kUpb_IsDoneStatus_NeedFallback; |
| 9762 | } |
| 9763 | } |
| 9764 | |
| 9765 | // Returns true if the stream has hit a limit, either the current delimited |
| 9766 | // limit or the overall end-of-stream. As a side effect, this function may flip |
| 9767 | // the pointer to a new buffer if there are less than |
| 9768 | // kUpb_EpsCopyInputStream_SlopBytes of data to be read in the current buffer. |
| 9769 | // |
| 9770 | // Postcondition: if the function returns false, there are at least |
| 9771 | // kUpb_EpsCopyInputStream_SlopBytes of data available to read at *ptr. |
| 9772 | UPB_INLINE bool upb_EpsCopyInputStream_IsDoneWithCallback( |
| 9773 | upb_EpsCopyInputStream* e, const char** ptr, |
| 9774 | upb_EpsCopyInputStream_IsDoneFallbackFunc* func) { |
| 9775 | int overrun; |
| 9776 | switch (upb_EpsCopyInputStream_IsDoneStatus(e, *ptr, &overrun)) { |
| 9777 | case kUpb_IsDoneStatus_Done: |
| 9778 | return true; |
| 9779 | case kUpb_IsDoneStatus_NotDone: |
| 9780 | return false; |
| 9781 | case kUpb_IsDoneStatus_NeedFallback: |
| 9782 | *ptr = func(e, *ptr, overrun); |
| 9783 | return *ptr == NULL; |
| 9784 | } |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 9785 | UPB_UNREACHABLE(); |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9786 | } |
| 9787 | |
| 9788 | const char* _upb_EpsCopyInputStream_IsDoneFallbackNoCallback( |
| 9789 | upb_EpsCopyInputStream* e, const char* ptr, int overrun); |
| 9790 | |
| 9791 | // A simpler version of IsDoneWithCallback() that does not support a buffer flip |
| 9792 | // callback. Useful in cases where we do not need to insert custom logic at |
| 9793 | // every buffer flip. |
| 9794 | // |
| 9795 | // If this returns true, the user must call upb_EpsCopyInputStream_IsError() |
| 9796 | // to distinguish between EOF and error. |
| 9797 | UPB_INLINE bool upb_EpsCopyInputStream_IsDone(upb_EpsCopyInputStream* e, |
| 9798 | const char** ptr) { |
| 9799 | return upb_EpsCopyInputStream_IsDoneWithCallback( |
| 9800 | e, ptr, _upb_EpsCopyInputStream_IsDoneFallbackNoCallback); |
| 9801 | } |
| 9802 | |
| 9803 | // Returns the total number of bytes that are safe to read from the current |
| 9804 | // buffer without reading uninitialized or unallocated memory. |
| 9805 | // |
| 9806 | // Note that this check does not respect any semantic limits on the stream, |
| 9807 | // either limits from PushLimit() or the overall stream end, so some of these |
| 9808 | // bytes may have unpredictable, nonsense values in them. The guarantee is only |
| 9809 | // that the bytes are valid to read from the perspective of the C language |
| 9810 | // (ie. you can read without triggering UBSAN or ASAN). |
| 9811 | UPB_INLINE size_t upb_EpsCopyInputStream_BytesAvailable( |
| 9812 | upb_EpsCopyInputStream* e, const char* ptr) { |
| 9813 | return (e->end - ptr) + kUpb_EpsCopyInputStream_SlopBytes; |
| 9814 | } |
| 9815 | |
| 9816 | // Returns true if the given delimited field size is valid (it does not extend |
| 9817 | // beyond any previously-pushed limits). `ptr` should point to the beginning |
| 9818 | // of the field data, after the delimited size. |
| 9819 | // |
| 9820 | // Note that this does *not* guarantee that all of the data for this field is in |
| 9821 | // the current buffer. |
| 9822 | UPB_INLINE bool upb_EpsCopyInputStream_CheckSize( |
| 9823 | const upb_EpsCopyInputStream* e, const char* ptr, int size) { |
| 9824 | UPB_ASSERT(size >= 0); |
| 9825 | return ptr - e->end + size <= e->limit; |
| 9826 | } |
| 9827 | |
| 9828 | UPB_INLINE bool _upb_EpsCopyInputStream_CheckSizeAvailable( |
| 9829 | upb_EpsCopyInputStream* e, const char* ptr, int size, bool submessage) { |
| 9830 | // This is one extra branch compared to the more normal: |
| 9831 | // return (size_t)(end - ptr) < size; |
| 9832 | // However it is one less computation if we are just about to use "ptr + len": |
| 9833 | // https://godbolt.org/z/35YGPz |
| 9834 | // In microbenchmarks this shows a small improvement. |
| 9835 | uintptr_t uptr = (uintptr_t)ptr; |
| 9836 | uintptr_t uend = (uintptr_t)e->limit_ptr; |
| 9837 | uintptr_t res = uptr + (size_t)size; |
| 9838 | if (!submessage) uend += kUpb_EpsCopyInputStream_SlopBytes; |
| 9839 | // NOTE: this check depends on having a linear address space. This is not |
| 9840 | // technically guaranteed by uintptr_t. |
| 9841 | bool ret = res >= uptr && res <= uend; |
| 9842 | if (size < 0) UPB_ASSERT(!ret); |
| 9843 | return ret; |
| 9844 | } |
| 9845 | |
| 9846 | // Returns true if the given delimited field size is valid (it does not extend |
| 9847 | // beyond any previously-pushed limited) *and* all of the data for this field is |
| 9848 | // available to be read in the current buffer. |
| 9849 | // |
| 9850 | // If the size is negative, this function will always return false. This |
| 9851 | // property can be useful in some cases. |
| 9852 | UPB_INLINE bool upb_EpsCopyInputStream_CheckDataSizeAvailable( |
| 9853 | upb_EpsCopyInputStream* e, const char* ptr, int size) { |
| 9854 | return _upb_EpsCopyInputStream_CheckSizeAvailable(e, ptr, size, false); |
| 9855 | } |
| 9856 | |
| 9857 | // Returns true if the given sub-message size is valid (it does not extend |
| 9858 | // beyond any previously-pushed limited) *and* all of the data for this |
| 9859 | // sub-message is available to be parsed in the current buffer. |
| 9860 | // |
| 9861 | // This implies that all fields from the sub-message can be parsed from the |
| 9862 | // current buffer while maintaining the invariant that we always have at least |
| 9863 | // kUpb_EpsCopyInputStream_SlopBytes of data available past the beginning of |
| 9864 | // any individual field start. |
| 9865 | // |
| 9866 | // If the size is negative, this function will always return false. This |
| 9867 | // property can be useful in some cases. |
| 9868 | UPB_INLINE bool upb_EpsCopyInputStream_CheckSubMessageSizeAvailable( |
| 9869 | upb_EpsCopyInputStream* e, const char* ptr, int size) { |
| 9870 | return _upb_EpsCopyInputStream_CheckSizeAvailable(e, ptr, size, true); |
| 9871 | } |
| 9872 | |
| 9873 | // Returns true if aliasing_enabled=true was passed to |
| 9874 | // upb_EpsCopyInputStream_Init() when this stream was initialized. |
| 9875 | UPB_INLINE bool upb_EpsCopyInputStream_AliasingEnabled( |
| 9876 | upb_EpsCopyInputStream* e) { |
| 9877 | return e->aliasing != kUpb_EpsCopyInputStream_NoAliasing; |
| 9878 | } |
| 9879 | |
| 9880 | // Returns true if aliasing_enabled=true was passed to |
| 9881 | // upb_EpsCopyInputStream_Init() when this stream was initialized *and* we can |
| 9882 | // alias into the region [ptr, size] in an input buffer. |
| 9883 | UPB_INLINE bool upb_EpsCopyInputStream_AliasingAvailable( |
| 9884 | upb_EpsCopyInputStream* e, const char* ptr, size_t size) { |
| 9885 | // When EpsCopyInputStream supports streaming, this will need to become a |
| 9886 | // runtime check. |
| 9887 | return upb_EpsCopyInputStream_CheckDataSizeAvailable(e, ptr, size) && |
| 9888 | e->aliasing >= kUpb_EpsCopyInputStream_NoDelta; |
| 9889 | } |
| 9890 | |
| 9891 | // Returns a pointer into an input buffer that corresponds to the parsing |
| 9892 | // pointer `ptr`. The returned pointer may be the same as `ptr`, but also may |
| 9893 | // be different if we are currently parsing out of the patch buffer. |
| 9894 | // |
| 9895 | // REQUIRES: Aliasing must be available for the given pointer. If the input is a |
| 9896 | // flat buffer and aliasing is enabled, then aliasing will always be available. |
| 9897 | UPB_INLINE const char* upb_EpsCopyInputStream_GetAliasedPtr( |
| 9898 | upb_EpsCopyInputStream* e, const char* ptr) { |
| 9899 | UPB_ASSUME(upb_EpsCopyInputStream_AliasingAvailable(e, ptr, 0)); |
| 9900 | uintptr_t delta = |
| 9901 | e->aliasing == kUpb_EpsCopyInputStream_NoDelta ? 0 : e->aliasing; |
| 9902 | return (const char*)((uintptr_t)ptr + delta); |
| 9903 | } |
| 9904 | |
| 9905 | // Reads string data from the input, aliasing into the input buffer instead of |
| 9906 | // copying. The parsing pointer is passed in `*ptr`, and will be updated if |
| 9907 | // necessary to point to the actual input buffer. Returns the new parsing |
| 9908 | // pointer, which will be advanced past the string data. |
| 9909 | // |
| 9910 | // REQUIRES: Aliasing must be available for this data region (test with |
| 9911 | // upb_EpsCopyInputStream_AliasingAvailable(). |
| 9912 | UPB_INLINE const char* upb_EpsCopyInputStream_ReadStringAliased( |
| 9913 | upb_EpsCopyInputStream* e, const char** ptr, size_t size) { |
| 9914 | UPB_ASSUME(upb_EpsCopyInputStream_AliasingAvailable(e, *ptr, size)); |
| 9915 | const char* ret = *ptr + size; |
| 9916 | *ptr = upb_EpsCopyInputStream_GetAliasedPtr(e, *ptr); |
| 9917 | UPB_ASSUME(ret != NULL); |
| 9918 | return ret; |
| 9919 | } |
| 9920 | |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 9921 | // Skips `size` bytes of data from the input and returns a pointer past the end. |
| 9922 | // Returns NULL on end of stream or error. |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9923 | UPB_INLINE const char* upb_EpsCopyInputStream_Skip(upb_EpsCopyInputStream* e, |
| 9924 | const char* ptr, int size) { |
| 9925 | if (!upb_EpsCopyInputStream_CheckDataSizeAvailable(e, ptr, size)) return NULL; |
| 9926 | return ptr + size; |
| 9927 | } |
| 9928 | |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 9929 | // Copies `size` bytes of data from the input `ptr` into the buffer `to`, and |
| 9930 | // returns a pointer past the end. Returns NULL on end of stream or error. |
| 9931 | UPB_INLINE const char* upb_EpsCopyInputStream_Copy(upb_EpsCopyInputStream* e, |
| 9932 | const char* ptr, void* to, |
| 9933 | int size) { |
| 9934 | if (!upb_EpsCopyInputStream_CheckDataSizeAvailable(e, ptr, size)) return NULL; |
| 9935 | memcpy(to, ptr, size); |
| 9936 | return ptr + size; |
| 9937 | } |
| 9938 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9939 | // Reads string data from the stream and advances the pointer accordingly. |
| 9940 | // If aliasing was enabled when the stream was initialized, then the returned |
| 9941 | // pointer will point into the input buffer if possible, otherwise new data |
| 9942 | // will be allocated from arena and copied into. We may be forced to copy even |
| 9943 | // if aliasing was enabled if the input data spans input buffers. |
| 9944 | // |
| 9945 | // Returns NULL if memory allocation failed, or we reached a premature EOF. |
| 9946 | UPB_INLINE const char* upb_EpsCopyInputStream_ReadString( |
| 9947 | upb_EpsCopyInputStream* e, const char** ptr, size_t size, |
| 9948 | upb_Arena* arena) { |
| 9949 | if (upb_EpsCopyInputStream_AliasingAvailable(e, *ptr, size)) { |
| 9950 | return upb_EpsCopyInputStream_ReadStringAliased(e, ptr, size); |
| 9951 | } else { |
| 9952 | // We need to allocate and copy. |
| 9953 | if (!upb_EpsCopyInputStream_CheckDataSizeAvailable(e, *ptr, size)) { |
| 9954 | return NULL; |
| 9955 | } |
| 9956 | UPB_ASSERT(arena); |
| 9957 | char* data = (char*)upb_Arena_Malloc(arena, size); |
| 9958 | if (!data) return NULL; |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 9959 | const char* ret = upb_EpsCopyInputStream_Copy(e, *ptr, data, size); |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9960 | *ptr = data; |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9961 | return ret; |
| 9962 | } |
| 9963 | } |
| 9964 | |
| 9965 | UPB_INLINE void _upb_EpsCopyInputStream_CheckLimit(upb_EpsCopyInputStream* e) { |
| 9966 | UPB_ASSERT(e->limit_ptr == e->end + UPB_MIN(0, e->limit)); |
| 9967 | } |
| 9968 | |
| 9969 | // Pushes a limit onto the stack of limits for the current stream. The limit |
| 9970 | // will extend for `size` bytes beyond the position in `ptr`. Future calls to |
| 9971 | // upb_EpsCopyInputStream_IsDone() will return `true` when the stream position |
| 9972 | // reaches this limit. |
| 9973 | // |
| 9974 | // Returns a delta that the caller must store and supply to PopLimit() below. |
| 9975 | UPB_INLINE int upb_EpsCopyInputStream_PushLimit(upb_EpsCopyInputStream* e, |
| 9976 | const char* ptr, int size) { |
| 9977 | int limit = size + (int)(ptr - e->end); |
| 9978 | int delta = e->limit - limit; |
| 9979 | _upb_EpsCopyInputStream_CheckLimit(e); |
Deanna Garcia | 59cfc2f | 2023-01-31 13:19:28 -0800 | [diff] [blame] | 9980 | UPB_ASSERT(limit <= e->limit); |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 9981 | e->limit = limit; |
| 9982 | e->limit_ptr = e->end + UPB_MIN(0, limit); |
| 9983 | _upb_EpsCopyInputStream_CheckLimit(e); |
| 9984 | return delta; |
| 9985 | } |
| 9986 | |
| 9987 | // Pops the last limit that was pushed on this stream. This may only be called |
| 9988 | // once IsDone() returns true. The user must pass the delta that was returned |
| 9989 | // from PushLimit(). |
| 9990 | UPB_INLINE void upb_EpsCopyInputStream_PopLimit(upb_EpsCopyInputStream* e, |
| 9991 | const char* ptr, |
| 9992 | int saved_delta) { |
| 9993 | UPB_ASSERT(ptr - e->end == e->limit); |
| 9994 | _upb_EpsCopyInputStream_CheckLimit(e); |
| 9995 | e->limit += saved_delta; |
| 9996 | e->limit_ptr = e->end + UPB_MIN(0, e->limit); |
| 9997 | _upb_EpsCopyInputStream_CheckLimit(e); |
| 9998 | } |
| 9999 | |
| 10000 | UPB_INLINE const char* _upb_EpsCopyInputStream_IsDoneFallbackInline( |
| 10001 | upb_EpsCopyInputStream* e, const char* ptr, int overrun, |
| 10002 | upb_EpsCopyInputStream_BufferFlipCallback* callback) { |
| 10003 | if (overrun < e->limit) { |
| 10004 | // Need to copy remaining data into patch buffer. |
| 10005 | UPB_ASSERT(overrun < kUpb_EpsCopyInputStream_SlopBytes); |
| 10006 | const char* old_end = ptr; |
| 10007 | const char* new_start = &e->patch[0] + overrun; |
| 10008 | memset(e->patch + kUpb_EpsCopyInputStream_SlopBytes, 0, |
| 10009 | kUpb_EpsCopyInputStream_SlopBytes); |
| 10010 | memcpy(e->patch, e->end, kUpb_EpsCopyInputStream_SlopBytes); |
| 10011 | ptr = new_start; |
| 10012 | e->end = &e->patch[kUpb_EpsCopyInputStream_SlopBytes]; |
| 10013 | e->limit -= kUpb_EpsCopyInputStream_SlopBytes; |
| 10014 | e->limit_ptr = e->end + e->limit; |
| 10015 | UPB_ASSERT(ptr < e->limit_ptr); |
| 10016 | if (e->aliasing != kUpb_EpsCopyInputStream_NoAliasing) { |
| 10017 | e->aliasing = (uintptr_t)old_end - (uintptr_t)new_start; |
| 10018 | } |
| 10019 | return callback(e, old_end, new_start); |
| 10020 | } else { |
| 10021 | UPB_ASSERT(overrun > e->limit); |
| 10022 | e->error = true; |
| 10023 | return callback(e, NULL, NULL); |
| 10024 | } |
| 10025 | } |
| 10026 | |
| 10027 | typedef const char* upb_EpsCopyInputStream_ParseDelimitedFunc( |
| 10028 | upb_EpsCopyInputStream* e, const char* ptr, void* ctx); |
| 10029 | |
| 10030 | // Tries to perform a fast-path handling of the given delimited message data. |
| 10031 | // If the sub-message beginning at `*ptr` and extending for `len` is short and |
| 10032 | // fits within this buffer, calls `func` with `ctx` as a parameter, where the |
| 10033 | // pushing and popping of limits is handled automatically and with lower cost |
| 10034 | // than the normal PushLimit()/PopLimit() sequence. |
| 10035 | static UPB_FORCEINLINE bool upb_EpsCopyInputStream_TryParseDelimitedFast( |
| 10036 | upb_EpsCopyInputStream* e, const char** ptr, int len, |
| 10037 | upb_EpsCopyInputStream_ParseDelimitedFunc* func, void* ctx) { |
| 10038 | if (!upb_EpsCopyInputStream_CheckSubMessageSizeAvailable(e, *ptr, len)) { |
| 10039 | return false; |
| 10040 | } |
| 10041 | |
| 10042 | // Fast case: Sub-message is <128 bytes and fits in the current buffer. |
| 10043 | // This means we can preserve limit/limit_ptr verbatim. |
| 10044 | const char* saved_limit_ptr = e->limit_ptr; |
| 10045 | int saved_limit = e->limit; |
| 10046 | e->limit_ptr = *ptr + len; |
| 10047 | e->limit = e->limit_ptr - e->end; |
| 10048 | UPB_ASSERT(e->limit_ptr == e->end + UPB_MIN(0, e->limit)); |
| 10049 | *ptr = func(e, *ptr, ctx); |
| 10050 | e->limit_ptr = saved_limit_ptr; |
| 10051 | e->limit = saved_limit; |
| 10052 | UPB_ASSERT(e->limit_ptr == e->end + UPB_MIN(0, e->limit)); |
| 10053 | return true; |
| 10054 | } |
| 10055 | |
| 10056 | #ifdef __cplusplus |
| 10057 | } /* extern "C" */ |
| 10058 | #endif |
| 10059 | |
| 10060 | |
| 10061 | #endif // UPB_WIRE_EPS_COPY_INPUT_STREAM_H_ |
| 10062 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10063 | #ifndef UPB_HASH_INT_TABLE_H_ |
| 10064 | #define UPB_HASH_INT_TABLE_H_ |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10065 | |
| 10066 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10067 | // Must be last. |
| 10068 | |
| 10069 | typedef struct { |
| 10070 | upb_table t; // For entries that don't fit in the array part. |
| 10071 | const upb_tabval* array; // Array part of the table. See const note above. |
| 10072 | size_t array_size; // Array part size. |
| 10073 | size_t array_count; // Array part number of elements. |
| 10074 | } upb_inttable; |
| 10075 | |
| 10076 | #ifdef __cplusplus |
| 10077 | extern "C" { |
| 10078 | #endif |
| 10079 | |
| 10080 | // Initialize a table. If memory allocation failed, false is returned and |
| 10081 | // the table is uninitialized. |
| 10082 | bool upb_inttable_init(upb_inttable* table, upb_Arena* a); |
| 10083 | |
| 10084 | // Returns the number of values in the table. |
| 10085 | size_t upb_inttable_count(const upb_inttable* t); |
| 10086 | |
| 10087 | // Inserts the given key into the hashtable with the given value. |
| 10088 | // The key must not already exist in the hash table. |
| 10089 | // The value must not be UINTPTR_MAX. |
| 10090 | // |
| 10091 | // If a table resize was required but memory allocation failed, false is |
| 10092 | // returned and the table is unchanged. |
| 10093 | bool upb_inttable_insert(upb_inttable* t, uintptr_t key, upb_value val, |
| 10094 | upb_Arena* a); |
| 10095 | |
| 10096 | // Looks up key in this table, returning "true" if the key was found. |
| 10097 | // If v is non-NULL, copies the value for this key into *v. |
| 10098 | bool upb_inttable_lookup(const upb_inttable* t, uintptr_t key, upb_value* v); |
| 10099 | |
| 10100 | // Removes an item from the table. Returns true if the remove was successful, |
| 10101 | // and stores the removed item in *val if non-NULL. |
| 10102 | bool upb_inttable_remove(upb_inttable* t, uintptr_t key, upb_value* val); |
| 10103 | |
| 10104 | // Updates an existing entry in an inttable. |
| 10105 | // If the entry does not exist, returns false and does nothing. |
| 10106 | // Unlike insert/remove, this does not invalidate iterators. |
| 10107 | bool upb_inttable_replace(upb_inttable* t, uintptr_t key, upb_value val); |
| 10108 | |
| 10109 | // Optimizes the table for the current set of entries, for both memory use and |
| 10110 | // lookup time. Client should call this after all entries have been inserted; |
| 10111 | // inserting more entries is legal, but will likely require a table resize. |
| 10112 | void upb_inttable_compact(upb_inttable* t, upb_Arena* a); |
| 10113 | |
| 10114 | // Iteration over inttable: |
| 10115 | // |
| 10116 | // intptr_t iter = UPB_INTTABLE_BEGIN; |
| 10117 | // uintptr_t key; |
| 10118 | // upb_value val; |
| 10119 | // while (upb_inttable_next(t, &key, &val, &iter)) { |
| 10120 | // // ... |
| 10121 | // } |
| 10122 | |
| 10123 | #define UPB_INTTABLE_BEGIN -1 |
| 10124 | |
| 10125 | bool upb_inttable_next(const upb_inttable* t, uintptr_t* key, upb_value* val, |
| 10126 | intptr_t* iter); |
| 10127 | void upb_inttable_removeiter(upb_inttable* t, intptr_t* iter); |
| 10128 | |
| 10129 | #ifdef __cplusplus |
| 10130 | } /* extern "C" */ |
| 10131 | #endif |
| 10132 | |
| 10133 | |
| 10134 | #endif /* UPB_HASH_INT_TABLE_H_ */ |
| 10135 | |
| 10136 | #ifndef UPB_JSON_DECODE_H_ |
| 10137 | #define UPB_JSON_DECODE_H_ |
| 10138 | |
| 10139 | |
| 10140 | #ifndef UPB_REFLECTION_DEF_H_ |
| 10141 | #define UPB_REFLECTION_DEF_H_ |
| 10142 | |
| 10143 | |
| 10144 | // IWYU pragma: private, include "upb/reflection/def.h" |
| 10145 | |
| 10146 | #ifndef UPB_REFLECTION_DEF_POOL_H_ |
| 10147 | #define UPB_REFLECTION_DEF_POOL_H_ |
| 10148 | |
| 10149 | |
| 10150 | // IWYU pragma: private, include "upb/reflection/def.h" |
| 10151 | |
| 10152 | // Declarations common to all public def types. |
| 10153 | |
| 10154 | #ifndef UPB_REFLECTION_COMMON_H_ |
| 10155 | #define UPB_REFLECTION_COMMON_H_ |
| 10156 | |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 10157 | // begin:google_only |
| 10158 | // #ifndef UPB_BOOTSTRAP_STAGE0 |
| 10159 | // #include "net/proto2/proto/descriptor.upb.h" |
| 10160 | // #else |
| 10161 | // #include "google/protobuf/descriptor.upb.h" |
| 10162 | // #endif |
| 10163 | // end:google_only |
| 10164 | |
| 10165 | // begin:github_only |
| 10166 | // end:github_only |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10167 | |
| 10168 | typedef enum { kUpb_Syntax_Proto2 = 2, kUpb_Syntax_Proto3 = 3 } upb_Syntax; |
| 10169 | |
| 10170 | // Forward declarations for circular references. |
| 10171 | typedef struct upb_DefPool upb_DefPool; |
| 10172 | typedef struct upb_EnumDef upb_EnumDef; |
| 10173 | typedef struct upb_EnumReservedRange upb_EnumReservedRange; |
| 10174 | typedef struct upb_EnumValueDef upb_EnumValueDef; |
| 10175 | typedef struct upb_ExtensionRange upb_ExtensionRange; |
| 10176 | typedef struct upb_FieldDef upb_FieldDef; |
| 10177 | typedef struct upb_FileDef upb_FileDef; |
| 10178 | typedef struct upb_MessageDef upb_MessageDef; |
| 10179 | typedef struct upb_MessageReservedRange upb_MessageReservedRange; |
| 10180 | typedef struct upb_MethodDef upb_MethodDef; |
| 10181 | typedef struct upb_OneofDef upb_OneofDef; |
| 10182 | typedef struct upb_ServiceDef upb_ServiceDef; |
| 10183 | |
| 10184 | // EVERYTHING BELOW THIS LINE IS INTERNAL - DO NOT USE ///////////////////////// |
| 10185 | |
| 10186 | typedef struct upb_DefBuilder upb_DefBuilder; |
| 10187 | |
| 10188 | #endif /* UPB_REFLECTION_COMMON_H_ */ |
| 10189 | |
| 10190 | #ifndef UPB_REFLECTION_DEF_TYPE_H_ |
| 10191 | #define UPB_REFLECTION_DEF_TYPE_H_ |
| 10192 | |
| 10193 | |
| 10194 | // Must be last. |
| 10195 | |
| 10196 | // Inside a symtab we store tagged pointers to specific def types. |
| 10197 | typedef enum { |
| 10198 | UPB_DEFTYPE_MASK = 7, |
| 10199 | |
| 10200 | // Only inside symtab table. |
| 10201 | UPB_DEFTYPE_EXT = 0, |
| 10202 | UPB_DEFTYPE_MSG = 1, |
| 10203 | UPB_DEFTYPE_ENUM = 2, |
| 10204 | UPB_DEFTYPE_ENUMVAL = 3, |
| 10205 | UPB_DEFTYPE_SERVICE = 4, |
| 10206 | |
| 10207 | // Only inside message table. |
| 10208 | UPB_DEFTYPE_FIELD = 0, |
| 10209 | UPB_DEFTYPE_ONEOF = 1, |
| 10210 | UPB_DEFTYPE_FIELD_JSONNAME = 2, |
| 10211 | } upb_deftype_t; |
| 10212 | |
| 10213 | #ifdef __cplusplus |
| 10214 | extern "C" { |
| 10215 | #endif |
| 10216 | |
| 10217 | // Our 3-bit pointer tagging requires all pointers to be multiples of 8. |
| 10218 | // The arena will always yield 8-byte-aligned addresses, however we put |
| 10219 | // the defs into arrays. For each element in the array to be 8-byte-aligned, |
| 10220 | // the sizes of each def type must also be a multiple of 8. |
| 10221 | // |
| 10222 | // If any of these asserts fail, we need to add or remove padding on 32-bit |
| 10223 | // machines (64-bit machines will have 8-byte alignment already due to |
| 10224 | // pointers, which all of these structs have). |
| 10225 | UPB_INLINE void _upb_DefType_CheckPadding(size_t size) { |
| 10226 | UPB_ASSERT((size & UPB_DEFTYPE_MASK) == 0); |
| 10227 | } |
| 10228 | |
| 10229 | upb_deftype_t _upb_DefType_Type(upb_value v); |
| 10230 | |
| 10231 | upb_value _upb_DefType_Pack(const void* ptr, upb_deftype_t type); |
| 10232 | |
| 10233 | const void* _upb_DefType_Unpack(upb_value v, upb_deftype_t type); |
| 10234 | |
| 10235 | #ifdef __cplusplus |
| 10236 | } /* extern "C" */ |
| 10237 | #endif |
| 10238 | |
| 10239 | |
| 10240 | #endif /* UPB_REFLECTION_DEF_TYPE_H_ */ |
| 10241 | |
| 10242 | // Must be last. |
| 10243 | |
| 10244 | #ifdef __cplusplus |
| 10245 | extern "C" { |
| 10246 | #endif |
| 10247 | |
| 10248 | void upb_DefPool_Free(upb_DefPool* s); |
| 10249 | |
| 10250 | upb_DefPool* upb_DefPool_New(void); |
| 10251 | |
| 10252 | const upb_MessageDef* upb_DefPool_FindMessageByName(const upb_DefPool* s, |
| 10253 | const char* sym); |
| 10254 | |
| 10255 | const upb_MessageDef* upb_DefPool_FindMessageByNameWithSize( |
| 10256 | const upb_DefPool* s, const char* sym, size_t len); |
| 10257 | |
| 10258 | const upb_EnumDef* upb_DefPool_FindEnumByName(const upb_DefPool* s, |
| 10259 | const char* sym); |
| 10260 | |
| 10261 | const upb_EnumValueDef* upb_DefPool_FindEnumByNameval(const upb_DefPool* s, |
| 10262 | const char* sym); |
| 10263 | |
| 10264 | const upb_FileDef* upb_DefPool_FindFileByName(const upb_DefPool* s, |
| 10265 | const char* name); |
| 10266 | |
| 10267 | const upb_FileDef* upb_DefPool_FindFileByNameWithSize(const upb_DefPool* s, |
| 10268 | const char* name, |
| 10269 | size_t len); |
| 10270 | |
| 10271 | const upb_FieldDef* upb_DefPool_FindExtensionByMiniTable( |
| 10272 | const upb_DefPool* s, const upb_MiniTableExtension* ext); |
| 10273 | |
| 10274 | const upb_FieldDef* upb_DefPool_FindExtensionByName(const upb_DefPool* s, |
| 10275 | const char* sym); |
| 10276 | |
| 10277 | const upb_FieldDef* upb_DefPool_FindExtensionByNameWithSize( |
| 10278 | const upb_DefPool* s, const char* name, size_t size); |
| 10279 | |
| 10280 | const upb_FieldDef* upb_DefPool_FindExtensionByNumber(const upb_DefPool* s, |
| 10281 | const upb_MessageDef* m, |
| 10282 | int32_t fieldnum); |
| 10283 | |
| 10284 | const upb_ServiceDef* upb_DefPool_FindServiceByName(const upb_DefPool* s, |
| 10285 | const char* name); |
| 10286 | |
| 10287 | const upb_ServiceDef* upb_DefPool_FindServiceByNameWithSize( |
| 10288 | const upb_DefPool* s, const char* name, size_t size); |
| 10289 | |
| 10290 | const upb_FileDef* upb_DefPool_FindFileContainingSymbol(const upb_DefPool* s, |
| 10291 | const char* name); |
| 10292 | |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 10293 | const upb_FileDef* upb_DefPool_AddFile(upb_DefPool* s, |
| 10294 | const UPB_DESC(FileDescriptorProto) * |
| 10295 | file_proto, |
| 10296 | upb_Status* status); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10297 | |
| 10298 | const upb_ExtensionRegistry* upb_DefPool_ExtensionRegistry( |
| 10299 | const upb_DefPool* s); |
| 10300 | |
| 10301 | const upb_FieldDef** upb_DefPool_GetAllExtensions(const upb_DefPool* s, |
| 10302 | const upb_MessageDef* m, |
| 10303 | size_t* count); |
| 10304 | |
| 10305 | #ifdef __cplusplus |
| 10306 | } /* extern "C" */ |
| 10307 | #endif |
| 10308 | |
| 10309 | |
| 10310 | #endif /* UPB_REFLECTION_DEF_POOL_H_ */ |
| 10311 | |
| 10312 | // IWYU pragma: private, include "upb/reflection/def.h" |
| 10313 | |
| 10314 | #ifndef UPB_REFLECTION_ENUM_DEF_H_ |
| 10315 | #define UPB_REFLECTION_ENUM_DEF_H_ |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10316 | |
| 10317 | |
| 10318 | // Must be last. |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10319 | |
| 10320 | #ifdef __cplusplus |
| 10321 | extern "C" { |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 10322 | #endif |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 10323 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10324 | bool upb_EnumDef_CheckNumber(const upb_EnumDef* e, int32_t num); |
| 10325 | const upb_MessageDef* upb_EnumDef_ContainingType(const upb_EnumDef* e); |
| 10326 | int32_t upb_EnumDef_Default(const upb_EnumDef* e); |
| 10327 | const upb_FileDef* upb_EnumDef_File(const upb_EnumDef* e); |
| 10328 | const upb_EnumValueDef* upb_EnumDef_FindValueByName(const upb_EnumDef* e, |
| 10329 | const char* name); |
| 10330 | const upb_EnumValueDef* upb_EnumDef_FindValueByNameWithSize( |
| 10331 | const upb_EnumDef* e, const char* name, size_t size); |
| 10332 | const upb_EnumValueDef* upb_EnumDef_FindValueByNumber(const upb_EnumDef* e, |
| 10333 | int32_t num); |
| 10334 | const char* upb_EnumDef_FullName(const upb_EnumDef* e); |
| 10335 | bool upb_EnumDef_HasOptions(const upb_EnumDef* e); |
| 10336 | bool upb_EnumDef_IsClosed(const upb_EnumDef* e); |
| 10337 | |
| 10338 | // Creates a mini descriptor string for an enum, returns true on success. |
| 10339 | bool upb_EnumDef_MiniDescriptorEncode(const upb_EnumDef* e, upb_Arena* a, |
| 10340 | upb_StringView* out); |
| 10341 | |
| 10342 | const char* upb_EnumDef_Name(const upb_EnumDef* e); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 10343 | const UPB_DESC(EnumOptions) * upb_EnumDef_Options(const upb_EnumDef* e); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10344 | |
| 10345 | upb_StringView upb_EnumDef_ReservedName(const upb_EnumDef* e, int i); |
| 10346 | int upb_EnumDef_ReservedNameCount(const upb_EnumDef* e); |
| 10347 | |
| 10348 | const upb_EnumReservedRange* upb_EnumDef_ReservedRange(const upb_EnumDef* e, |
| 10349 | int i); |
| 10350 | int upb_EnumDef_ReservedRangeCount(const upb_EnumDef* e); |
| 10351 | |
| 10352 | const upb_EnumValueDef* upb_EnumDef_Value(const upb_EnumDef* e, int i); |
| 10353 | int upb_EnumDef_ValueCount(const upb_EnumDef* e); |
| 10354 | |
| 10355 | #ifdef __cplusplus |
| 10356 | } /* extern "C" */ |
| 10357 | #endif |
| 10358 | |
| 10359 | |
| 10360 | #endif /* UPB_REFLECTION_ENUM_DEF_H_ */ |
| 10361 | |
| 10362 | // IWYU pragma: private, include "upb/reflection/def.h" |
| 10363 | |
| 10364 | #ifndef UPB_REFLECTION_ENUM_VALUE_DEF_H_ |
| 10365 | #define UPB_REFLECTION_ENUM_VALUE_DEF_H_ |
| 10366 | |
| 10367 | |
| 10368 | // Must be last. |
| 10369 | |
| 10370 | #ifdef __cplusplus |
| 10371 | extern "C" { |
| 10372 | #endif |
| 10373 | |
| 10374 | const upb_EnumDef* upb_EnumValueDef_Enum(const upb_EnumValueDef* v); |
| 10375 | const char* upb_EnumValueDef_FullName(const upb_EnumValueDef* v); |
| 10376 | bool upb_EnumValueDef_HasOptions(const upb_EnumValueDef* v); |
| 10377 | uint32_t upb_EnumValueDef_Index(const upb_EnumValueDef* v); |
| 10378 | const char* upb_EnumValueDef_Name(const upb_EnumValueDef* v); |
| 10379 | int32_t upb_EnumValueDef_Number(const upb_EnumValueDef* v); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 10380 | const UPB_DESC(EnumValueOptions) * |
| 10381 | upb_EnumValueDef_Options(const upb_EnumValueDef* v); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10382 | |
| 10383 | #ifdef __cplusplus |
| 10384 | } /* extern "C" */ |
| 10385 | #endif |
| 10386 | |
| 10387 | |
| 10388 | #endif /* UPB_REFLECTION_ENUM_VALUE_DEF_H_ */ |
| 10389 | |
| 10390 | // IWYU pragma: private, include "upb/reflection/def.h" |
| 10391 | |
| 10392 | #ifndef UPB_REFLECTION_EXTENSION_RANGE_H_ |
| 10393 | #define UPB_REFLECTION_EXTENSION_RANGE_H_ |
| 10394 | |
| 10395 | |
| 10396 | // Must be last. |
| 10397 | |
| 10398 | #ifdef __cplusplus |
| 10399 | extern "C" { |
| 10400 | #endif |
| 10401 | |
| 10402 | int32_t upb_ExtensionRange_Start(const upb_ExtensionRange* r); |
| 10403 | int32_t upb_ExtensionRange_End(const upb_ExtensionRange* r); |
| 10404 | |
| 10405 | bool upb_ExtensionRange_HasOptions(const upb_ExtensionRange* r); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 10406 | const UPB_DESC(ExtensionRangeOptions) * |
| 10407 | upb_ExtensionRange_Options(const upb_ExtensionRange* r); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10408 | |
| 10409 | #ifdef __cplusplus |
| 10410 | } /* extern "C" */ |
| 10411 | #endif |
| 10412 | |
| 10413 | |
| 10414 | #endif /* UPB_REFLECTION_EXTENSION_RANGE_H_ */ |
| 10415 | |
| 10416 | // IWYU pragma: private, include "upb/reflection/def.h" |
| 10417 | |
| 10418 | #ifndef UPB_REFLECTION_FIELD_DEF_H_ |
| 10419 | #define UPB_REFLECTION_FIELD_DEF_H_ |
| 10420 | |
| 10421 | |
| 10422 | // Must be last. |
| 10423 | |
| 10424 | // Maximum field number allowed for FieldDefs. |
| 10425 | // This is an inherent limit of the protobuf wire format. |
| 10426 | #define kUpb_MaxFieldNumber ((1 << 29) - 1) |
| 10427 | |
| 10428 | #ifdef __cplusplus |
| 10429 | extern "C" { |
| 10430 | #endif |
| 10431 | |
| 10432 | const upb_OneofDef* upb_FieldDef_ContainingOneof(const upb_FieldDef* f); |
| 10433 | const upb_MessageDef* upb_FieldDef_ContainingType(const upb_FieldDef* f); |
| 10434 | upb_CType upb_FieldDef_CType(const upb_FieldDef* f); |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 10435 | upb_MessageValue upb_FieldDef_Default(const upb_FieldDef* f); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10436 | const upb_EnumDef* upb_FieldDef_EnumSubDef(const upb_FieldDef* f); |
| 10437 | const upb_MessageDef* upb_FieldDef_ExtensionScope(const upb_FieldDef* f); |
| 10438 | const upb_FileDef* upb_FieldDef_File(const upb_FieldDef* f); |
| 10439 | const char* upb_FieldDef_FullName(const upb_FieldDef* f); |
| 10440 | bool upb_FieldDef_HasDefault(const upb_FieldDef* f); |
| 10441 | bool upb_FieldDef_HasJsonName(const upb_FieldDef* f); |
| 10442 | bool upb_FieldDef_HasOptions(const upb_FieldDef* f); |
| 10443 | bool upb_FieldDef_HasPresence(const upb_FieldDef* f); |
| 10444 | bool upb_FieldDef_HasSubDef(const upb_FieldDef* f); |
| 10445 | uint32_t upb_FieldDef_Index(const upb_FieldDef* f); |
| 10446 | bool upb_FieldDef_IsExtension(const upb_FieldDef* f); |
| 10447 | bool upb_FieldDef_IsMap(const upb_FieldDef* f); |
| 10448 | bool upb_FieldDef_IsOptional(const upb_FieldDef* f); |
| 10449 | bool upb_FieldDef_IsPacked(const upb_FieldDef* f); |
| 10450 | bool upb_FieldDef_IsPrimitive(const upb_FieldDef* f); |
| 10451 | bool upb_FieldDef_IsRepeated(const upb_FieldDef* f); |
| 10452 | bool upb_FieldDef_IsRequired(const upb_FieldDef* f); |
| 10453 | bool upb_FieldDef_IsString(const upb_FieldDef* f); |
| 10454 | bool upb_FieldDef_IsSubMessage(const upb_FieldDef* f); |
| 10455 | const char* upb_FieldDef_JsonName(const upb_FieldDef* f); |
| 10456 | upb_Label upb_FieldDef_Label(const upb_FieldDef* f); |
| 10457 | const upb_MessageDef* upb_FieldDef_MessageSubDef(const upb_FieldDef* f); |
| 10458 | |
| 10459 | // Creates a mini descriptor string for a field, returns true on success. |
| 10460 | bool upb_FieldDef_MiniDescriptorEncode(const upb_FieldDef* f, upb_Arena* a, |
| 10461 | upb_StringView* out); |
| 10462 | |
| 10463 | const upb_MiniTableField* upb_FieldDef_MiniTable(const upb_FieldDef* f); |
| 10464 | const char* upb_FieldDef_Name(const upb_FieldDef* f); |
| 10465 | uint32_t upb_FieldDef_Number(const upb_FieldDef* f); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 10466 | const UPB_DESC(FieldOptions) * upb_FieldDef_Options(const upb_FieldDef* f); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10467 | const upb_OneofDef* upb_FieldDef_RealContainingOneof(const upb_FieldDef* f); |
| 10468 | upb_FieldType upb_FieldDef_Type(const upb_FieldDef* f); |
| 10469 | |
| 10470 | #ifdef __cplusplus |
| 10471 | } /* extern "C" */ |
| 10472 | #endif |
| 10473 | |
| 10474 | |
| 10475 | #endif /* UPB_REFLECTION_FIELD_DEF_H_ */ |
| 10476 | |
| 10477 | // IWYU pragma: private, include "upb/reflection/def.h" |
| 10478 | |
| 10479 | #ifndef UPB_REFLECTION_FILE_DEF_H_ |
| 10480 | #define UPB_REFLECTION_FILE_DEF_H_ |
| 10481 | |
| 10482 | |
| 10483 | // Must be last. |
| 10484 | |
| 10485 | #ifdef __cplusplus |
| 10486 | extern "C" { |
| 10487 | #endif |
| 10488 | |
| 10489 | const upb_FileDef* upb_FileDef_Dependency(const upb_FileDef* f, int i); |
| 10490 | int upb_FileDef_DependencyCount(const upb_FileDef* f); |
| 10491 | bool upb_FileDef_HasOptions(const upb_FileDef* f); |
| 10492 | const char* upb_FileDef_Name(const upb_FileDef* f); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 10493 | const UPB_DESC(FileOptions) * upb_FileDef_Options(const upb_FileDef* f); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10494 | const char* upb_FileDef_Package(const upb_FileDef* f); |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 10495 | const char* upb_FileDef_Edition(const upb_FileDef* f); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10496 | const upb_DefPool* upb_FileDef_Pool(const upb_FileDef* f); |
| 10497 | |
| 10498 | const upb_FileDef* upb_FileDef_PublicDependency(const upb_FileDef* f, int i); |
| 10499 | int upb_FileDef_PublicDependencyCount(const upb_FileDef* f); |
| 10500 | |
| 10501 | const upb_ServiceDef* upb_FileDef_Service(const upb_FileDef* f, int i); |
| 10502 | int upb_FileDef_ServiceCount(const upb_FileDef* f); |
| 10503 | |
| 10504 | upb_Syntax upb_FileDef_Syntax(const upb_FileDef* f); |
| 10505 | |
| 10506 | const upb_EnumDef* upb_FileDef_TopLevelEnum(const upb_FileDef* f, int i); |
| 10507 | int upb_FileDef_TopLevelEnumCount(const upb_FileDef* f); |
| 10508 | |
| 10509 | const upb_FieldDef* upb_FileDef_TopLevelExtension(const upb_FileDef* f, int i); |
| 10510 | int upb_FileDef_TopLevelExtensionCount(const upb_FileDef* f); |
| 10511 | |
| 10512 | const upb_MessageDef* upb_FileDef_TopLevelMessage(const upb_FileDef* f, int i); |
| 10513 | int upb_FileDef_TopLevelMessageCount(const upb_FileDef* f); |
| 10514 | |
| 10515 | const upb_FileDef* upb_FileDef_WeakDependency(const upb_FileDef* f, int i); |
| 10516 | int upb_FileDef_WeakDependencyCount(const upb_FileDef* f); |
| 10517 | |
| 10518 | #ifdef __cplusplus |
| 10519 | } /* extern "C" */ |
| 10520 | #endif |
| 10521 | |
| 10522 | |
| 10523 | #endif /* UPB_REFLECTION_FILE_DEF_H_ */ |
| 10524 | |
| 10525 | // IWYU pragma: private, include "upb/reflection/def.h" |
| 10526 | |
| 10527 | #ifndef UPB_REFLECTION_MESSAGE_DEF_H_ |
| 10528 | #define UPB_REFLECTION_MESSAGE_DEF_H_ |
| 10529 | |
| 10530 | |
| 10531 | // Must be last. |
| 10532 | |
| 10533 | // Well-known field tag numbers for map-entry messages. |
| 10534 | #define kUpb_MapEntry_KeyFieldNumber 1 |
| 10535 | #define kUpb_MapEntry_ValueFieldNumber 2 |
| 10536 | |
| 10537 | // Well-known field tag numbers for Any messages. |
| 10538 | #define kUpb_Any_TypeFieldNumber 1 |
| 10539 | #define kUpb_Any_ValueFieldNumber 2 |
| 10540 | |
| 10541 | // Well-known field tag numbers for duration messages. |
| 10542 | #define kUpb_Duration_SecondsFieldNumber 1 |
| 10543 | #define kUpb_Duration_NanosFieldNumber 2 |
| 10544 | |
| 10545 | // Well-known field tag numbers for timestamp messages. |
| 10546 | #define kUpb_Timestamp_SecondsFieldNumber 1 |
| 10547 | #define kUpb_Timestamp_NanosFieldNumber 2 |
| 10548 | |
| 10549 | // All the different kind of well known type messages. For simplicity of check, |
| 10550 | // number wrappers and string wrappers are grouped together. Make sure the |
| 10551 | // order and number of these groups are not changed. |
| 10552 | typedef enum { |
| 10553 | kUpb_WellKnown_Unspecified, |
| 10554 | kUpb_WellKnown_Any, |
| 10555 | kUpb_WellKnown_FieldMask, |
| 10556 | kUpb_WellKnown_Duration, |
| 10557 | kUpb_WellKnown_Timestamp, |
| 10558 | |
| 10559 | // number wrappers |
| 10560 | kUpb_WellKnown_DoubleValue, |
| 10561 | kUpb_WellKnown_FloatValue, |
| 10562 | kUpb_WellKnown_Int64Value, |
| 10563 | kUpb_WellKnown_UInt64Value, |
| 10564 | kUpb_WellKnown_Int32Value, |
| 10565 | kUpb_WellKnown_UInt32Value, |
| 10566 | |
| 10567 | // string wrappers |
| 10568 | kUpb_WellKnown_StringValue, |
| 10569 | kUpb_WellKnown_BytesValue, |
| 10570 | kUpb_WellKnown_BoolValue, |
| 10571 | kUpb_WellKnown_Value, |
| 10572 | kUpb_WellKnown_ListValue, |
| 10573 | kUpb_WellKnown_Struct, |
| 10574 | } upb_WellKnown; |
| 10575 | |
| 10576 | #ifdef __cplusplus |
| 10577 | extern "C" { |
| 10578 | #endif |
| 10579 | |
| 10580 | const upb_MessageDef* upb_MessageDef_ContainingType(const upb_MessageDef* m); |
| 10581 | |
| 10582 | const upb_ExtensionRange* upb_MessageDef_ExtensionRange(const upb_MessageDef* m, |
| 10583 | int i); |
| 10584 | int upb_MessageDef_ExtensionRangeCount(const upb_MessageDef* m); |
| 10585 | |
| 10586 | const upb_FieldDef* upb_MessageDef_Field(const upb_MessageDef* m, int i); |
| 10587 | int upb_MessageDef_FieldCount(const upb_MessageDef* m); |
| 10588 | |
| 10589 | const upb_FileDef* upb_MessageDef_File(const upb_MessageDef* m); |
| 10590 | |
| 10591 | // Returns a field by either JSON name or regular proto name. |
| 10592 | const upb_FieldDef* upb_MessageDef_FindByJsonNameWithSize( |
| 10593 | const upb_MessageDef* m, const char* name, size_t size); |
| 10594 | UPB_INLINE const upb_FieldDef* upb_MessageDef_FindByJsonName( |
| 10595 | const upb_MessageDef* m, const char* name) { |
| 10596 | return upb_MessageDef_FindByJsonNameWithSize(m, name, strlen(name)); |
| 10597 | } |
| 10598 | |
| 10599 | // Lookup of either field or oneof by name. Returns whether either was found. |
| 10600 | // If the return is true, then the found def will be set, and the non-found |
| 10601 | // one set to NULL. |
| 10602 | bool upb_MessageDef_FindByNameWithSize(const upb_MessageDef* m, |
| 10603 | const char* name, size_t size, |
| 10604 | const upb_FieldDef** f, |
| 10605 | const upb_OneofDef** o); |
| 10606 | UPB_INLINE bool upb_MessageDef_FindByName(const upb_MessageDef* m, |
| 10607 | const char* name, |
| 10608 | const upb_FieldDef** f, |
| 10609 | const upb_OneofDef** o) { |
| 10610 | return upb_MessageDef_FindByNameWithSize(m, name, strlen(name), f, o); |
| 10611 | } |
| 10612 | |
| 10613 | const upb_FieldDef* upb_MessageDef_FindFieldByName(const upb_MessageDef* m, |
| 10614 | const char* name); |
| 10615 | const upb_FieldDef* upb_MessageDef_FindFieldByNameWithSize( |
| 10616 | const upb_MessageDef* m, const char* name, size_t size); |
| 10617 | const upb_FieldDef* upb_MessageDef_FindFieldByNumber(const upb_MessageDef* m, |
| 10618 | uint32_t i); |
| 10619 | const upb_OneofDef* upb_MessageDef_FindOneofByName(const upb_MessageDef* m, |
| 10620 | const char* name); |
| 10621 | const upb_OneofDef* upb_MessageDef_FindOneofByNameWithSize( |
| 10622 | const upb_MessageDef* m, const char* name, size_t size); |
| 10623 | const char* upb_MessageDef_FullName(const upb_MessageDef* m); |
| 10624 | bool upb_MessageDef_HasOptions(const upb_MessageDef* m); |
| 10625 | bool upb_MessageDef_IsMapEntry(const upb_MessageDef* m); |
| 10626 | bool upb_MessageDef_IsMessageSet(const upb_MessageDef* m); |
| 10627 | |
| 10628 | // Creates a mini descriptor string for a message, returns true on success. |
| 10629 | bool upb_MessageDef_MiniDescriptorEncode(const upb_MessageDef* m, upb_Arena* a, |
| 10630 | upb_StringView* out); |
| 10631 | |
| 10632 | const upb_MiniTable* upb_MessageDef_MiniTable(const upb_MessageDef* m); |
| 10633 | const char* upb_MessageDef_Name(const upb_MessageDef* m); |
| 10634 | |
| 10635 | const upb_EnumDef* upb_MessageDef_NestedEnum(const upb_MessageDef* m, int i); |
| 10636 | const upb_FieldDef* upb_MessageDef_NestedExtension(const upb_MessageDef* m, |
| 10637 | int i); |
| 10638 | const upb_MessageDef* upb_MessageDef_NestedMessage(const upb_MessageDef* m, |
| 10639 | int i); |
| 10640 | |
| 10641 | int upb_MessageDef_NestedEnumCount(const upb_MessageDef* m); |
| 10642 | int upb_MessageDef_NestedExtensionCount(const upb_MessageDef* m); |
| 10643 | int upb_MessageDef_NestedMessageCount(const upb_MessageDef* m); |
| 10644 | |
| 10645 | const upb_OneofDef* upb_MessageDef_Oneof(const upb_MessageDef* m, int i); |
| 10646 | int upb_MessageDef_OneofCount(const upb_MessageDef* m); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 10647 | int upb_MessageDef_RealOneofCount(const upb_MessageDef* m); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10648 | |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 10649 | const UPB_DESC(MessageOptions) * |
| 10650 | upb_MessageDef_Options(const upb_MessageDef* m); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10651 | |
| 10652 | upb_StringView upb_MessageDef_ReservedName(const upb_MessageDef* m, int i); |
| 10653 | int upb_MessageDef_ReservedNameCount(const upb_MessageDef* m); |
| 10654 | |
| 10655 | const upb_MessageReservedRange* upb_MessageDef_ReservedRange( |
| 10656 | const upb_MessageDef* m, int i); |
| 10657 | int upb_MessageDef_ReservedRangeCount(const upb_MessageDef* m); |
| 10658 | |
| 10659 | upb_Syntax upb_MessageDef_Syntax(const upb_MessageDef* m); |
| 10660 | upb_WellKnown upb_MessageDef_WellKnownType(const upb_MessageDef* m); |
| 10661 | |
| 10662 | #ifdef __cplusplus |
| 10663 | } /* extern "C" */ |
| 10664 | #endif |
| 10665 | |
| 10666 | |
| 10667 | #endif /* UPB_REFLECTION_MESSAGE_DEF_H_ */ |
| 10668 | |
| 10669 | // IWYU pragma: private, include "upb/reflection/def.h" |
| 10670 | |
| 10671 | #ifndef UPB_REFLECTION_METHOD_DEF_H_ |
| 10672 | #define UPB_REFLECTION_METHOD_DEF_H_ |
| 10673 | |
| 10674 | |
| 10675 | // Must be last. |
| 10676 | |
| 10677 | #ifdef __cplusplus |
| 10678 | extern "C" { |
| 10679 | #endif |
| 10680 | |
| 10681 | bool upb_MethodDef_ClientStreaming(const upb_MethodDef* m); |
| 10682 | const char* upb_MethodDef_FullName(const upb_MethodDef* m); |
| 10683 | bool upb_MethodDef_HasOptions(const upb_MethodDef* m); |
| 10684 | int upb_MethodDef_Index(const upb_MethodDef* m); |
| 10685 | const upb_MessageDef* upb_MethodDef_InputType(const upb_MethodDef* m); |
| 10686 | const char* upb_MethodDef_Name(const upb_MethodDef* m); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 10687 | const UPB_DESC(MethodOptions) * upb_MethodDef_Options(const upb_MethodDef* m); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10688 | const upb_MessageDef* upb_MethodDef_OutputType(const upb_MethodDef* m); |
| 10689 | bool upb_MethodDef_ServerStreaming(const upb_MethodDef* m); |
| 10690 | const upb_ServiceDef* upb_MethodDef_Service(const upb_MethodDef* m); |
| 10691 | |
| 10692 | #ifdef __cplusplus |
| 10693 | } /* extern "C" */ |
| 10694 | #endif |
| 10695 | |
| 10696 | |
| 10697 | #endif /* UPB_REFLECTION_METHOD_DEF_H_ */ |
| 10698 | |
| 10699 | // IWYU pragma: private, include "upb/reflection/def.h" |
| 10700 | |
| 10701 | #ifndef UPB_REFLECTION_ONEOF_DEF_H_ |
| 10702 | #define UPB_REFLECTION_ONEOF_DEF_H_ |
| 10703 | |
| 10704 | |
| 10705 | // Must be last. |
| 10706 | |
| 10707 | #ifdef __cplusplus |
| 10708 | extern "C" { |
| 10709 | #endif |
| 10710 | |
| 10711 | const upb_MessageDef* upb_OneofDef_ContainingType(const upb_OneofDef* o); |
| 10712 | const upb_FieldDef* upb_OneofDef_Field(const upb_OneofDef* o, int i); |
| 10713 | int upb_OneofDef_FieldCount(const upb_OneofDef* o); |
| 10714 | const char* upb_OneofDef_FullName(const upb_OneofDef* o); |
| 10715 | bool upb_OneofDef_HasOptions(const upb_OneofDef* o); |
| 10716 | uint32_t upb_OneofDef_Index(const upb_OneofDef* o); |
| 10717 | bool upb_OneofDef_IsSynthetic(const upb_OneofDef* o); |
| 10718 | const upb_FieldDef* upb_OneofDef_LookupName(const upb_OneofDef* o, |
| 10719 | const char* name); |
| 10720 | const upb_FieldDef* upb_OneofDef_LookupNameWithSize(const upb_OneofDef* o, |
| 10721 | const char* name, |
| 10722 | size_t size); |
| 10723 | const upb_FieldDef* upb_OneofDef_LookupNumber(const upb_OneofDef* o, |
| 10724 | uint32_t num); |
| 10725 | const char* upb_OneofDef_Name(const upb_OneofDef* o); |
| 10726 | int upb_OneofDef_numfields(const upb_OneofDef* o); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 10727 | const UPB_DESC(OneofOptions) * upb_OneofDef_Options(const upb_OneofDef* o); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10728 | |
| 10729 | #ifdef __cplusplus |
| 10730 | } /* extern "C" */ |
| 10731 | #endif |
| 10732 | |
| 10733 | |
| 10734 | #endif /* UPB_REFLECTION_ONEOF_DEF_H_ */ |
| 10735 | |
| 10736 | // IWYU pragma: private, include "upb/reflection/def.h" |
| 10737 | |
| 10738 | #ifndef UPB_REFLECTION_SERVICE_DEF_H_ |
| 10739 | #define UPB_REFLECTION_SERVICE_DEF_H_ |
| 10740 | |
| 10741 | |
| 10742 | // Must be last. |
| 10743 | |
| 10744 | #ifdef __cplusplus |
| 10745 | extern "C" { |
| 10746 | #endif |
| 10747 | |
| 10748 | const upb_FileDef* upb_ServiceDef_File(const upb_ServiceDef* s); |
| 10749 | const upb_MethodDef* upb_ServiceDef_FindMethodByName(const upb_ServiceDef* s, |
| 10750 | const char* name); |
| 10751 | const char* upb_ServiceDef_FullName(const upb_ServiceDef* s); |
| 10752 | bool upb_ServiceDef_HasOptions(const upb_ServiceDef* s); |
| 10753 | int upb_ServiceDef_Index(const upb_ServiceDef* s); |
| 10754 | const upb_MethodDef* upb_ServiceDef_Method(const upb_ServiceDef* s, int i); |
| 10755 | int upb_ServiceDef_MethodCount(const upb_ServiceDef* s); |
| 10756 | const char* upb_ServiceDef_Name(const upb_ServiceDef* s); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 10757 | const UPB_DESC(ServiceOptions) * |
| 10758 | upb_ServiceDef_Options(const upb_ServiceDef* s); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10759 | |
| 10760 | #ifdef __cplusplus |
| 10761 | } /* extern "C" */ |
| 10762 | #endif |
| 10763 | |
| 10764 | |
| 10765 | #endif /* UPB_REFLECTION_SERVICE_DEF_H_ */ |
| 10766 | |
| 10767 | #endif /* UPB_REFLECTION_DEF_H_ */ |
| 10768 | |
| 10769 | // Must be last. |
| 10770 | |
| 10771 | #ifdef __cplusplus |
| 10772 | extern "C" { |
| 10773 | #endif |
| 10774 | |
| 10775 | enum { upb_JsonDecode_IgnoreUnknown = 1 }; |
| 10776 | |
| 10777 | bool upb_JsonDecode(const char* buf, size_t size, upb_Message* msg, |
| 10778 | const upb_MessageDef* m, const upb_DefPool* symtab, |
| 10779 | int options, upb_Arena* arena, upb_Status* status); |
| 10780 | |
| 10781 | #ifdef __cplusplus |
| 10782 | } /* extern "C" */ |
| 10783 | #endif |
| 10784 | |
| 10785 | |
| 10786 | #endif /* UPB_JSONDECODE_H_ */ |
| 10787 | |
| 10788 | #ifndef UPB_LEX_ATOI_H_ |
| 10789 | #define UPB_LEX_ATOI_H_ |
| 10790 | |
| 10791 | // Must be last. |
| 10792 | |
| 10793 | #ifdef __cplusplus |
| 10794 | extern "C" { |
| 10795 | #endif |
| 10796 | |
| 10797 | // We use these hand-written routines instead of strto[u]l() because the "long |
| 10798 | // long" variants aren't in c89. Also our version allows setting a ptr limit. |
| 10799 | // Return the new position of the pointer after parsing the int, or NULL on |
| 10800 | // integer overflow. |
| 10801 | |
| 10802 | const char* upb_BufToUint64(const char* ptr, const char* end, uint64_t* val); |
| 10803 | const char* upb_BufToInt64(const char* ptr, const char* end, int64_t* val, |
| 10804 | bool* is_neg); |
| 10805 | |
| 10806 | #ifdef __cplusplus |
| 10807 | } /* extern "C" */ |
| 10808 | #endif |
| 10809 | |
| 10810 | |
| 10811 | #endif /* UPB_LEX_ATOI_H_ */ |
| 10812 | |
| 10813 | #ifndef UPB_LEX_UNICODE_H_ |
| 10814 | #define UPB_LEX_UNICODE_H_ |
| 10815 | |
| 10816 | // Must be last. |
| 10817 | |
| 10818 | #ifdef __cplusplus |
| 10819 | extern "C" { |
| 10820 | #endif |
| 10821 | |
| 10822 | // Returns true iff a codepoint is the value for a high surrogate. |
| 10823 | UPB_INLINE bool upb_Unicode_IsHigh(uint32_t cp) { |
| 10824 | return (cp >= 0xd800 && cp <= 0xdbff); |
| 10825 | } |
| 10826 | |
| 10827 | // Returns true iff a codepoint is the value for a low surrogate. |
| 10828 | UPB_INLINE bool upb_Unicode_IsLow(uint32_t cp) { |
| 10829 | return (cp >= 0xdc00 && cp <= 0xdfff); |
| 10830 | } |
| 10831 | |
| 10832 | // Returns the high 16-bit surrogate value for a supplementary codepoint. |
| 10833 | // Does not sanity-check the input. |
| 10834 | UPB_INLINE uint16_t upb_Unicode_ToHigh(uint32_t cp) { |
| 10835 | return (cp >> 10) + 0xd7c0; |
| 10836 | } |
| 10837 | |
| 10838 | // Returns the low 16-bit surrogate value for a supplementary codepoint. |
| 10839 | // Does not sanity-check the input. |
| 10840 | UPB_INLINE uint16_t upb_Unicode_ToLow(uint32_t cp) { |
| 10841 | return (cp & 0x3ff) | 0xdc00; |
| 10842 | } |
| 10843 | |
| 10844 | // Returns the 32-bit value corresponding to a pair of 16-bit surrogates. |
| 10845 | // Does not sanity-check the input. |
| 10846 | UPB_INLINE uint32_t upb_Unicode_FromPair(uint32_t high, uint32_t low) { |
| 10847 | return ((high & 0x3ff) << 10) + (low & 0x3ff) + 0x10000; |
| 10848 | } |
| 10849 | |
| 10850 | // Outputs a codepoint as UTF8. |
| 10851 | // Returns the number of bytes written (1-4 on success, 0 on error). |
| 10852 | // Does not sanity-check the input. Specifically does not check for surrogates. |
| 10853 | int upb_Unicode_ToUTF8(uint32_t cp, char* out); |
| 10854 | |
| 10855 | #ifdef __cplusplus |
| 10856 | } /* extern "C" */ |
| 10857 | #endif |
| 10858 | |
| 10859 | |
| 10860 | #endif /* UPB_LEX_UNICODE_H_ */ |
| 10861 | |
| 10862 | #ifndef UPB_REFLECTION_MESSAGE_H_ |
| 10863 | #define UPB_REFLECTION_MESSAGE_H_ |
| 10864 | |
| 10865 | |
| 10866 | // Must be last. |
| 10867 | |
| 10868 | #ifdef __cplusplus |
| 10869 | extern "C" { |
| 10870 | #endif |
| 10871 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 10872 | // Returns a mutable pointer to a map, array, or submessage value. If the given |
| 10873 | // arena is non-NULL this will construct a new object if it was not previously |
| 10874 | // present. May not be called for primitive fields. |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10875 | upb_MutableMessageValue upb_Message_Mutable(upb_Message* msg, |
| 10876 | const upb_FieldDef* f, |
| 10877 | upb_Arena* a); |
| 10878 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 10879 | // Returns the field that is set in the oneof, or NULL if none are set. |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10880 | const upb_FieldDef* upb_Message_WhichOneof(const upb_Message* msg, |
| 10881 | const upb_OneofDef* o); |
| 10882 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 10883 | // Clear all data and unknown fields. |
| 10884 | void upb_Message_ClearByDef(upb_Message* msg, const upb_MessageDef* m); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10885 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 10886 | // Clears any field presence and sets the value back to its default. |
| 10887 | void upb_Message_ClearFieldByDef(upb_Message* msg, const upb_FieldDef* f); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10888 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 10889 | // May only be called for fields where upb_FieldDef_HasPresence(f) == true. |
| 10890 | bool upb_Message_HasFieldByDef(const upb_Message* msg, const upb_FieldDef* f); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10891 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 10892 | // Returns the value in the message associated with this field def. |
| 10893 | upb_MessageValue upb_Message_GetFieldByDef(const upb_Message* msg, |
| 10894 | const upb_FieldDef* f); |
| 10895 | |
| 10896 | // Sets the given field to the given value. For a msg/array/map/string, the |
| 10897 | // caller must ensure that the target data outlives |msg| (by living either in |
| 10898 | // the same arena or a different arena that outlives it). |
| 10899 | // |
| 10900 | // Returns false if allocation fails. |
| 10901 | bool upb_Message_SetFieldByDef(upb_Message* msg, const upb_FieldDef* f, |
| 10902 | upb_MessageValue val, upb_Arena* a); |
| 10903 | |
| 10904 | // Iterate over present fields. |
| 10905 | // |
| 10906 | // size_t iter = kUpb_Message_Begin; |
| 10907 | // const upb_FieldDef *f; |
| 10908 | // upb_MessageValue val; |
| 10909 | // while (upb_Message_Next(msg, m, ext_pool, &f, &val, &iter)) { |
| 10910 | // process_field(f, val); |
| 10911 | // } |
| 10912 | // |
| 10913 | // If ext_pool is NULL, no extensions will be returned. If the given symtab |
| 10914 | // returns extensions that don't match what is in this message, those extensions |
| 10915 | // will be skipped. |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10916 | |
| 10917 | #define kUpb_Message_Begin -1 |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 10918 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10919 | bool upb_Message_Next(const upb_Message* msg, const upb_MessageDef* m, |
| 10920 | const upb_DefPool* ext_pool, const upb_FieldDef** f, |
| 10921 | upb_MessageValue* val, size_t* iter); |
| 10922 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 10923 | // Clears all unknown field data from this message and all submessages. |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 10924 | bool upb_Message_DiscardUnknown(upb_Message* msg, const upb_MessageDef* m, |
| 10925 | int maxdepth); |
| 10926 | |
| 10927 | #ifdef __cplusplus |
| 10928 | } /* extern "C" */ |
| 10929 | #endif |
| 10930 | |
| 10931 | |
| 10932 | #endif /* UPB_REFLECTION_MESSAGE_H_ */ |
| 10933 | |
| 10934 | #ifndef UPB_JSON_ENCODE_H_ |
| 10935 | #define UPB_JSON_ENCODE_H_ |
| 10936 | |
| 10937 | |
| 10938 | // Must be last. |
| 10939 | |
| 10940 | #ifdef __cplusplus |
| 10941 | extern "C" { |
| 10942 | #endif |
| 10943 | |
| 10944 | enum { |
| 10945 | /* When set, emits 0/default values. TODO(haberman): proto3 only? */ |
| 10946 | upb_JsonEncode_EmitDefaults = 1 << 0, |
| 10947 | |
| 10948 | /* When set, use normal (snake_case) field names instead of JSON (camelCase) |
| 10949 | names. */ |
| 10950 | upb_JsonEncode_UseProtoNames = 1 << 1, |
| 10951 | |
| 10952 | /* When set, emits enums as their integer values instead of as their names. */ |
| 10953 | upb_JsonEncode_FormatEnumsAsIntegers = 1 << 2 |
| 10954 | }; |
| 10955 | |
| 10956 | /* Encodes the given |msg| to JSON format. The message's reflection is given in |
| 10957 | * |m|. The symtab in |symtab| is used to find extensions (if NULL, extensions |
| 10958 | * will not be printed). |
| 10959 | * |
| 10960 | * Output is placed in the given buffer, and always NULL-terminated. The output |
| 10961 | * size (excluding NULL) is returned. This means that a return value >= |size| |
| 10962 | * implies that the output was truncated. (These are the same semantics as |
| 10963 | * snprintf()). */ |
| 10964 | size_t upb_JsonEncode(const upb_Message* msg, const upb_MessageDef* m, |
| 10965 | const upb_DefPool* ext_pool, int options, char* buf, |
| 10966 | size_t size, upb_Status* status); |
| 10967 | |
| 10968 | #ifdef __cplusplus |
| 10969 | } /* extern "C" */ |
| 10970 | #endif |
| 10971 | |
| 10972 | |
| 10973 | #endif /* UPB_JSONENCODE_H_ */ |
| 10974 | |
| 10975 | #ifndef UPB_LEX_ROUND_TRIP_H_ |
| 10976 | #define UPB_LEX_ROUND_TRIP_H_ |
| 10977 | |
| 10978 | // Must be last. |
| 10979 | |
| 10980 | // Encodes a float or double that is round-trippable, but as short as possible. |
| 10981 | // These routines are not fully optimal (not guaranteed to be shortest), but are |
| 10982 | // short-ish and match the implementation that has been used in protobuf since |
| 10983 | // the beginning. |
| 10984 | |
| 10985 | // The given buffer size must be at least kUpb_RoundTripBufferSize. |
| 10986 | enum { kUpb_RoundTripBufferSize = 32 }; |
| 10987 | |
| 10988 | #ifdef __cplusplus |
| 10989 | extern "C" { |
| 10990 | #endif |
| 10991 | |
| 10992 | void _upb_EncodeRoundTripDouble(double val, char* buf, size_t size); |
| 10993 | void _upb_EncodeRoundTripFloat(float val, char* buf, size_t size); |
| 10994 | |
| 10995 | #ifdef __cplusplus |
| 10996 | } /* extern "C" */ |
| 10997 | #endif |
| 10998 | |
| 10999 | |
| 11000 | #endif /* UPB_LEX_ROUND_TRIP_H_ */ |
| 11001 | |
| 11002 | #ifndef UPB_PORT_VSNPRINTF_COMPAT_H_ |
| 11003 | #define UPB_PORT_VSNPRINTF_COMPAT_H_ |
| 11004 | |
| 11005 | // Must be last. |
| 11006 | |
| 11007 | UPB_INLINE int _upb_vsnprintf(char* buf, size_t size, const char* fmt, |
| 11008 | va_list ap) { |
| 11009 | #if defined(__MINGW64__) || defined(__MINGW32__) || defined(_MSC_VER) |
| 11010 | // The msvc runtime has a non-conforming vsnprintf() that requires the |
| 11011 | // following compatibility code to become conformant. |
| 11012 | int n = -1; |
| 11013 | if (size != 0) n = _vsnprintf_s(buf, size, _TRUNCATE, fmt, ap); |
| 11014 | if (n == -1) n = _vscprintf(fmt, ap); |
| 11015 | return n; |
| 11016 | #else |
| 11017 | return vsnprintf(buf, size, fmt, ap); |
| 11018 | #endif |
| 11019 | } |
| 11020 | |
| 11021 | |
| 11022 | #endif // UPB_PORT_VSNPRINTF_COMPAT_H_ |
| 11023 | |
| 11024 | #ifndef UPB_LEX_STRTOD_H_ |
| 11025 | #define UPB_LEX_STRTOD_H_ |
| 11026 | |
| 11027 | // Must be last. |
| 11028 | |
| 11029 | #ifdef __cplusplus |
| 11030 | extern "C" { |
| 11031 | #endif |
| 11032 | |
| 11033 | double _upb_NoLocaleStrtod(const char *str, char **endptr); |
| 11034 | |
| 11035 | #ifdef __cplusplus |
| 11036 | } /* extern "C" */ |
| 11037 | #endif |
| 11038 | |
| 11039 | |
| 11040 | #endif /* UPB_LEX_STRTOD_H_ */ |
| 11041 | |
| 11042 | #ifndef UPB_MEM_ARENA_INTERNAL_H_ |
| 11043 | #define UPB_MEM_ARENA_INTERNAL_H_ |
| 11044 | |
| 11045 | |
| 11046 | // Must be last. |
| 11047 | |
| 11048 | typedef struct _upb_MemBlock _upb_MemBlock; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 11049 | |
| 11050 | struct upb_Arena { |
| 11051 | _upb_ArenaHead head; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 11052 | |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 11053 | // upb_alloc* together with a low bit which signals if there is an initial |
| 11054 | // block. |
| 11055 | uintptr_t block_alloc; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 11056 | |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 11057 | // When multiple arenas are fused together, each arena points to a parent |
| 11058 | // arena (root points to itself). The root tracks how many live arenas |
| 11059 | // reference it. |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 11060 | |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 11061 | // The low bit is tagged: |
| 11062 | // 0: pointer to parent |
| 11063 | // 1: count, left shifted by one |
| 11064 | UPB_ATOMIC(uintptr_t) parent_or_count; |
| 11065 | |
| 11066 | // All nodes that are fused together are in a singly-linked list. |
| 11067 | UPB_ATOMIC(upb_Arena*) next; // NULL at end of list. |
| 11068 | |
| 11069 | // The last element of the linked list. This is present only as an |
| 11070 | // optimization, so that we do not have to iterate over all members for every |
| 11071 | // fuse. Only significant for an arena root. In other cases it is ignored. |
| 11072 | UPB_ATOMIC(upb_Arena*) tail; // == self when no other list members. |
| 11073 | |
| 11074 | // Linked list of blocks to free/cleanup. Atomic only for the benefit of |
| 11075 | // upb_Arena_SpaceAllocated(). |
| 11076 | UPB_ATOMIC(_upb_MemBlock*) blocks; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 11077 | }; |
| 11078 | |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 11079 | UPB_INLINE bool _upb_Arena_IsTaggedRefcount(uintptr_t parent_or_count) { |
| 11080 | return (parent_or_count & 1) == 1; |
| 11081 | } |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11082 | |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 11083 | UPB_INLINE bool _upb_Arena_IsTaggedPointer(uintptr_t parent_or_count) { |
| 11084 | return (parent_or_count & 1) == 0; |
| 11085 | } |
| 11086 | |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 11087 | UPB_INLINE uintptr_t _upb_Arena_RefCountFromTagged(uintptr_t parent_or_count) { |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 11088 | UPB_ASSERT(_upb_Arena_IsTaggedRefcount(parent_or_count)); |
| 11089 | return parent_or_count >> 1; |
| 11090 | } |
| 11091 | |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 11092 | UPB_INLINE uintptr_t _upb_Arena_TaggedFromRefcount(uintptr_t refcount) { |
| 11093 | uintptr_t parent_or_count = (refcount << 1) | 1; |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 11094 | UPB_ASSERT(_upb_Arena_IsTaggedRefcount(parent_or_count)); |
| 11095 | return parent_or_count; |
| 11096 | } |
| 11097 | |
| 11098 | UPB_INLINE upb_Arena* _upb_Arena_PointerFromTagged(uintptr_t parent_or_count) { |
| 11099 | UPB_ASSERT(_upb_Arena_IsTaggedPointer(parent_or_count)); |
| 11100 | return (upb_Arena*)parent_or_count; |
| 11101 | } |
| 11102 | |
| 11103 | UPB_INLINE uintptr_t _upb_Arena_TaggedFromPointer(upb_Arena* a) { |
| 11104 | uintptr_t parent_or_count = (uintptr_t)a; |
| 11105 | UPB_ASSERT(_upb_Arena_IsTaggedPointer(parent_or_count)); |
| 11106 | return parent_or_count; |
| 11107 | } |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 11108 | |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 11109 | UPB_INLINE upb_alloc* upb_Arena_BlockAlloc(upb_Arena* arena) { |
| 11110 | return (upb_alloc*)(arena->block_alloc & ~0x1); |
| 11111 | } |
| 11112 | |
| 11113 | UPB_INLINE uintptr_t upb_Arena_MakeBlockAlloc(upb_alloc* alloc, |
| 11114 | bool has_initial) { |
| 11115 | uintptr_t alloc_uint = (uintptr_t)alloc; |
| 11116 | UPB_ASSERT((alloc_uint & 1) == 0); |
| 11117 | return alloc_uint | (has_initial ? 1 : 0); |
| 11118 | } |
| 11119 | |
| 11120 | UPB_INLINE bool upb_Arena_HasInitialBlock(upb_Arena* arena) { |
| 11121 | return arena->block_alloc & 0x1; |
| 11122 | } |
| 11123 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 11124 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 11125 | #endif /* UPB_MEM_ARENA_INTERNAL_H_ */ |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11126 | |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 11127 | #ifndef UPB_PORT_ATOMIC_H_ |
| 11128 | #define UPB_PORT_ATOMIC_H_ |
| 11129 | |
| 11130 | |
| 11131 | #ifdef UPB_USE_C11_ATOMICS |
| 11132 | |
| 11133 | #include <stdatomic.h> |
| 11134 | #include <stdbool.h> |
| 11135 | |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 11136 | #define upb_Atomic_Init(addr, val) atomic_init(addr, val) |
| 11137 | #define upb_Atomic_Load(addr, order) atomic_load_explicit(addr, order) |
| 11138 | #define upb_Atomic_Store(addr, val, order) \ |
| 11139 | atomic_store_explicit(addr, val, order) |
| 11140 | #define upb_Atomic_Add(addr, val, order) \ |
| 11141 | atomic_fetch_add_explicit(addr, val, order) |
| 11142 | #define upb_Atomic_Sub(addr, val, order) \ |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 11143 | atomic_fetch_sub_explicit(addr, val, order) |
| 11144 | #define upb_Atomic_Exchange(addr, val, order) \ |
| 11145 | atomic_exchange_explicit(addr, val, order) |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 11146 | #define upb_Atomic_CompareExchangeStrong(addr, expected, desired, \ |
| 11147 | success_order, failure_order) \ |
| 11148 | atomic_compare_exchange_strong_explicit(addr, expected, desired, \ |
| 11149 | success_order, failure_order) |
| 11150 | #define upb_Atomic_CompareExchangeWeak(addr, expected, desired, success_order, \ |
| 11151 | failure_order) \ |
| 11152 | atomic_compare_exchange_weak_explicit(addr, expected, desired, \ |
| 11153 | success_order, failure_order) |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 11154 | |
| 11155 | #else // !UPB_USE_C11_ATOMICS |
| 11156 | |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 11157 | #include <string.h> |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 11158 | |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 11159 | #define upb_Atomic_Init(addr, val) (*addr = val) |
| 11160 | #define upb_Atomic_Load(addr, order) (*addr) |
| 11161 | #define upb_Atomic_Store(addr, val, order) (*(addr) = val) |
| 11162 | #define upb_Atomic_Add(addr, val, order) (*(addr) += val) |
| 11163 | #define upb_Atomic_Sub(addr, val, order) (*(addr) -= val) |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 11164 | |
Deanna Garcia | bd6a0cf | 2023-04-20 10:30:44 -0700 | [diff] [blame] | 11165 | UPB_INLINE void* _upb_NonAtomic_Exchange(void* addr, void* value) { |
| 11166 | void* old; |
| 11167 | memcpy(&old, addr, sizeof(value)); |
| 11168 | memcpy(addr, &value, sizeof(value)); |
| 11169 | return old; |
| 11170 | } |
| 11171 | |
| 11172 | #define upb_Atomic_Exchange(addr, val, order) _upb_NonAtomic_Exchange(addr, val) |
| 11173 | |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 11174 | // `addr` and `expected` are logically double pointers. |
| 11175 | UPB_INLINE bool _upb_NonAtomic_CompareExchangeStrongP(void* addr, |
| 11176 | void* expected, |
| 11177 | void* desired) { |
| 11178 | if (memcmp(addr, expected, sizeof(desired)) == 0) { |
| 11179 | memcpy(addr, &desired, sizeof(desired)); |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 11180 | return true; |
| 11181 | } else { |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 11182 | memcpy(expected, addr, sizeof(desired)); |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 11183 | return false; |
| 11184 | } |
| 11185 | } |
| 11186 | |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 11187 | #define upb_Atomic_CompareExchangeStrong(addr, expected, desired, \ |
| 11188 | success_order, failure_order) \ |
| 11189 | _upb_NonAtomic_CompareExchangeStrongP((void*)addr, (void*)expected, \ |
| 11190 | (void*)desired) |
| 11191 | #define upb_Atomic_CompareExchangeWeak(addr, expected, desired, success_order, \ |
| 11192 | failure_order) \ |
| 11193 | upb_Atomic_CompareExchangeStrong(addr, expected, desired, 0, 0) |
| 11194 | |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 11195 | #endif |
| 11196 | |
| 11197 | |
| 11198 | #endif // UPB_PORT_ATOMIC_H_ |
| 11199 | |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 11200 | #ifndef UPB_WIRE_COMMON_H_ |
| 11201 | #define UPB_WIRE_COMMON_H_ |
| 11202 | |
| 11203 | // Must be last. |
| 11204 | |
| 11205 | #ifdef __cplusplus |
| 11206 | extern "C" { |
| 11207 | #endif |
| 11208 | |
| 11209 | #define kUpb_WireFormat_DefaultDepthLimit 100 |
| 11210 | |
| 11211 | #ifdef __cplusplus |
| 11212 | } |
| 11213 | #endif |
| 11214 | |
| 11215 | #endif // UPB_WIRE_COMMON_H_ |
| 11216 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 11217 | #ifndef UPB_WIRE_READER_H_ |
| 11218 | #define UPB_WIRE_READER_H_ |
| 11219 | |
| 11220 | |
| 11221 | #ifndef UPB_WIRE_SWAP_INTERNAL_H_ |
| 11222 | #define UPB_WIRE_SWAP_INTERNAL_H_ |
| 11223 | |
| 11224 | // Must be last. |
| 11225 | |
| 11226 | #ifdef __cplusplus |
| 11227 | extern "C" { |
| 11228 | #endif |
| 11229 | |
| 11230 | UPB_INLINE bool _upb_IsLittleEndian(void) { |
| 11231 | int x = 1; |
| 11232 | return *(char*)&x == 1; |
| 11233 | } |
| 11234 | |
| 11235 | UPB_INLINE uint32_t _upb_BigEndian_Swap32(uint32_t val) { |
| 11236 | if (_upb_IsLittleEndian()) return val; |
| 11237 | |
| 11238 | return ((val & 0xff) << 24) | ((val & 0xff00) << 8) | |
| 11239 | ((val & 0xff0000) >> 8) | ((val & 0xff000000) >> 24); |
| 11240 | } |
| 11241 | |
| 11242 | UPB_INLINE uint64_t _upb_BigEndian_Swap64(uint64_t val) { |
| 11243 | if (_upb_IsLittleEndian()) return val; |
| 11244 | |
| 11245 | return ((uint64_t)_upb_BigEndian_Swap32((uint32_t)val) << 32) | |
| 11246 | _upb_BigEndian_Swap32((uint32_t)(val >> 32)); |
| 11247 | } |
| 11248 | |
| 11249 | #ifdef __cplusplus |
| 11250 | } /* extern "C" */ |
| 11251 | #endif |
| 11252 | |
| 11253 | |
| 11254 | #endif /* UPB_WIRE_SWAP_INTERNAL_H_ */ |
| 11255 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11256 | #ifndef UPB_WIRE_TYPES_H_ |
| 11257 | #define UPB_WIRE_TYPES_H_ |
| 11258 | |
| 11259 | // A list of types as they are encoded on the wire. |
| 11260 | typedef enum { |
| 11261 | kUpb_WireType_Varint = 0, |
| 11262 | kUpb_WireType_64Bit = 1, |
| 11263 | kUpb_WireType_Delimited = 2, |
| 11264 | kUpb_WireType_StartGroup = 3, |
| 11265 | kUpb_WireType_EndGroup = 4, |
| 11266 | kUpb_WireType_32Bit = 5 |
| 11267 | } upb_WireType; |
| 11268 | |
| 11269 | #endif /* UPB_WIRE_TYPES_H_ */ |
| 11270 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 11271 | // Must be last. |
| 11272 | |
| 11273 | #ifdef __cplusplus |
| 11274 | extern "C" { |
| 11275 | #endif |
| 11276 | |
| 11277 | // The upb_WireReader interface is suitable for general-purpose parsing of |
| 11278 | // protobuf binary wire format. It is designed to be used along with |
| 11279 | // upb_EpsCopyInputStream for buffering, and all parsing routines in this file |
| 11280 | // assume that at least kUpb_EpsCopyInputStream_SlopBytes worth of data is |
| 11281 | // available to read without any bounds checks. |
| 11282 | |
| 11283 | #define kUpb_WireReader_WireTypeMask 7 |
| 11284 | #define kUpb_WireReader_WireTypeBits 3 |
| 11285 | |
| 11286 | typedef struct { |
| 11287 | const char* ptr; |
| 11288 | uint64_t val; |
| 11289 | } _upb_WireReader_ReadLongVarintRet; |
| 11290 | |
| 11291 | _upb_WireReader_ReadLongVarintRet _upb_WireReader_ReadLongVarint( |
| 11292 | const char* ptr, uint64_t val); |
| 11293 | |
| 11294 | static UPB_FORCEINLINE const char* _upb_WireReader_ReadVarint(const char* ptr, |
| 11295 | uint64_t* val, |
| 11296 | int maxlen, |
| 11297 | uint64_t maxval) { |
| 11298 | uint64_t byte = (uint8_t)*ptr; |
| 11299 | if (UPB_LIKELY((byte & 0x80) == 0)) { |
| 11300 | *val = (uint32_t)byte; |
| 11301 | return ptr + 1; |
| 11302 | } |
| 11303 | const char* start = ptr; |
| 11304 | _upb_WireReader_ReadLongVarintRet res = |
| 11305 | _upb_WireReader_ReadLongVarint(ptr, byte); |
| 11306 | if (!res.ptr || (maxlen < 10 && res.ptr - start > maxlen) || |
| 11307 | res.val > maxval) { |
| 11308 | return NULL; // Malformed. |
| 11309 | } |
| 11310 | *val = res.val; |
| 11311 | return res.ptr; |
| 11312 | } |
| 11313 | |
| 11314 | // Parses a tag into `tag`, and returns a pointer past the end of the tag, or |
| 11315 | // NULL if there was an error in the tag data. |
| 11316 | // |
| 11317 | // REQUIRES: there must be at least 10 bytes of data available at `ptr`. |
| 11318 | // Bounds checks must be performed before calling this function, preferably |
| 11319 | // by calling upb_EpsCopyInputStream_IsDone(). |
| 11320 | static UPB_FORCEINLINE const char* upb_WireReader_ReadTag(const char* ptr, |
| 11321 | uint32_t* tag) { |
| 11322 | uint64_t val; |
| 11323 | ptr = _upb_WireReader_ReadVarint(ptr, &val, 5, UINT32_MAX); |
| 11324 | if (!ptr) return NULL; |
| 11325 | *tag = val; |
| 11326 | return ptr; |
| 11327 | } |
| 11328 | |
| 11329 | // Given a tag, returns the field number. |
| 11330 | UPB_INLINE uint32_t upb_WireReader_GetFieldNumber(uint32_t tag) { |
| 11331 | return tag >> kUpb_WireReader_WireTypeBits; |
| 11332 | } |
| 11333 | |
| 11334 | // Given a tag, returns the wire type. |
| 11335 | UPB_INLINE uint8_t upb_WireReader_GetWireType(uint32_t tag) { |
| 11336 | return tag & kUpb_WireReader_WireTypeMask; |
| 11337 | } |
| 11338 | |
| 11339 | UPB_INLINE const char* upb_WireReader_ReadVarint(const char* ptr, |
| 11340 | uint64_t* val) { |
| 11341 | return _upb_WireReader_ReadVarint(ptr, val, 10, UINT64_MAX); |
| 11342 | } |
| 11343 | |
| 11344 | // Skips data for a varint, returning a pointer past the end of the varint, or |
| 11345 | // NULL if there was an error in the varint data. |
| 11346 | // |
| 11347 | // REQUIRES: there must be at least 10 bytes of data available at `ptr`. |
| 11348 | // Bounds checks must be performed before calling this function, preferably |
| 11349 | // by calling upb_EpsCopyInputStream_IsDone(). |
| 11350 | UPB_INLINE const char* upb_WireReader_SkipVarint(const char* ptr) { |
| 11351 | uint64_t val; |
| 11352 | return upb_WireReader_ReadVarint(ptr, &val); |
| 11353 | } |
| 11354 | |
| 11355 | // Reads a varint indicating the size of a delimited field into `size`, or |
| 11356 | // NULL if there was an error in the varint data. |
| 11357 | // |
| 11358 | // REQUIRES: there must be at least 10 bytes of data available at `ptr`. |
| 11359 | // Bounds checks must be performed before calling this function, preferably |
| 11360 | // by calling upb_EpsCopyInputStream_IsDone(). |
| 11361 | UPB_INLINE const char* upb_WireReader_ReadSize(const char* ptr, int* size) { |
| 11362 | uint64_t size64; |
| 11363 | ptr = upb_WireReader_ReadVarint(ptr, &size64); |
| 11364 | if (!ptr || size64 >= INT32_MAX) return NULL; |
| 11365 | *size = size64; |
| 11366 | return ptr; |
| 11367 | } |
| 11368 | |
| 11369 | // Reads a fixed32 field, performing byte swapping if necessary. |
| 11370 | // |
| 11371 | // REQUIRES: there must be at least 4 bytes of data available at `ptr`. |
| 11372 | // Bounds checks must be performed before calling this function, preferably |
| 11373 | // by calling upb_EpsCopyInputStream_IsDone(). |
| 11374 | UPB_INLINE const char* upb_WireReader_ReadFixed32(const char* ptr, void* val) { |
| 11375 | uint32_t uval; |
| 11376 | memcpy(&uval, ptr, 4); |
| 11377 | uval = _upb_BigEndian_Swap32(uval); |
| 11378 | memcpy(val, &uval, 4); |
| 11379 | return ptr + 4; |
| 11380 | } |
| 11381 | |
| 11382 | // Reads a fixed64 field, performing byte swapping if necessary. |
| 11383 | // |
| 11384 | // REQUIRES: there must be at least 4 bytes of data available at `ptr`. |
| 11385 | // Bounds checks must be performed before calling this function, preferably |
| 11386 | // by calling upb_EpsCopyInputStream_IsDone(). |
| 11387 | UPB_INLINE const char* upb_WireReader_ReadFixed64(const char* ptr, void* val) { |
| 11388 | uint64_t uval; |
| 11389 | memcpy(&uval, ptr, 8); |
| 11390 | uval = _upb_BigEndian_Swap64(uval); |
| 11391 | memcpy(val, &uval, 8); |
| 11392 | return ptr + 8; |
| 11393 | } |
| 11394 | |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 11395 | const char* _upb_WireReader_SkipGroup(const char* ptr, uint32_t tag, |
| 11396 | int depth_limit, |
| 11397 | upb_EpsCopyInputStream* stream); |
| 11398 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 11399 | // Skips data for a group, returning a pointer past the end of the group, or |
| 11400 | // NULL if there was an error parsing the group. The `tag` argument should be |
| 11401 | // the start group tag that begins the group. The `depth_limit` argument |
| 11402 | // indicates how many levels of recursion the group is allowed to have before |
| 11403 | // reporting a parse error (this limit exists to protect against stack |
| 11404 | // overflow). |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 11405 | // |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 11406 | // TODO: evaluate how the depth_limit should be specified. Do users need |
| 11407 | // control over this? |
| 11408 | UPB_INLINE const char* upb_WireReader_SkipGroup( |
| 11409 | const char* ptr, uint32_t tag, upb_EpsCopyInputStream* stream) { |
| 11410 | return _upb_WireReader_SkipGroup(ptr, tag, 100, stream); |
| 11411 | } |
| 11412 | |
| 11413 | UPB_INLINE const char* _upb_WireReader_SkipValue( |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 11414 | const char* ptr, uint32_t tag, int depth_limit, |
| 11415 | upb_EpsCopyInputStream* stream) { |
| 11416 | switch (upb_WireReader_GetWireType(tag)) { |
| 11417 | case kUpb_WireType_Varint: |
| 11418 | return upb_WireReader_SkipVarint(ptr); |
| 11419 | case kUpb_WireType_32Bit: |
| 11420 | return ptr + 4; |
| 11421 | case kUpb_WireType_64Bit: |
| 11422 | return ptr + 8; |
| 11423 | case kUpb_WireType_Delimited: { |
| 11424 | int size; |
| 11425 | ptr = upb_WireReader_ReadSize(ptr, &size); |
| 11426 | if (!ptr) return NULL; |
| 11427 | ptr += size; |
| 11428 | return ptr; |
| 11429 | } |
| 11430 | case kUpb_WireType_StartGroup: |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 11431 | return _upb_WireReader_SkipGroup(ptr, tag, depth_limit, stream); |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 11432 | case kUpb_WireType_EndGroup: |
| 11433 | return NULL; // Should be handled before now. |
| 11434 | default: |
| 11435 | return NULL; // Unknown wire type. |
| 11436 | } |
| 11437 | } |
| 11438 | |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 11439 | // Skips data for a wire value of any type, returning a pointer past the end of |
| 11440 | // the data, or NULL if there was an error parsing the group. The `tag` argument |
| 11441 | // should be the tag that was just parsed. The `depth_limit` argument indicates |
| 11442 | // how many levels of recursion a group is allowed to have before reporting a |
| 11443 | // parse error (this limit exists to protect against stack overflow). |
| 11444 | // |
| 11445 | // REQUIRES: there must be at least 10 bytes of data available at `ptr`. |
| 11446 | // Bounds checks must be performed before calling this function, preferably |
| 11447 | // by calling upb_EpsCopyInputStream_IsDone(). |
| 11448 | // |
| 11449 | // TODO: evaluate how the depth_limit should be specified. Do users need |
| 11450 | // control over this? |
| 11451 | UPB_INLINE const char* upb_WireReader_SkipValue( |
| 11452 | const char* ptr, uint32_t tag, upb_EpsCopyInputStream* stream) { |
| 11453 | return _upb_WireReader_SkipValue(ptr, tag, 100, stream); |
| 11454 | } |
| 11455 | |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 11456 | #ifdef __cplusplus |
| 11457 | } /* extern "C" */ |
| 11458 | #endif |
| 11459 | |
| 11460 | |
| 11461 | #endif // UPB_WIRE_READER_H_ |
| 11462 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11463 | #ifndef UPB_MINI_TABLE_COMMON_INTERNAL_H_ |
| 11464 | #define UPB_MINI_TABLE_COMMON_INTERNAL_H_ |
| 11465 | |
| 11466 | |
| 11467 | // Must be last. |
| 11468 | |
| 11469 | typedef enum { |
| 11470 | kUpb_EncodedType_Double = 0, |
| 11471 | kUpb_EncodedType_Float = 1, |
| 11472 | kUpb_EncodedType_Fixed32 = 2, |
| 11473 | kUpb_EncodedType_Fixed64 = 3, |
| 11474 | kUpb_EncodedType_SFixed32 = 4, |
| 11475 | kUpb_EncodedType_SFixed64 = 5, |
| 11476 | kUpb_EncodedType_Int32 = 6, |
| 11477 | kUpb_EncodedType_UInt32 = 7, |
| 11478 | kUpb_EncodedType_SInt32 = 8, |
| 11479 | kUpb_EncodedType_Int64 = 9, |
| 11480 | kUpb_EncodedType_UInt64 = 10, |
| 11481 | kUpb_EncodedType_SInt64 = 11, |
| 11482 | kUpb_EncodedType_OpenEnum = 12, |
| 11483 | kUpb_EncodedType_Bool = 13, |
| 11484 | kUpb_EncodedType_Bytes = 14, |
| 11485 | kUpb_EncodedType_String = 15, |
| 11486 | kUpb_EncodedType_Group = 16, |
| 11487 | kUpb_EncodedType_Message = 17, |
| 11488 | kUpb_EncodedType_ClosedEnum = 18, |
| 11489 | |
| 11490 | kUpb_EncodedType_RepeatedBase = 20, |
| 11491 | } upb_EncodedType; |
| 11492 | |
| 11493 | typedef enum { |
| 11494 | kUpb_EncodedFieldModifier_FlipPacked = 1 << 0, |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 11495 | kUpb_EncodedFieldModifier_IsRequired = 1 << 1, |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11496 | kUpb_EncodedFieldModifier_IsProto3Singular = 1 << 2, |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11497 | } upb_EncodedFieldModifier; |
| 11498 | |
| 11499 | enum { |
| 11500 | kUpb_EncodedValue_MinField = ' ', |
| 11501 | kUpb_EncodedValue_MaxField = 'I', |
| 11502 | kUpb_EncodedValue_MinModifier = 'L', |
| 11503 | kUpb_EncodedValue_MaxModifier = '[', |
| 11504 | kUpb_EncodedValue_End = '^', |
| 11505 | kUpb_EncodedValue_MinSkip = '_', |
| 11506 | kUpb_EncodedValue_MaxSkip = '~', |
| 11507 | kUpb_EncodedValue_OneofSeparator = '~', |
| 11508 | kUpb_EncodedValue_FieldSeparator = '|', |
| 11509 | kUpb_EncodedValue_MinOneofField = ' ', |
| 11510 | kUpb_EncodedValue_MaxOneofField = 'b', |
| 11511 | kUpb_EncodedValue_MaxEnumMask = 'A', |
| 11512 | }; |
| 11513 | |
| 11514 | enum { |
| 11515 | kUpb_EncodedVersion_EnumV1 = '!', |
| 11516 | kUpb_EncodedVersion_ExtensionV1 = '#', |
| 11517 | kUpb_EncodedVersion_MapV1 = '%', |
| 11518 | kUpb_EncodedVersion_MessageV1 = '$', |
| 11519 | kUpb_EncodedVersion_MessageSetV1 = '&', |
| 11520 | }; |
| 11521 | |
| 11522 | #ifdef __cplusplus |
| 11523 | extern "C" { |
| 11524 | #endif |
| 11525 | |
| 11526 | UPB_INLINE char _upb_ToBase92(int8_t ch) { |
| 11527 | extern const char _kUpb_ToBase92[]; |
| 11528 | UPB_ASSERT(0 <= ch && ch < 92); |
| 11529 | return _kUpb_ToBase92[ch]; |
| 11530 | } |
| 11531 | |
| 11532 | UPB_INLINE char _upb_FromBase92(uint8_t ch) { |
| 11533 | extern const int8_t _kUpb_FromBase92[]; |
| 11534 | if (' ' > ch || ch > '~') return -1; |
| 11535 | return _kUpb_FromBase92[ch - ' ']; |
| 11536 | } |
| 11537 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11538 | #ifdef __cplusplus |
| 11539 | } /* extern "C" */ |
| 11540 | #endif |
| 11541 | |
| 11542 | |
| 11543 | #endif /* UPB_MINI_TABLE_COMMON_INTERNAL_H_ */ |
| 11544 | |
| 11545 | #ifndef UPB_MINI_TABLE_DECODE_H_ |
| 11546 | #define UPB_MINI_TABLE_DECODE_H_ |
| 11547 | |
| 11548 | |
| 11549 | // Must be last. |
| 11550 | |
| 11551 | typedef enum { |
| 11552 | kUpb_MiniTablePlatform_32Bit, |
| 11553 | kUpb_MiniTablePlatform_64Bit, |
| 11554 | kUpb_MiniTablePlatform_Native = |
| 11555 | UPB_SIZE(kUpb_MiniTablePlatform_32Bit, kUpb_MiniTablePlatform_64Bit), |
| 11556 | } upb_MiniTablePlatform; |
| 11557 | |
| 11558 | #ifdef __cplusplus |
| 11559 | extern "C" { |
| 11560 | #endif |
| 11561 | |
| 11562 | // Builds a mini table from the data encoded in the buffer [data, len]. If any |
| 11563 | // errors occur, returns NULL and sets a status message. In the success case, |
| 11564 | // the caller must call upb_MiniTable_SetSub*() for all message or proto2 enum |
| 11565 | // fields to link the table to the appropriate sub-tables. |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 11566 | upb_MiniTable* _upb_MiniTable_Build(const char* data, size_t len, |
| 11567 | upb_MiniTablePlatform platform, |
| 11568 | upb_Arena* arena, upb_Status* status); |
| 11569 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 11570 | UPB_API_INLINE upb_MiniTable* upb_MiniTable_Build(const char* data, size_t len, |
| 11571 | upb_Arena* arena, |
| 11572 | upb_Status* status) { |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 11573 | return _upb_MiniTable_Build(data, len, kUpb_MiniTablePlatform_Native, arena, |
| 11574 | status); |
| 11575 | } |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11576 | |
Deanna Garcia | 59cfc2f | 2023-01-31 13:19:28 -0800 | [diff] [blame] | 11577 | // Links a sub-message field to a MiniTable for that sub-message. If a |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11578 | // sub-message field is not linked, it will be treated as an unknown field |
Deanna Garcia | 59cfc2f | 2023-01-31 13:19:28 -0800 | [diff] [blame] | 11579 | // during parsing, and setting the field will not be allowed. It is possible |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11580 | // to link the message field later, at which point it will no longer be treated |
Deanna Garcia | 59cfc2f | 2023-01-31 13:19:28 -0800 | [diff] [blame] | 11581 | // as unknown. However there is no synchronization for this operation, which |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11582 | // means parallel mutation requires external synchronization. |
Deanna Garcia | 59cfc2f | 2023-01-31 13:19:28 -0800 | [diff] [blame] | 11583 | // Returns success/failure. |
| 11584 | UPB_API bool upb_MiniTable_SetSubMessage(upb_MiniTable* table, |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 11585 | upb_MiniTableField* field, |
| 11586 | const upb_MiniTable* sub); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11587 | |
Deanna Garcia | 59cfc2f | 2023-01-31 13:19:28 -0800 | [diff] [blame] | 11588 | // Links an enum field to a MiniTable for that enum. |
| 11589 | // All enum fields must be linked prior to parsing. |
| 11590 | // Returns success/failure. |
| 11591 | UPB_API bool upb_MiniTable_SetSubEnum(upb_MiniTable* table, |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 11592 | upb_MiniTableField* field, |
| 11593 | const upb_MiniTableEnum* sub); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11594 | |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 11595 | // Initializes a MiniTableExtension buffer that has already been allocated. |
| 11596 | // This is needed by upb_FileDef and upb_MessageDef, which allocate all of the |
| 11597 | // extensions together in a single contiguous array. |
| 11598 | const char* _upb_MiniTableExtension_Init(const char* data, size_t len, |
| 11599 | upb_MiniTableExtension* ext, |
| 11600 | const upb_MiniTable* extendee, |
| 11601 | upb_MiniTableSub sub, |
| 11602 | upb_MiniTablePlatform platform, |
| 11603 | upb_Status* status); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11604 | |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 11605 | UPB_API_INLINE const char* upb_MiniTableExtension_Init( |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11606 | const char* data, size_t len, upb_MiniTableExtension* ext, |
| 11607 | const upb_MiniTable* extendee, upb_MiniTableSub sub, upb_Status* status) { |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 11608 | return _upb_MiniTableExtension_Init(data, len, ext, extendee, sub, |
| 11609 | kUpb_MiniTablePlatform_Native, status); |
| 11610 | } |
| 11611 | |
| 11612 | UPB_API upb_MiniTableExtension* _upb_MiniTableExtension_Build( |
| 11613 | const char* data, size_t len, const upb_MiniTable* extendee, |
| 11614 | upb_MiniTableSub sub, upb_MiniTablePlatform platform, upb_Arena* arena, |
| 11615 | upb_Status* status); |
| 11616 | |
| 11617 | UPB_API_INLINE upb_MiniTableExtension* upb_MiniTableExtension_Build( |
| 11618 | const char* data, size_t len, const upb_MiniTable* extendee, |
| 11619 | upb_Arena* arena, upb_Status* status) { |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 11620 | upb_MiniTableSub sub; |
| 11621 | sub.submsg = NULL; |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 11622 | return _upb_MiniTableExtension_Build( |
| 11623 | data, len, extendee, sub, kUpb_MiniTablePlatform_Native, arena, status); |
| 11624 | } |
| 11625 | |
| 11626 | UPB_API_INLINE upb_MiniTableExtension* upb_MiniTableExtension_BuildMessage( |
| 11627 | const char* data, size_t len, const upb_MiniTable* extendee, |
| 11628 | upb_MiniTable* submsg, upb_Arena* arena, upb_Status* status) { |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 11629 | upb_MiniTableSub sub; |
| 11630 | sub.submsg = submsg; |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 11631 | return _upb_MiniTableExtension_Build( |
| 11632 | data, len, extendee, sub, kUpb_MiniTablePlatform_Native, arena, status); |
| 11633 | } |
| 11634 | |
| 11635 | UPB_API_INLINE upb_MiniTableExtension* upb_MiniTableExtension_BuildEnum( |
| 11636 | const char* data, size_t len, const upb_MiniTable* extendee, |
| 11637 | upb_MiniTableEnum* subenum, upb_Arena* arena, upb_Status* status) { |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 11638 | upb_MiniTableSub sub; |
| 11639 | sub.subenum = subenum; |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 11640 | return _upb_MiniTableExtension_Build( |
| 11641 | data, len, extendee, sub, kUpb_MiniTablePlatform_Native, arena, status); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11642 | } |
| 11643 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 11644 | UPB_API upb_MiniTableEnum* upb_MiniTableEnum_Build(const char* data, size_t len, |
| 11645 | upb_Arena* arena, |
| 11646 | upb_Status* status); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11647 | |
| 11648 | // Like upb_MiniTable_Build(), but the user provides a buffer of layout data so |
| 11649 | // it can be reused from call to call, avoiding repeated realloc()/free(). |
| 11650 | // |
| 11651 | // The caller owns `*buf` both before and after the call, and must free() it |
| 11652 | // when it is no longer in use. The function will realloc() `*buf` as |
| 11653 | // necessary, updating `*size` accordingly. |
| 11654 | upb_MiniTable* upb_MiniTable_BuildWithBuf(const char* data, size_t len, |
| 11655 | upb_MiniTablePlatform platform, |
| 11656 | upb_Arena* arena, void** buf, |
| 11657 | size_t* buf_size, upb_Status* status); |
| 11658 | |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 11659 | // Returns a list of fields that require linking at runtime, to connect the |
| 11660 | // MiniTable to its sub-messages and sub-enums. The list of fields will be |
| 11661 | // written to the `subs` array, which must have been allocated by the caller |
| 11662 | // and must be large enough to hold a list of all fields in the message. |
| 11663 | // |
| 11664 | // The order of the fields returned by this function is significant: it matches |
| 11665 | // the order expected by upb_MiniTable_Link() below. |
| 11666 | // |
| 11667 | // The return value packs the sub-message count and sub-enum count into a single |
| 11668 | // integer like so: |
| 11669 | // return (msg_count << 16) | enum_count; |
| 11670 | UPB_API uint32_t upb_MiniTable_GetSubList(const upb_MiniTable* mt, |
| 11671 | const upb_MiniTableField** subs); |
| 11672 | |
| 11673 | // Links a message to its sub-messages and sub-enums. The caller must pass |
| 11674 | // arrays of sub-tables and sub-enums, in the same length and order as is |
| 11675 | // returned by upb_MiniTable_GetSubList() above. However, individual elements |
| 11676 | // of the sub_tables may be NULL if those sub-messages were tree shaken. |
| 11677 | // |
| 11678 | // Returns false if either array is too short, or if any of the tables fails |
| 11679 | // to link. |
| 11680 | UPB_API bool upb_MiniTable_Link(upb_MiniTable* mt, |
| 11681 | const upb_MiniTable** sub_tables, |
| 11682 | size_t sub_table_count, |
| 11683 | const upb_MiniTableEnum** sub_enums, |
| 11684 | size_t sub_enum_count); |
| 11685 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11686 | #ifdef __cplusplus |
| 11687 | } /* extern "C" */ |
| 11688 | #endif |
| 11689 | |
| 11690 | |
| 11691 | #endif /* UPB_MINI_TABLE_DECODE_H_ */ |
| 11692 | |
| 11693 | #ifndef UPB_MINI_TABLE_ENCODE_INTERNAL_H_ |
| 11694 | #define UPB_MINI_TABLE_ENCODE_INTERNAL_H_ |
| 11695 | |
| 11696 | |
| 11697 | // Must be last. |
| 11698 | |
| 11699 | // If the input buffer has at least this many bytes available, the encoder call |
| 11700 | // is guaranteed to succeed (as long as field number order is maintained). |
| 11701 | #define kUpb_MtDataEncoder_MinSize 16 |
| 11702 | |
| 11703 | typedef struct { |
| 11704 | char* end; // Limit of the buffer passed as a parameter. |
| 11705 | // Aliased to internal-only members in .cc. |
| 11706 | char internal[32]; |
| 11707 | } upb_MtDataEncoder; |
| 11708 | |
| 11709 | #ifdef __cplusplus |
| 11710 | extern "C" { |
| 11711 | #endif |
| 11712 | |
| 11713 | // Encodes field/oneof information for a given message. The sequence of calls |
| 11714 | // should look like: |
| 11715 | // |
| 11716 | // upb_MtDataEncoder e; |
| 11717 | // char buf[256]; |
| 11718 | // char* ptr = buf; |
| 11719 | // e.end = ptr + sizeof(buf); |
| 11720 | // unit64_t msg_mod = ...; // bitwise & of kUpb_MessageModifiers or zero |
| 11721 | // ptr = upb_MtDataEncoder_StartMessage(&e, ptr, msg_mod); |
| 11722 | // // Fields *must* be in field number order. |
| 11723 | // ptr = upb_MtDataEncoder_PutField(&e, ptr, ...); |
| 11724 | // ptr = upb_MtDataEncoder_PutField(&e, ptr, ...); |
| 11725 | // ptr = upb_MtDataEncoder_PutField(&e, ptr, ...); |
| 11726 | // |
| 11727 | // // If oneofs are present. Oneofs must be encoded after regular fields. |
| 11728 | // ptr = upb_MiniTable_StartOneof(&e, ptr) |
| 11729 | // ptr = upb_MiniTable_PutOneofField(&e, ptr, ...); |
| 11730 | // ptr = upb_MiniTable_PutOneofField(&e, ptr, ...); |
| 11731 | // |
| 11732 | // ptr = upb_MiniTable_StartOneof(&e, ptr); |
| 11733 | // ptr = upb_MiniTable_PutOneofField(&e, ptr, ...); |
| 11734 | // ptr = upb_MiniTable_PutOneofField(&e, ptr, ...); |
| 11735 | // |
| 11736 | // Oneofs must be encoded after all regular fields. |
| 11737 | char* upb_MtDataEncoder_StartMessage(upb_MtDataEncoder* e, char* ptr, |
| 11738 | uint64_t msg_mod); |
| 11739 | char* upb_MtDataEncoder_PutField(upb_MtDataEncoder* e, char* ptr, |
| 11740 | upb_FieldType type, uint32_t field_num, |
| 11741 | uint64_t field_mod); |
| 11742 | char* upb_MtDataEncoder_StartOneof(upb_MtDataEncoder* e, char* ptr); |
| 11743 | char* upb_MtDataEncoder_PutOneofField(upb_MtDataEncoder* e, char* ptr, |
| 11744 | uint32_t field_num); |
| 11745 | |
| 11746 | // Encodes the set of values for a given enum. The values must be given in |
| 11747 | // order (after casting to uint32_t), and repeats are not allowed. |
| 11748 | char* upb_MtDataEncoder_StartEnum(upb_MtDataEncoder* e, char* ptr); |
| 11749 | char* upb_MtDataEncoder_PutEnumValue(upb_MtDataEncoder* e, char* ptr, |
| 11750 | uint32_t val); |
| 11751 | char* upb_MtDataEncoder_EndEnum(upb_MtDataEncoder* e, char* ptr); |
| 11752 | |
| 11753 | // Encodes an entire mini descriptor for an extension. |
| 11754 | char* upb_MtDataEncoder_EncodeExtension(upb_MtDataEncoder* e, char* ptr, |
| 11755 | upb_FieldType type, uint32_t field_num, |
| 11756 | uint64_t field_mod); |
| 11757 | |
| 11758 | // Encodes an entire mini descriptor for a map. |
| 11759 | char* upb_MtDataEncoder_EncodeMap(upb_MtDataEncoder* e, char* ptr, |
| 11760 | upb_FieldType key_type, |
Mike Kruskal | 3bc5049 | 2022-12-01 13:34:12 -0800 | [diff] [blame] | 11761 | upb_FieldType value_type, uint64_t key_mod, |
| 11762 | uint64_t value_mod); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11763 | |
| 11764 | // Encodes an entire mini descriptor for a message set. |
| 11765 | char* upb_MtDataEncoder_EncodeMessageSet(upb_MtDataEncoder* e, char* ptr); |
| 11766 | |
| 11767 | #ifdef __cplusplus |
| 11768 | } /* extern "C" */ |
| 11769 | #endif |
| 11770 | |
| 11771 | |
| 11772 | #endif /* UPB_MINI_TABLE_ENCODE_INTERNAL_H_ */ |
| 11773 | |
| 11774 | #ifndef UPB_REFLECTION_DEF_BUILDER_INTERNAL_H_ |
| 11775 | #define UPB_REFLECTION_DEF_BUILDER_INTERNAL_H_ |
| 11776 | |
| 11777 | |
| 11778 | #ifndef UPB_REFLECTION_DEF_POOL_INTERNAL_H_ |
| 11779 | #define UPB_REFLECTION_DEF_POOL_INTERNAL_H_ |
| 11780 | |
| 11781 | |
| 11782 | // Must be last. |
| 11783 | |
| 11784 | #ifdef __cplusplus |
| 11785 | extern "C" { |
| 11786 | #endif |
| 11787 | |
| 11788 | upb_Arena* _upb_DefPool_Arena(const upb_DefPool* s); |
| 11789 | size_t _upb_DefPool_BytesLoaded(const upb_DefPool* s); |
| 11790 | upb_ExtensionRegistry* _upb_DefPool_ExtReg(const upb_DefPool* s); |
| 11791 | |
| 11792 | bool _upb_DefPool_InsertExt(upb_DefPool* s, const upb_MiniTableExtension* ext, |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 11793 | const upb_FieldDef* f); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11794 | bool _upb_DefPool_InsertSym(upb_DefPool* s, upb_StringView sym, upb_value v, |
| 11795 | upb_Status* status); |
| 11796 | bool _upb_DefPool_LookupSym(const upb_DefPool* s, const char* sym, size_t size, |
| 11797 | upb_value* v); |
| 11798 | |
| 11799 | void** _upb_DefPool_ScratchData(const upb_DefPool* s); |
| 11800 | size_t* _upb_DefPool_ScratchSize(const upb_DefPool* s); |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 11801 | void _upb_DefPool_SetPlatform(upb_DefPool* s, upb_MiniTablePlatform platform); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11802 | |
| 11803 | // For generated code only: loads a generated descriptor. |
| 11804 | typedef struct _upb_DefPool_Init { |
| 11805 | struct _upb_DefPool_Init** deps; // Dependencies of this file. |
| 11806 | const upb_MiniTableFile* layout; |
| 11807 | const char* filename; |
| 11808 | upb_StringView descriptor; // Serialized descriptor. |
| 11809 | } _upb_DefPool_Init; |
| 11810 | |
| 11811 | bool _upb_DefPool_LoadDefInit(upb_DefPool* s, const _upb_DefPool_Init* init); |
| 11812 | |
| 11813 | // Should only be directly called by tests. This variant lets us suppress |
| 11814 | // the use of compiled-in tables, forcing a rebuild of the tables at runtime. |
| 11815 | bool _upb_DefPool_LoadDefInitEx(upb_DefPool* s, const _upb_DefPool_Init* init, |
| 11816 | bool rebuild_minitable); |
| 11817 | |
| 11818 | #ifdef __cplusplus |
| 11819 | } /* extern "C" */ |
| 11820 | #endif |
| 11821 | |
| 11822 | |
| 11823 | #endif /* UPB_REFLECTION_DEF_POOL_INTERNAL_H_ */ |
| 11824 | |
| 11825 | // Must be last. |
| 11826 | |
| 11827 | // We want to copy the options verbatim into the destination options proto. |
| 11828 | // We use serialize+parse as our deep copy. |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 11829 | #define UPB_DEF_SET_OPTIONS(target, desc_type, options_type, proto) \ |
| 11830 | if (UPB_DESC(desc_type##_has_options)(proto)) { \ |
| 11831 | size_t size; \ |
| 11832 | char* pb = UPB_DESC(options_type##_serialize)( \ |
| 11833 | UPB_DESC(desc_type##_options)(proto), ctx->tmp_arena, &size); \ |
| 11834 | if (!pb) _upb_DefBuilder_OomErr(ctx); \ |
| 11835 | target = \ |
| 11836 | UPB_DESC(options_type##_parse)(pb, size, _upb_DefBuilder_Arena(ctx)); \ |
| 11837 | if (!target) _upb_DefBuilder_OomErr(ctx); \ |
| 11838 | } else { \ |
| 11839 | target = (const UPB_DESC(options_type)*)kUpbDefOptDefault; \ |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11840 | } |
| 11841 | |
| 11842 | #ifdef __cplusplus |
| 11843 | extern "C" { |
| 11844 | #endif |
| 11845 | |
| 11846 | struct upb_DefBuilder { |
| 11847 | upb_DefPool* symtab; |
| 11848 | upb_FileDef* file; // File we are building. |
| 11849 | upb_Arena* arena; // Allocate defs here. |
| 11850 | upb_Arena* tmp_arena; // For temporary allocations. |
| 11851 | upb_Status* status; // Record errors here. |
| 11852 | const upb_MiniTableFile* layout; // NULL if we should build layouts. |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 11853 | upb_MiniTablePlatform platform; // Platform we are targeting. |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11854 | int enum_count; // Count of enums built so far. |
| 11855 | int msg_count; // Count of messages built so far. |
| 11856 | int ext_count; // Count of extensions built so far. |
| 11857 | jmp_buf err; // longjmp() on error. |
| 11858 | }; |
| 11859 | |
| 11860 | extern const char* kUpbDefOptDefault; |
| 11861 | |
| 11862 | // ctx->status has already been set elsewhere so just fail/longjmp() |
| 11863 | UPB_NORETURN void _upb_DefBuilder_FailJmp(upb_DefBuilder* ctx); |
| 11864 | |
| 11865 | UPB_NORETURN void _upb_DefBuilder_Errf(upb_DefBuilder* ctx, const char* fmt, |
| 11866 | ...) UPB_PRINTF(2, 3); |
| 11867 | UPB_NORETURN void _upb_DefBuilder_OomErr(upb_DefBuilder* ctx); |
| 11868 | |
| 11869 | const char* _upb_DefBuilder_MakeFullName(upb_DefBuilder* ctx, |
| 11870 | const char* prefix, |
| 11871 | upb_StringView name); |
| 11872 | |
| 11873 | // Given a symbol and the base symbol inside which it is defined, |
| 11874 | // find the symbol's definition. |
| 11875 | const void* _upb_DefBuilder_ResolveAny(upb_DefBuilder* ctx, |
| 11876 | const char* from_name_dbg, |
| 11877 | const char* base, upb_StringView sym, |
| 11878 | upb_deftype_t* type); |
| 11879 | |
| 11880 | const void* _upb_DefBuilder_Resolve(upb_DefBuilder* ctx, |
| 11881 | const char* from_name_dbg, const char* base, |
| 11882 | upb_StringView sym, upb_deftype_t type); |
| 11883 | |
| 11884 | char _upb_DefBuilder_ParseEscape(upb_DefBuilder* ctx, const upb_FieldDef* f, |
| 11885 | const char** src, const char* end); |
| 11886 | |
| 11887 | const char* _upb_DefBuilder_FullToShort(const char* fullname); |
| 11888 | |
| 11889 | UPB_INLINE void* _upb_DefBuilder_Alloc(upb_DefBuilder* ctx, size_t bytes) { |
| 11890 | if (bytes == 0) return NULL; |
| 11891 | void* ret = upb_Arena_Malloc(ctx->arena, bytes); |
| 11892 | if (!ret) _upb_DefBuilder_OomErr(ctx); |
| 11893 | return ret; |
| 11894 | } |
| 11895 | |
| 11896 | // Adds a symbol |v| to the symtab, which must be a def pointer previously |
| 11897 | // packed with pack_def(). The def's pointer to upb_FileDef* must be set before |
| 11898 | // adding, so we know which entries to remove if building this file fails. |
| 11899 | UPB_INLINE void _upb_DefBuilder_Add(upb_DefBuilder* ctx, const char* name, |
| 11900 | upb_value v) { |
| 11901 | upb_StringView sym = {.data = name, .size = strlen(name)}; |
| 11902 | bool ok = _upb_DefPool_InsertSym(ctx->symtab, sym, v, ctx->status); |
| 11903 | if (!ok) _upb_DefBuilder_FailJmp(ctx); |
| 11904 | } |
| 11905 | |
| 11906 | UPB_INLINE upb_Arena* _upb_DefBuilder_Arena(const upb_DefBuilder* ctx) { |
| 11907 | return ctx->arena; |
| 11908 | } |
| 11909 | |
| 11910 | UPB_INLINE upb_FileDef* _upb_DefBuilder_File(const upb_DefBuilder* ctx) { |
| 11911 | return ctx->file; |
| 11912 | } |
| 11913 | |
| 11914 | // This version of CheckIdent() is only called by other, faster versions after |
| 11915 | // they detect a parsing error. |
| 11916 | void _upb_DefBuilder_CheckIdentSlow(upb_DefBuilder* ctx, upb_StringView name, |
| 11917 | bool full); |
| 11918 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11919 | // Verify a full identifier string. This is slightly more complicated than |
| 11920 | // verifying a relative identifier string because we must track '.' chars. |
| 11921 | UPB_INLINE void _upb_DefBuilder_CheckIdentFull(upb_DefBuilder* ctx, |
| 11922 | upb_StringView name) { |
| 11923 | bool good = name.size > 0; |
| 11924 | bool start = true; |
| 11925 | |
| 11926 | for (size_t i = 0; i < name.size; i++) { |
| 11927 | const char c = name.data[i]; |
| 11928 | const char d = c | 0x20; // force lowercase |
| 11929 | const bool is_alpha = (('a' <= d) & (d <= 'z')) | (c == '_'); |
| 11930 | const bool is_numer = ('0' <= c) & (c <= '9') & !start; |
| 11931 | const bool is_dot = (c == '.') & !start; |
| 11932 | |
| 11933 | good &= is_alpha | is_numer | is_dot; |
| 11934 | start = is_dot; |
| 11935 | } |
| 11936 | |
| 11937 | if (!good) _upb_DefBuilder_CheckIdentSlow(ctx, name, true); |
| 11938 | } |
| 11939 | |
| 11940 | #ifdef __cplusplus |
| 11941 | } /* extern "C" */ |
| 11942 | #endif |
| 11943 | |
| 11944 | |
| 11945 | #endif /* UPB_REFLECTION_DEF_BUILDER_INTERNAL_H_ */ |
| 11946 | |
| 11947 | #ifndef UPB_REFLECTION_ENUM_DEF_INTERNAL_H_ |
| 11948 | #define UPB_REFLECTION_ENUM_DEF_INTERNAL_H_ |
| 11949 | |
| 11950 | |
| 11951 | // Must be last. |
| 11952 | |
| 11953 | #ifdef __cplusplus |
| 11954 | extern "C" { |
| 11955 | #endif |
| 11956 | |
| 11957 | upb_EnumDef* _upb_EnumDef_At(const upb_EnumDef* e, int i); |
| 11958 | bool _upb_EnumDef_Insert(upb_EnumDef* e, upb_EnumValueDef* v, upb_Arena* a); |
| 11959 | const upb_MiniTableEnum* _upb_EnumDef_MiniTable(const upb_EnumDef* e); |
| 11960 | |
| 11961 | // Allocate and initialize an array of |n| enum defs. |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 11962 | upb_EnumDef* _upb_EnumDefs_New( |
| 11963 | upb_DefBuilder* ctx, int n, |
| 11964 | const UPB_DESC(EnumDescriptorProto) * const* protos, |
| 11965 | const upb_MessageDef* containing_type); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11966 | |
| 11967 | #ifdef __cplusplus |
| 11968 | } /* extern "C" */ |
| 11969 | #endif |
| 11970 | |
| 11971 | |
| 11972 | #endif /* UPB_REFLECTION_ENUM_DEF_INTERNAL_H_ */ |
| 11973 | |
| 11974 | #ifndef UPB_REFLECTION_ENUM_VALUE_DEF_INTERNAL_H_ |
| 11975 | #define UPB_REFLECTION_ENUM_VALUE_DEF_INTERNAL_H_ |
| 11976 | |
| 11977 | |
| 11978 | // Must be last. |
| 11979 | |
| 11980 | #ifdef __cplusplus |
| 11981 | extern "C" { |
| 11982 | #endif |
| 11983 | |
| 11984 | upb_EnumValueDef* _upb_EnumValueDef_At(const upb_EnumValueDef* v, int i); |
| 11985 | |
| 11986 | // Allocate and initialize an array of |n| enum value defs owned by |e|. |
| 11987 | upb_EnumValueDef* _upb_EnumValueDefs_New( |
| 11988 | upb_DefBuilder* ctx, const char* prefix, int n, |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 11989 | const UPB_DESC(EnumValueDescriptorProto) * const* protos, upb_EnumDef* e, |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 11990 | bool* is_sorted); |
| 11991 | |
| 11992 | const upb_EnumValueDef** _upb_EnumValueDefs_Sorted(const upb_EnumValueDef* v, |
| 11993 | int n, upb_Arena* a); |
| 11994 | |
| 11995 | #ifdef __cplusplus |
| 11996 | } /* extern "C" */ |
| 11997 | #endif |
| 11998 | |
| 11999 | |
| 12000 | #endif /* UPB_REFLECTION_ENUM_VALUE_DEF_INTERNAL_H_ */ |
| 12001 | |
| 12002 | #ifndef UPB_REFLECTION_FIELD_DEF_INTERNAL_H_ |
| 12003 | #define UPB_REFLECTION_FIELD_DEF_INTERNAL_H_ |
| 12004 | |
| 12005 | |
| 12006 | // Must be last. |
| 12007 | |
| 12008 | #ifdef __cplusplus |
| 12009 | extern "C" { |
| 12010 | #endif |
| 12011 | |
| 12012 | upb_FieldDef* _upb_FieldDef_At(const upb_FieldDef* f, int i); |
| 12013 | |
| 12014 | const upb_MiniTableExtension* _upb_FieldDef_ExtensionMiniTable( |
| 12015 | const upb_FieldDef* f); |
| 12016 | bool _upb_FieldDef_IsClosedEnum(const upb_FieldDef* f); |
| 12017 | bool _upb_FieldDef_IsProto3Optional(const upb_FieldDef* f); |
| 12018 | int _upb_FieldDef_LayoutIndex(const upb_FieldDef* f); |
| 12019 | uint64_t _upb_FieldDef_Modifiers(const upb_FieldDef* f); |
| 12020 | void _upb_FieldDef_Resolve(upb_DefBuilder* ctx, const char* prefix, |
| 12021 | upb_FieldDef* f); |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 12022 | void _upb_FieldDef_BuildMiniTableExtension(upb_DefBuilder* ctx, |
| 12023 | const upb_FieldDef* f); |
| 12024 | |
| 12025 | // Allocate and initialize an array of |n| extensions (field defs). |
| 12026 | upb_FieldDef* _upb_Extensions_New( |
| 12027 | upb_DefBuilder* ctx, int n, |
| 12028 | const UPB_DESC(FieldDescriptorProto) * const* protos, const char* prefix, |
| 12029 | upb_MessageDef* m); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12030 | |
| 12031 | // Allocate and initialize an array of |n| field defs. |
| 12032 | upb_FieldDef* _upb_FieldDefs_New( |
| 12033 | upb_DefBuilder* ctx, int n, |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 12034 | const UPB_DESC(FieldDescriptorProto) * const* protos, const char* prefix, |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12035 | upb_MessageDef* m, bool* is_sorted); |
| 12036 | |
| 12037 | // Allocate and return a list of pointers to the |n| field defs in |ff|, |
| 12038 | // sorted by field number. |
| 12039 | const upb_FieldDef** _upb_FieldDefs_Sorted(const upb_FieldDef* f, int n, |
| 12040 | upb_Arena* a); |
| 12041 | |
| 12042 | #ifdef __cplusplus |
| 12043 | } /* extern "C" */ |
| 12044 | #endif |
| 12045 | |
| 12046 | |
| 12047 | #endif /* UPB_REFLECTION_FIELD_DEF_INTERNAL_H_ */ |
| 12048 | |
| 12049 | #ifndef UPB_REFLECTION_FILE_DEF_INTERNAL_H_ |
| 12050 | #define UPB_REFLECTION_FILE_DEF_INTERNAL_H_ |
| 12051 | |
| 12052 | |
| 12053 | // Must be last. |
| 12054 | |
| 12055 | #ifdef __cplusplus |
| 12056 | extern "C" { |
| 12057 | #endif |
| 12058 | |
| 12059 | const upb_MiniTableExtension* _upb_FileDef_ExtensionMiniTable( |
| 12060 | const upb_FileDef* f, int i); |
| 12061 | const int32_t* _upb_FileDef_PublicDependencyIndexes(const upb_FileDef* f); |
| 12062 | const int32_t* _upb_FileDef_WeakDependencyIndexes(const upb_FileDef* f); |
| 12063 | |
| 12064 | // upb_FileDef_Package() returns "" if f->package is NULL, this does not. |
| 12065 | const char* _upb_FileDef_RawPackage(const upb_FileDef* f); |
| 12066 | |
| 12067 | void _upb_FileDef_Create(upb_DefBuilder* ctx, |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 12068 | const UPB_DESC(FileDescriptorProto) * file_proto); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12069 | |
| 12070 | #ifdef __cplusplus |
| 12071 | } /* extern "C" */ |
| 12072 | #endif |
| 12073 | |
| 12074 | |
| 12075 | #endif /* UPB_REFLECTION_FILE_DEF_INTERNAL_H_ */ |
| 12076 | |
| 12077 | #ifndef UPB_REFLECTION_MESSAGE_DEF_INTERNAL_H_ |
| 12078 | #define UPB_REFLECTION_MESSAGE_DEF_INTERNAL_H_ |
| 12079 | |
| 12080 | |
| 12081 | // Must be last. |
| 12082 | |
| 12083 | #ifdef __cplusplus |
| 12084 | extern "C" { |
| 12085 | #endif |
| 12086 | |
| 12087 | upb_MessageDef* _upb_MessageDef_At(const upb_MessageDef* m, int i); |
| 12088 | bool _upb_MessageDef_InMessageSet(const upb_MessageDef* m); |
| 12089 | bool _upb_MessageDef_Insert(upb_MessageDef* m, const char* name, size_t size, |
| 12090 | upb_value v, upb_Arena* a); |
| 12091 | void _upb_MessageDef_InsertField(upb_DefBuilder* ctx, upb_MessageDef* m, |
| 12092 | const upb_FieldDef* f); |
| 12093 | bool _upb_MessageDef_IsValidExtensionNumber(const upb_MessageDef* m, int n); |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 12094 | void _upb_MessageDef_CreateMiniTable(upb_DefBuilder* ctx, upb_MessageDef* m); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12095 | void _upb_MessageDef_LinkMiniTable(upb_DefBuilder* ctx, |
| 12096 | const upb_MessageDef* m); |
| 12097 | void _upb_MessageDef_Resolve(upb_DefBuilder* ctx, upb_MessageDef* m); |
| 12098 | |
| 12099 | // Allocate and initialize an array of |n| message defs. |
| 12100 | upb_MessageDef* _upb_MessageDefs_New( |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 12101 | upb_DefBuilder* ctx, int n, const UPB_DESC(DescriptorProto) * const* protos, |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12102 | const upb_MessageDef* containing_type); |
| 12103 | |
| 12104 | #ifdef __cplusplus |
| 12105 | } /* extern "C" */ |
| 12106 | #endif |
| 12107 | |
| 12108 | |
| 12109 | #endif /* UPB_REFLECTION_MESSAGE_DEF_INTERNAL_H_ */ |
| 12110 | |
| 12111 | #ifndef UPB_REFLECTION_SERVICE_DEF_INTERNAL_H_ |
| 12112 | #define UPB_REFLECTION_SERVICE_DEF_INTERNAL_H_ |
| 12113 | |
| 12114 | |
| 12115 | // Must be last. |
| 12116 | |
| 12117 | #ifdef __cplusplus |
| 12118 | extern "C" { |
| 12119 | #endif |
| 12120 | |
| 12121 | upb_ServiceDef* _upb_ServiceDef_At(const upb_ServiceDef* s, int i); |
| 12122 | |
| 12123 | // Allocate and initialize an array of |n| service defs. |
| 12124 | upb_ServiceDef* _upb_ServiceDefs_New( |
| 12125 | upb_DefBuilder* ctx, int n, |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 12126 | const UPB_DESC(ServiceDescriptorProto) * const* protos); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12127 | |
| 12128 | #ifdef __cplusplus |
| 12129 | } /* extern "C" */ |
| 12130 | #endif |
| 12131 | |
| 12132 | |
| 12133 | #endif /* UPB_REFLECTION_SERVICE_DEF_INTERNAL_H_ */ |
| 12134 | |
| 12135 | #ifndef UPB_REFLECTION_DESC_STATE_INTERNAL_H_ |
| 12136 | #define UPB_REFLECTION_DESC_STATE_INTERNAL_H_ |
| 12137 | |
| 12138 | |
| 12139 | // Must be last. |
| 12140 | |
| 12141 | // Manages the storage for mini descriptor strings as they are being encoded. |
| 12142 | // TODO(b/234740652): Move some of this state directly into the encoder, maybe. |
| 12143 | typedef struct { |
| 12144 | upb_MtDataEncoder e; |
| 12145 | size_t bufsize; |
| 12146 | char* buf; |
| 12147 | char* ptr; |
| 12148 | } upb_DescState; |
| 12149 | |
| 12150 | #ifdef __cplusplus |
| 12151 | extern "C" { |
| 12152 | #endif |
| 12153 | |
| 12154 | UPB_INLINE void _upb_DescState_Init(upb_DescState* d) { |
| 12155 | d->bufsize = kUpb_MtDataEncoder_MinSize * 2; |
| 12156 | d->buf = NULL; |
| 12157 | d->ptr = NULL; |
| 12158 | } |
| 12159 | |
| 12160 | bool _upb_DescState_Grow(upb_DescState* d, upb_Arena* a); |
| 12161 | |
| 12162 | #ifdef __cplusplus |
| 12163 | } /* extern "C" */ |
| 12164 | #endif |
| 12165 | |
| 12166 | |
| 12167 | #endif /* UPB_REFLECTION_DESC_STATE_INTERNAL_H_ */ |
| 12168 | |
| 12169 | #ifndef UPB_REFLECTION_ENUM_RESERVED_RANGE_INTERNAL_H_ |
| 12170 | #define UPB_REFLECTION_ENUM_RESERVED_RANGE_INTERNAL_H_ |
| 12171 | |
| 12172 | |
| 12173 | // IWYU pragma: private, include "upb/reflection/def.h" |
| 12174 | |
| 12175 | #ifndef UPB_REFLECTION_ENUM_RESERVED_RANGE_H_ |
| 12176 | #define UPB_REFLECTION_ENUM_RESERVED_RANGE_H_ |
| 12177 | |
| 12178 | |
| 12179 | // Must be last. |
| 12180 | |
| 12181 | #ifdef __cplusplus |
| 12182 | extern "C" { |
| 12183 | #endif |
| 12184 | |
| 12185 | int32_t upb_EnumReservedRange_Start(const upb_EnumReservedRange* r); |
| 12186 | int32_t upb_EnumReservedRange_End(const upb_EnumReservedRange* r); |
| 12187 | |
| 12188 | #ifdef __cplusplus |
| 12189 | } /* extern "C" */ |
| 12190 | #endif |
| 12191 | |
| 12192 | |
| 12193 | #endif /* UPB_REFLECTION_ENUM_RESERVED_RANGE_H_ */ |
| 12194 | |
| 12195 | // Must be last. |
| 12196 | |
| 12197 | #ifdef __cplusplus |
| 12198 | extern "C" { |
| 12199 | #endif |
| 12200 | |
| 12201 | upb_EnumReservedRange* _upb_EnumReservedRange_At(const upb_EnumReservedRange* r, |
| 12202 | int i); |
| 12203 | |
| 12204 | // Allocate and initialize an array of |n| reserved ranges owned by |e|. |
| 12205 | upb_EnumReservedRange* _upb_EnumReservedRanges_New( |
| 12206 | upb_DefBuilder* ctx, int n, |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 12207 | const UPB_DESC(EnumDescriptorProto_EnumReservedRange) * const* protos, |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12208 | const upb_EnumDef* e); |
| 12209 | |
| 12210 | #ifdef __cplusplus |
| 12211 | } /* extern "C" */ |
| 12212 | #endif |
| 12213 | |
| 12214 | |
| 12215 | #endif /* UPB_REFLECTION_ENUM_RESERVED_RANGE_INTERNAL_H_ */ |
| 12216 | |
| 12217 | #ifndef UPB_REFLECTION_EXTENSION_RANGE_INTERNAL_H_ |
| 12218 | #define UPB_REFLECTION_EXTENSION_RANGE_INTERNAL_H_ |
| 12219 | |
| 12220 | |
| 12221 | // Must be last. |
| 12222 | |
| 12223 | #ifdef __cplusplus |
| 12224 | extern "C" { |
| 12225 | #endif |
| 12226 | |
| 12227 | upb_ExtensionRange* _upb_ExtensionRange_At(const upb_ExtensionRange* r, int i); |
| 12228 | |
| 12229 | // Allocate and initialize an array of |n| extension ranges owned by |m|. |
| 12230 | upb_ExtensionRange* _upb_ExtensionRanges_New( |
| 12231 | upb_DefBuilder* ctx, int n, |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 12232 | const UPB_DESC(DescriptorProto_ExtensionRange) * const* protos, |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12233 | const upb_MessageDef* m); |
| 12234 | |
| 12235 | #ifdef __cplusplus |
| 12236 | } /* extern "C" */ |
| 12237 | #endif |
| 12238 | |
| 12239 | |
| 12240 | #endif /* UPB_REFLECTION_EXTENSION_RANGE_INTERNAL_H_ */ |
| 12241 | |
| 12242 | #ifndef UPB_REFLECTION_ONEOF_DEF_INTERNAL_H_ |
| 12243 | #define UPB_REFLECTION_ONEOF_DEF_INTERNAL_H_ |
| 12244 | |
| 12245 | |
| 12246 | // Must be last. |
| 12247 | |
| 12248 | #ifdef __cplusplus |
| 12249 | extern "C" { |
| 12250 | #endif |
| 12251 | |
| 12252 | upb_OneofDef* _upb_OneofDef_At(const upb_OneofDef* o, int i); |
Jakob Buchgraber | c0c79b2 | 2023-03-20 08:13:52 -0700 | [diff] [blame] | 12253 | void _upb_OneofDef_Insert(upb_DefBuilder* ctx, upb_OneofDef* o, |
| 12254 | const upb_FieldDef* f, const char* name, size_t size); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12255 | |
| 12256 | // Allocate and initialize an array of |n| oneof defs owned by |m|. |
| 12257 | upb_OneofDef* _upb_OneofDefs_New( |
| 12258 | upb_DefBuilder* ctx, int n, |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 12259 | const UPB_DESC(OneofDescriptorProto) * const* protos, upb_MessageDef* m); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12260 | |
| 12261 | size_t _upb_OneofDefs_Finalize(upb_DefBuilder* ctx, upb_MessageDef* m); |
| 12262 | |
| 12263 | #ifdef __cplusplus |
| 12264 | } /* extern "C" */ |
| 12265 | #endif |
| 12266 | |
| 12267 | |
| 12268 | #endif /* UPB_REFLECTION_ONEOF_DEF_INTERNAL_H_ */ |
| 12269 | |
| 12270 | #ifndef UPB_REFLECTION_MESSAGE_RESERVED_RANGE_INTERNAL_H_ |
| 12271 | #define UPB_REFLECTION_MESSAGE_RESERVED_RANGE_INTERNAL_H_ |
| 12272 | |
| 12273 | |
| 12274 | // IWYU pragma: private, include "upb/reflection/def.h" |
| 12275 | |
| 12276 | #ifndef UPB_REFLECTION_MESSAGE_RESERVED_RANGE_H_ |
| 12277 | #define UPB_REFLECTION_MESSAGE_RESERVED_RANGE_H_ |
| 12278 | |
| 12279 | |
| 12280 | // Must be last. |
| 12281 | |
| 12282 | #ifdef __cplusplus |
| 12283 | extern "C" { |
| 12284 | #endif |
| 12285 | |
| 12286 | int32_t upb_MessageReservedRange_Start(const upb_MessageReservedRange* r); |
| 12287 | int32_t upb_MessageReservedRange_End(const upb_MessageReservedRange* r); |
| 12288 | |
| 12289 | #ifdef __cplusplus |
| 12290 | } /* extern "C" */ |
| 12291 | #endif |
| 12292 | |
| 12293 | |
| 12294 | #endif /* UPB_REFLECTION_MESSAGE_RESERVED_RANGE_H_ */ |
| 12295 | |
| 12296 | // Must be last. |
| 12297 | |
| 12298 | #ifdef __cplusplus |
| 12299 | extern "C" { |
| 12300 | #endif |
| 12301 | |
| 12302 | upb_MessageReservedRange* _upb_MessageReservedRange_At( |
| 12303 | const upb_MessageReservedRange* r, int i); |
| 12304 | |
| 12305 | // Allocate and initialize an array of |n| reserved ranges owned by |m|. |
| 12306 | upb_MessageReservedRange* _upb_MessageReservedRanges_New( |
| 12307 | upb_DefBuilder* ctx, int n, |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 12308 | const UPB_DESC(DescriptorProto_ReservedRange) * const* protos, |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12309 | const upb_MessageDef* m); |
| 12310 | |
| 12311 | #ifdef __cplusplus |
| 12312 | } /* extern "C" */ |
| 12313 | #endif |
| 12314 | |
| 12315 | |
| 12316 | #endif /* UPB_REFLECTION_MESSAGE_RESERVED_RANGE_INTERNAL_H_ */ |
| 12317 | |
| 12318 | #ifndef UPB_REFLECTION_METHOD_DEF_INTERNAL_H_ |
| 12319 | #define UPB_REFLECTION_METHOD_DEF_INTERNAL_H_ |
| 12320 | |
| 12321 | |
| 12322 | // Must be last. |
| 12323 | |
| 12324 | #ifdef __cplusplus |
| 12325 | extern "C" { |
| 12326 | #endif |
| 12327 | |
| 12328 | upb_MethodDef* _upb_MethodDef_At(const upb_MethodDef* m, int i); |
| 12329 | |
| 12330 | // Allocate and initialize an array of |n| method defs owned by |s|. |
| 12331 | upb_MethodDef* _upb_MethodDefs_New( |
| 12332 | upb_DefBuilder* ctx, int n, |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 12333 | const UPB_DESC(MethodDescriptorProto) * const* protos, upb_ServiceDef* s); |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12334 | |
| 12335 | #ifdef __cplusplus |
| 12336 | } /* extern "C" */ |
| 12337 | #endif |
| 12338 | |
| 12339 | |
| 12340 | #endif /* UPB_REFLECTION_METHOD_DEF_INTERNAL_H_ */ |
| 12341 | |
| 12342 | #ifndef UPB_WIRE_COMMON_INTERNAL_H_ |
| 12343 | #define UPB_WIRE_COMMON_INTERNAL_H_ |
| 12344 | |
| 12345 | // Must be last. |
| 12346 | |
| 12347 | // MessageSet wire format is: |
| 12348 | // message MessageSet { |
| 12349 | // repeated group Item = 1 { |
| 12350 | // required int32 type_id = 2; |
| 12351 | // required bytes message = 3; |
| 12352 | // } |
| 12353 | // } |
| 12354 | |
| 12355 | enum { |
| 12356 | kUpb_MsgSet_Item = 1, |
| 12357 | kUpb_MsgSet_TypeId = 2, |
| 12358 | kUpb_MsgSet_Message = 3, |
| 12359 | }; |
| 12360 | |
| 12361 | |
| 12362 | #endif /* UPB_WIRE_COMMON_INTERNAL_H_ */ |
| 12363 | |
| 12364 | /* |
| 12365 | * Internal implementation details of the decoder that are shared between |
| 12366 | * decode.c and decode_fast.c. |
| 12367 | */ |
| 12368 | |
| 12369 | #ifndef UPB_WIRE_DECODE_INTERNAL_H_ |
| 12370 | #define UPB_WIRE_DECODE_INTERNAL_H_ |
| 12371 | |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 12372 | #include "utf8_range.h" |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 12373 | |
| 12374 | // Must be last. |
| 12375 | |
| 12376 | #define DECODE_NOGROUP (uint32_t) - 1 |
| 12377 | |
| 12378 | typedef struct upb_Decoder { |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 12379 | upb_EpsCopyInputStream input; |
| 12380 | const upb_ExtensionRegistry* extreg; |
| 12381 | const char* unknown; // Start of unknown data, preserve at buffer flip |
| 12382 | upb_Message* unknown_msg; // Pointer to preserve data to |
| 12383 | int depth; // Tracks recursion depth to bound stack usage. |
| 12384 | 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] | 12385 | uint16_t options; |
| 12386 | bool missing_required; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 12387 | upb_Arena arena; |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 12388 | upb_DecodeStatus status; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 12389 | jmp_buf err; |
| 12390 | |
| 12391 | #ifndef NDEBUG |
| 12392 | const char* debug_tagstart; |
| 12393 | const char* debug_valstart; |
| 12394 | #endif |
| 12395 | } upb_Decoder; |
| 12396 | |
| 12397 | /* Error function that will abort decoding with longjmp(). We can't declare this |
| 12398 | * UPB_NORETURN, even though it is appropriate, because if we do then compilers |
| 12399 | * will "helpfully" refuse to tailcall to it |
| 12400 | * (see: https://stackoverflow.com/a/55657013), which will defeat a major goal |
| 12401 | * of our optimizations. That is also why we must declare it in a separate file, |
| 12402 | * otherwise the compiler will see that it calls longjmp() and deduce that it is |
| 12403 | * noreturn. */ |
| 12404 | const char* _upb_FastDecoder_ErrorJmp(upb_Decoder* d, int status); |
| 12405 | |
| 12406 | extern const uint8_t upb_utf8_offsets[]; |
| 12407 | |
| 12408 | UPB_INLINE |
| 12409 | bool _upb_Decoder_VerifyUtf8Inline(const char* ptr, int len) { |
| 12410 | const char* end = ptr + len; |
| 12411 | |
| 12412 | // Check 8 bytes at a time for any non-ASCII char. |
| 12413 | while (end - ptr >= 8) { |
| 12414 | uint64_t data; |
| 12415 | memcpy(&data, ptr, 8); |
| 12416 | if (data & 0x8080808080808080) goto non_ascii; |
| 12417 | ptr += 8; |
| 12418 | } |
| 12419 | |
| 12420 | // Check one byte at a time for non-ASCII. |
| 12421 | while (ptr < end) { |
| 12422 | if (*ptr & 0x80) goto non_ascii; |
| 12423 | ptr++; |
| 12424 | } |
| 12425 | |
| 12426 | return true; |
| 12427 | |
| 12428 | non_ascii: |
| 12429 | return utf8_range2((const unsigned char*)ptr, end - ptr) == 0; |
| 12430 | } |
| 12431 | |
| 12432 | const char* _upb_Decoder_CheckRequired(upb_Decoder* d, const char* ptr, |
| 12433 | const upb_Message* msg, |
| 12434 | const upb_MiniTable* l); |
| 12435 | |
| 12436 | /* x86-64 pointers always have the high 16 bits matching. So we can shift |
| 12437 | * left 8 and right 8 without loss of information. */ |
| 12438 | UPB_INLINE intptr_t decode_totable(const upb_MiniTable* tablep) { |
| 12439 | return ((intptr_t)tablep << 8) | tablep->table_mask; |
| 12440 | } |
| 12441 | |
| 12442 | UPB_INLINE const upb_MiniTable* decode_totablep(intptr_t table) { |
| 12443 | return (const upb_MiniTable*)(table >> 8); |
| 12444 | } |
| 12445 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 12446 | const char* _upb_Decoder_IsDoneFallback(upb_EpsCopyInputStream* e, |
| 12447 | const char* ptr, int overrun); |
| 12448 | |
| 12449 | UPB_INLINE bool _upb_Decoder_IsDone(upb_Decoder* d, const char** ptr) { |
Eric Salo | b7d54ac | 2022-12-29 11:59:42 -0800 | [diff] [blame] | 12450 | return upb_EpsCopyInputStream_IsDoneWithCallback( |
| 12451 | &d->input, ptr, &_upb_Decoder_IsDoneFallback); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 12452 | } |
| 12453 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 12454 | UPB_INLINE const char* _upb_Decoder_BufferFlipCallback( |
| 12455 | upb_EpsCopyInputStream* e, const char* old_end, const char* new_start) { |
| 12456 | upb_Decoder* d = (upb_Decoder*)e; |
| 12457 | if (!old_end) _upb_FastDecoder_ErrorJmp(d, kUpb_DecodeStatus_Malformed); |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 12458 | |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 12459 | if (d->unknown) { |
| 12460 | if (!_upb_Message_AddUnknown(d->unknown_msg, d->unknown, |
| 12461 | old_end - d->unknown, &d->arena)) { |
| 12462 | _upb_FastDecoder_ErrorJmp(d, kUpb_DecodeStatus_OutOfMemory); |
| 12463 | } |
| 12464 | d->unknown = new_start; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 12465 | } |
Eric Salo | 1050599 | 2022-12-12 12:16:36 -0800 | [diff] [blame] | 12466 | return new_start; |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 12467 | } |
| 12468 | |
| 12469 | #if UPB_FASTTABLE |
| 12470 | UPB_INLINE |
| 12471 | const char* _upb_FastDecoder_TagDispatch(upb_Decoder* d, const char* ptr, |
| 12472 | upb_Message* msg, intptr_t table, |
| 12473 | uint64_t hasbits, uint64_t tag) { |
| 12474 | const upb_MiniTable* table_p = decode_totablep(table); |
| 12475 | uint8_t mask = table; |
| 12476 | uint64_t data; |
| 12477 | size_t idx = tag & mask; |
| 12478 | UPB_ASSUME((idx & 7) == 0); |
| 12479 | idx >>= 3; |
| 12480 | data = table_p->fasttable[idx].field_data ^ tag; |
| 12481 | UPB_MUSTTAIL return table_p->fasttable[idx].field_parser(d, ptr, msg, table, |
| 12482 | hasbits, data); |
| 12483 | } |
| 12484 | #endif |
| 12485 | |
| 12486 | UPB_INLINE uint32_t _upb_FastDecoder_LoadTag(const char* ptr) { |
| 12487 | uint16_t tag; |
| 12488 | memcpy(&tag, ptr, 2); |
| 12489 | return tag; |
| 12490 | } |
| 12491 | |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 12492 | |
Mike Kruskal | 9cf9db8 | 2022-11-04 21:22:31 -0700 | [diff] [blame] | 12493 | #endif /* UPB_WIRE_DECODE_INTERNAL_H_ */ |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 12494 | |
Eric Salo | 8809a11 | 2022-11-21 13:01:06 -0800 | [diff] [blame] | 12495 | // This should #undef all macros #defined in def.inc |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 12496 | |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 12497 | #undef UPB_SIZE |
| 12498 | #undef UPB_PTR_AT |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 12499 | #undef UPB_MAPTYPE_STRING |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 12500 | #undef UPB_EXPORT |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 12501 | #undef UPB_INLINE |
Eric Salo | 3f36a91 | 2022-12-05 14:12:25 -0800 | [diff] [blame] | 12502 | #undef UPB_API |
| 12503 | #undef UPB_API_INLINE |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 12504 | #undef UPB_ALIGN_UP |
| 12505 | #undef UPB_ALIGN_DOWN |
| 12506 | #undef UPB_ALIGN_MALLOC |
| 12507 | #undef UPB_ALIGN_OF |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 12508 | #undef UPB_MALLOC_ALIGN |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 12509 | #undef UPB_LIKELY |
| 12510 | #undef UPB_UNLIKELY |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 12511 | #undef UPB_FORCEINLINE |
| 12512 | #undef UPB_NOINLINE |
| 12513 | #undef UPB_NORETURN |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 12514 | #undef UPB_PRINTF |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 12515 | #undef UPB_MAX |
| 12516 | #undef UPB_MIN |
| 12517 | #undef UPB_UNUSED |
| 12518 | #undef UPB_ASSUME |
| 12519 | #undef UPB_ASSERT |
| 12520 | #undef UPB_UNREACHABLE |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 12521 | #undef UPB_SETJMP |
| 12522 | #undef UPB_LONGJMP |
| 12523 | #undef UPB_PTRADD |
| 12524 | #undef UPB_MUSTTAIL |
| 12525 | #undef UPB_FASTTABLE_SUPPORTED |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 12526 | #undef UPB_FASTTABLE_MASK |
Joshua Haberman | dd69a48 | 2021-05-17 22:40:33 -0700 | [diff] [blame] | 12527 | #undef UPB_FASTTABLE |
| 12528 | #undef UPB_FASTTABLE_INIT |
Joshua Haberman | 9abf6e2 | 2021-01-13 12:16:25 -0800 | [diff] [blame] | 12529 | #undef UPB_POISON_MEMORY_REGION |
| 12530 | #undef UPB_UNPOISON_MEMORY_REGION |
| 12531 | #undef UPB_ASAN |
Joshua Haberman | 7ecf43f | 2022-03-14 13:11:29 -0700 | [diff] [blame] | 12532 | #undef UPB_TREAT_PROTO2_ENUMS_LIKE_PROTO3 |
Joshua Haberman | d3995ec | 2022-09-30 16:54:39 -0700 | [diff] [blame] | 12533 | #undef UPB_DEPRECATED |
| 12534 | #undef UPB_GNUC_MIN |
Mike Kruskal | 232ecf4 | 2023-01-14 00:09:40 -0800 | [diff] [blame] | 12535 | #undef UPB_DESCRIPTOR_UPB_H_FILENAME |
| 12536 | #undef UPB_DESC |
| 12537 | #undef UPB_IS_GOOGLE3 |
Eric Salo | dfb7155 | 2023-03-22 12:35:09 -0700 | [diff] [blame] | 12538 | #undef UPB_ATOMIC |
| 12539 | #undef UPB_USE_C11_ATOMICS |
Deanna Garcia | c7d979d | 2023-04-14 17:22:13 -0700 | [diff] [blame] | 12540 | #undef UPB_PRIVATE |