File indexing completed on 2025-01-18 10:13:17
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef UPB_MESSAGE_ACCESSORS_H_
0009 #define UPB_MESSAGE_ACCESSORS_H_
0010
0011 #include "upb/base/string_view.h"
0012 #include "upb/mem/arena.h"
0013 #include "upb/message/array.h"
0014 #include "upb/message/internal/accessors.h"
0015 #include "upb/message/map.h"
0016 #include "upb/message/message.h"
0017 #include "upb/message/tagged_ptr.h"
0018 #include "upb/message/value.h"
0019 #include "upb/mini_table/extension.h"
0020 #include "upb/mini_table/field.h"
0021 #include "upb/mini_table/message.h"
0022
0023
0024 #include "upb/port/def.inc"
0025
0026 #ifdef __cplusplus
0027 extern "C" {
0028 #endif
0029
0030
0031
0032
0033
0034
0035
0036 UPB_API_INLINE void upb_Message_Clear(upb_Message* msg, const upb_MiniTable* m);
0037
0038 UPB_API_INLINE void upb_Message_ClearBaseField(upb_Message* msg,
0039 const upb_MiniTableField* f);
0040
0041 UPB_API_INLINE void upb_Message_ClearExtension(upb_Message* msg,
0042 const upb_MiniTableExtension* e);
0043
0044 UPB_API_INLINE void upb_Message_ClearOneof(upb_Message* msg,
0045 const upb_MiniTable* m,
0046 const upb_MiniTableField* f);
0047
0048 UPB_API_INLINE bool upb_Message_HasBaseField(const upb_Message* msg,
0049 const upb_MiniTableField* f);
0050
0051 UPB_API_INLINE bool upb_Message_HasExtension(const upb_Message* msg,
0052 const upb_MiniTableExtension* e);
0053
0054 UPB_API_INLINE upb_MessageValue
0055 upb_Message_GetField(const upb_Message* msg, const upb_MiniTableField* f,
0056 upb_MessageValue default_val);
0057
0058 UPB_API_INLINE upb_TaggedMessagePtr upb_Message_GetTaggedMessagePtr(
0059 const upb_Message* msg, const upb_MiniTableField* field,
0060 upb_Message* default_val);
0061
0062 UPB_API_INLINE const upb_Array* upb_Message_GetArray(
0063 const upb_Message* msg, const upb_MiniTableField* f);
0064
0065 UPB_API_INLINE bool upb_Message_GetBool(const upb_Message* msg,
0066 const upb_MiniTableField* f,
0067 bool default_val);
0068
0069 UPB_API_INLINE double upb_Message_GetDouble(const upb_Message* msg,
0070 const upb_MiniTableField* field,
0071 double default_val);
0072
0073 UPB_API_INLINE float upb_Message_GetFloat(const upb_Message* msg,
0074 const upb_MiniTableField* f,
0075 float default_val);
0076
0077 UPB_API_INLINE int32_t upb_Message_GetInt32(const upb_Message* msg,
0078 const upb_MiniTableField* f,
0079 int32_t default_val);
0080
0081 UPB_API_INLINE int64_t upb_Message_GetInt64(const upb_Message* msg,
0082 const upb_MiniTableField* f,
0083 int64_t default_val);
0084
0085 UPB_API_INLINE const upb_Map* upb_Message_GetMap(const upb_Message* msg,
0086 const upb_MiniTableField* f);
0087
0088 UPB_API_INLINE const upb_Message* upb_Message_GetMessage(
0089 const upb_Message* msg, const upb_MiniTableField* f);
0090
0091 UPB_API_INLINE upb_Array* upb_Message_GetMutableArray(
0092 upb_Message* msg, const upb_MiniTableField* f);
0093
0094 UPB_API_INLINE upb_Map* upb_Message_GetMutableMap(upb_Message* msg,
0095 const upb_MiniTableField* f);
0096
0097 UPB_API_INLINE upb_Message* upb_Message_GetMutableMessage(
0098 upb_Message* msg, const upb_MiniTableField* f);
0099
0100 UPB_API_INLINE upb_Array* upb_Message_GetOrCreateMutableArray(
0101 upb_Message* msg, const upb_MiniTableField* f, upb_Arena* arena);
0102
0103 UPB_API_INLINE upb_Map* upb_Message_GetOrCreateMutableMap(
0104 upb_Message* msg, const upb_MiniTable* map_entry_mini_table,
0105 const upb_MiniTableField* f, upb_Arena* arena);
0106
0107 UPB_API_INLINE upb_Message* upb_Message_GetOrCreateMutableMessage(
0108 upb_Message* msg, const upb_MiniTable* mini_table,
0109 const upb_MiniTableField* f, upb_Arena* arena);
0110
0111 UPB_API_INLINE upb_StringView
0112 upb_Message_GetString(const upb_Message* msg, const upb_MiniTableField* field,
0113 upb_StringView default_val);
0114
0115 UPB_API_INLINE uint32_t upb_Message_GetUInt32(const upb_Message* msg,
0116 const upb_MiniTableField* f,
0117 uint32_t default_val);
0118
0119 UPB_API_INLINE uint64_t upb_Message_GetUInt64(const upb_Message* msg,
0120 const upb_MiniTableField* f,
0121 uint64_t default_val);
0122
0123 UPB_API_INLINE void upb_Message_SetClosedEnum(
0124 upb_Message* msg, const upb_MiniTable* msg_mini_table,
0125 const upb_MiniTableField* f, int32_t value);
0126
0127
0128
0129 UPB_API_INLINE void upb_Message_SetBaseField(upb_Message* msg,
0130 const upb_MiniTableField* f,
0131 const void* val);
0132
0133 UPB_API_INLINE void upb_Message_SetBaseFieldBool(struct upb_Message* msg,
0134 const upb_MiniTableField* f,
0135 bool value);
0136
0137 UPB_API_INLINE void upb_Message_SetBaseFieldDouble(struct upb_Message* msg,
0138 const upb_MiniTableField* f,
0139 double value);
0140
0141 UPB_API_INLINE void upb_Message_SetBaseFieldFloat(struct upb_Message* msg,
0142 const upb_MiniTableField* f,
0143 float value);
0144
0145 UPB_API_INLINE void upb_Message_SetBaseFieldInt32(struct upb_Message* msg,
0146 const upb_MiniTableField* f,
0147 int32_t value);
0148
0149 UPB_API_INLINE void upb_Message_SetBaseFieldInt64(struct upb_Message* msg,
0150 const upb_MiniTableField* f,
0151 int64_t value);
0152
0153 UPB_API_INLINE void upb_Message_SetBaseFieldString(struct upb_Message* msg,
0154 const upb_MiniTableField* f,
0155 upb_StringView value);
0156
0157 UPB_API_INLINE void upb_Message_SetBaseFieldUInt32(struct upb_Message* msg,
0158 const upb_MiniTableField* f,
0159 uint32_t value);
0160
0161 UPB_API_INLINE void upb_Message_SetBaseFieldUInt64(struct upb_Message* msg,
0162 const upb_MiniTableField* f,
0163 uint64_t value);
0164
0165
0166
0167 UPB_API_INLINE bool upb_Message_SetExtension(upb_Message* msg,
0168 const upb_MiniTableExtension* e,
0169 const void* value, upb_Arena* a);
0170
0171 UPB_API_INLINE bool upb_Message_SetExtensionBool(
0172 struct upb_Message* msg, const upb_MiniTableExtension* e, bool value,
0173 upb_Arena* a);
0174
0175 UPB_API_INLINE bool upb_Message_SetExtensionDouble(
0176 struct upb_Message* msg, const upb_MiniTableExtension* e, double value,
0177 upb_Arena* a);
0178
0179 UPB_API_INLINE bool upb_Message_SetExtensionFloat(
0180 struct upb_Message* msg, const upb_MiniTableExtension* e, float value,
0181 upb_Arena* a);
0182
0183 UPB_API_INLINE bool upb_Message_SetExtensionInt32(
0184 struct upb_Message* msg, const upb_MiniTableExtension* e, int32_t value,
0185 upb_Arena* a);
0186
0187 UPB_API_INLINE bool upb_Message_SetExtensionInt64(
0188 struct upb_Message* msg, const upb_MiniTableExtension* e, int64_t value,
0189 upb_Arena* a);
0190
0191 UPB_API_INLINE bool upb_Message_SetExtensionString(
0192 struct upb_Message* msg, const upb_MiniTableExtension* e,
0193 upb_StringView value, upb_Arena* a);
0194
0195 UPB_API_INLINE bool upb_Message_SetExtensionUInt32(
0196 struct upb_Message* msg, const upb_MiniTableExtension* e, uint32_t value,
0197 upb_Arena* a);
0198
0199 UPB_API_INLINE bool upb_Message_SetExtensionUInt64(
0200 struct upb_Message* msg, const upb_MiniTableExtension* e, uint64_t value,
0201 upb_Arena* a);
0202
0203
0204
0205 UPB_API_INLINE bool upb_Message_SetBool(upb_Message* msg,
0206 const upb_MiniTableField* f, bool value,
0207 upb_Arena* a);
0208
0209 UPB_API_INLINE bool upb_Message_SetDouble(upb_Message* msg,
0210 const upb_MiniTableField* f,
0211 double value, upb_Arena* a);
0212
0213 UPB_API_INLINE bool upb_Message_SetFloat(upb_Message* msg,
0214 const upb_MiniTableField* f,
0215 float value, upb_Arena* a);
0216
0217 UPB_API_INLINE bool upb_Message_SetInt32(upb_Message* msg,
0218 const upb_MiniTableField* f,
0219 int32_t value, upb_Arena* a);
0220
0221 UPB_API_INLINE bool upb_Message_SetInt64(upb_Message* msg,
0222 const upb_MiniTableField* f,
0223 int64_t value, upb_Arena* a);
0224
0225 UPB_API_INLINE void upb_Message_SetMessage(upb_Message* msg,
0226 const upb_MiniTableField* f,
0227 upb_Message* value);
0228
0229 UPB_API_INLINE bool upb_Message_SetString(upb_Message* msg,
0230 const upb_MiniTableField* f,
0231 upb_StringView value, upb_Arena* a);
0232
0233 UPB_API_INLINE bool upb_Message_SetUInt32(upb_Message* msg,
0234 const upb_MiniTableField* f,
0235 uint32_t value, upb_Arena* a);
0236
0237 UPB_API_INLINE bool upb_Message_SetUInt64(upb_Message* msg,
0238 const upb_MiniTableField* f,
0239 uint64_t value, upb_Arena* a);
0240
0241
0242
0243 UPB_API_INLINE void* upb_Message_ResizeArrayUninitialized(
0244 upb_Message* msg, const upb_MiniTableField* f, size_t size,
0245 upb_Arena* arena);
0246
0247 UPB_API_INLINE uint32_t upb_Message_WhichOneofFieldNumber(
0248 const upb_Message* message, const upb_MiniTableField* oneof_field);
0249
0250
0251
0252 UPB_API_INLINE const upb_MiniTableField* upb_Message_WhichOneof(
0253 const upb_Message* msg, const upb_MiniTable* m,
0254 const upb_MiniTableField* f);
0255
0256
0257 bool upb_Message_SetMapEntry(upb_Map* map, const upb_MiniTable* mini_table,
0258 const upb_MiniTableField* field,
0259 upb_Message* map_entry_message, upb_Arena* arena);
0260
0261 #ifdef __cplusplus
0262 }
0263 #endif
0264
0265 #include "upb/port/undef.inc"
0266
0267 #endif