File indexing completed on 2025-01-18 10:13:17
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef UPB_MINI_TABLE_INTERNAL_EXTENSION_H_
0009 #define UPB_MINI_TABLE_INTERNAL_EXTENSION_H_
0010
0011 #include <stddef.h>
0012 #include <stdint.h>
0013
0014 #include "upb/base/descriptor_constants.h"
0015 #include "upb/mini_table/internal/field.h"
0016 #include "upb/mini_table/internal/sub.h"
0017
0018
0019 #include "upb/port/def.inc"
0020
0021 struct upb_MiniTableExtension {
0022
0023 struct upb_MiniTableField UPB_PRIVATE(field);
0024
0025 const struct upb_MiniTable* UPB_PRIVATE(extendee);
0026 union upb_MiniTableSub UPB_PRIVATE(sub);
0027 };
0028
0029 #ifdef __cplusplus
0030 extern "C" {
0031 #endif
0032
0033 UPB_API_INLINE upb_CType
0034 upb_MiniTableExtension_CType(const struct upb_MiniTableExtension* e) {
0035 return upb_MiniTableField_CType(&e->UPB_PRIVATE(field));
0036 }
0037
0038 UPB_API_INLINE uint32_t
0039 upb_MiniTableExtension_Number(const struct upb_MiniTableExtension* e) {
0040 return e->UPB_PRIVATE(field).UPB_ONLYBITS(number);
0041 }
0042
0043 UPB_API_INLINE const struct upb_MiniTable* upb_MiniTableExtension_GetSubMessage(
0044 const struct upb_MiniTableExtension* e) {
0045 if (upb_MiniTableExtension_CType(e) != kUpb_CType_Message) {
0046 return NULL;
0047 }
0048 return upb_MiniTableSub_Message(e->UPB_PRIVATE(sub));
0049 }
0050
0051 UPB_API_INLINE void upb_MiniTableExtension_SetSubMessage(
0052 struct upb_MiniTableExtension* e, const struct upb_MiniTable* m) {
0053 e->UPB_PRIVATE(sub).UPB_PRIVATE(submsg) = m;
0054 }
0055
0056 UPB_INLINE upb_FieldRep UPB_PRIVATE(_upb_MiniTableExtension_GetRep)(
0057 const struct upb_MiniTableExtension* e) {
0058 return UPB_PRIVATE(_upb_MiniTableField_GetRep)(&e->UPB_PRIVATE(field));
0059 }
0060
0061 #ifdef __cplusplus
0062 }
0063 #endif
0064
0065 #include "upb/port/undef.inc"
0066
0067 #endif