Go to the documentation of this file.
31 #ifndef GOOGLE_PROTOBUF_EXTENSION_SET_INL_H__
32 #define GOOGLE_PROTOBUF_EXTENSION_SET_INL_H__
41 #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
45 T*
metadata,
const char* ptr, internal::ParseContext* ctx) {
46 if (was_packed_on_wire) {
48 #define HANDLE_TYPE(UPPERCASE, CPP_CAMELCASE) \
49 case WireFormatLite::TYPE_##UPPERCASE: \
50 return internal::Packed##CPP_CAMELCASE##Parser( \
51 MutableRawRepeatedField(number, extension.type, extension.is_packed, \
52 extension.descriptor), \
73 ptr, ctx,
extension.enum_validity_check.func,
84 #define HANDLE_VARINT_TYPE(UPPERCASE, CPP_CAMELCASE) \
85 case WireFormatLite::TYPE_##UPPERCASE: { \
87 ptr = ParseVarint64(ptr, &value); \
88 GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); \
89 if (extension.is_repeated) { \
90 Add##CPP_CAMELCASE(number, WireFormatLite::TYPE_##UPPERCASE, \
91 extension.is_packed, value, extension.descriptor); \
93 Set##CPP_CAMELCASE(number, WireFormatLite::TYPE_##UPPERCASE, value, \
94 extension.descriptor); \
98 HANDLE_VARINT_TYPE(INT32,
Int32);
99 HANDLE_VARINT_TYPE(INT64,
Int64);
100 HANDLE_VARINT_TYPE(UINT32,
UInt32);
101 HANDLE_VARINT_TYPE(UINT64,
UInt64);
102 #undef HANDLE_VARINT_TYPE
103 #define HANDLE_SVARINT_TYPE(UPPERCASE, CPP_CAMELCASE, SIZE) \
104 case WireFormatLite::TYPE_##UPPERCASE: { \
106 ptr = ParseVarint64(ptr, &val); \
107 GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); \
108 auto value = WireFormatLite::ZigZagDecode##SIZE(val); \
109 if (extension.is_repeated) { \
110 Add##CPP_CAMELCASE(number, WireFormatLite::TYPE_##UPPERCASE, \
111 extension.is_packed, value, extension.descriptor); \
113 Set##CPP_CAMELCASE(number, WireFormatLite::TYPE_##UPPERCASE, value, \
114 extension.descriptor); \
118 HANDLE_SVARINT_TYPE(SINT32,
Int32, 32);
119 HANDLE_SVARINT_TYPE(SINT64,
Int64, 64);
120 #undef HANDLE_SVARINT_TYPE
121 #define HANDLE_FIXED_TYPE(UPPERCASE, CPP_CAMELCASE, CPPTYPE) \
122 case WireFormatLite::TYPE_##UPPERCASE: { \
124 std::memcpy(&value, ptr, sizeof(CPPTYPE)); \
125 ptr += sizeof(CPPTYPE); \
126 if (extension.is_repeated) { \
127 Add##CPP_CAMELCASE(number, WireFormatLite::TYPE_##UPPERCASE, \
128 extension.is_packed, value, extension.descriptor); \
130 Set##CPP_CAMELCASE(number, WireFormatLite::TYPE_##UPPERCASE, value, \
131 extension.descriptor); \
142 #undef HANDLE_FIXED_TYPE
173 return ctx->ReadString(ptr,
size,
value);
186 return ctx->ParseGroup(
value, ptr, tag);
198 return ctx->ParseMessage(
value, ptr);
205 template <
typename Msg,
typename Metadata>
206 const char* ExtensionSet::ParseMessageSetItemTmpl(
const char* ptr,
207 const Msg* containing_type,
209 internal::ParseContext* ctx) {
212 while (!ctx->Done(&ptr)) {
219 if (!payload.empty()) {
221 bool was_packed_on_wire;
222 if (!FindExtension(2, type_id, containing_type, ctx, &
extension,
223 &was_packed_on_wire)) {
225 metadata->mutable_unknown_fields());
239 ParseContext tmp_ctx(ctx->depth(),
false, &
p, payload);
240 tmp_ctx.data().pool = ctx->data().pool;
241 tmp_ctx.data().factory = ctx->data().factory;
243 tmp_ctx.EndedAtLimit());
256 ptr = ctx->ReadString(ptr,
size, &payload);
263 ptr = VarintParse<4>(ptr, &tmp);
265 tag += (tmp - 1) << 7;
267 if (tag == 0 || (tag & 7) == 4) {
268 ctx->SetLastTag(tag);
277 #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
283 #endif // GOOGLE_PROTOBUF_EXTENSION_SET_INL_H__
unsigned long long int UInt64
const EnumDescriptor * type() const
std::string * MutableString(int number, FieldType type, desc)
const Descriptor::ReservedRange const EnumValueDescriptor const MethodDescriptor extension
const char * ParseVarint64Inline(const char *p, uint64 *out)
uint32 ReadSize(const char **pp)
GLsizei const GLchar *const * string
HANDLE_TYPE(int32, FieldDescriptor::CPPTYPE_INT32, -1)
TypeWithSize< 4 >::Int Int32
#define T(upbtypeconst, upbtype, ctype, default_value)
void * MutableRawRepeatedField(int number, FieldType field_type, bool packed, const FieldDescriptor *desc)
FloatingPoint< double > Double
TypeWithSize< 4 >::UInt UInt32
MessageLite * MutableMessage(int number, FieldType type, const MessageLite &prototype, desc)
FloatingPoint< float > Float
const char * PackedEnumParserArg(void *object, const char *ptr, ParseContext *ctx, bool(*is_valid)(const void *, int), const void *data, InternalMetadataWithArenaLite *metadata, int field_num)
void WriteLengthDelimited(uint32 num, StringPiece val, std::string *s)
void AddString(int number, FieldType type, const std::string &value, desc)
#define GOOGLE_LOG(LEVEL)
const char * ParseVarint64(const char *p, uint32 preload, uint64 *out)
bool ParseFieldWithExtensionInfo(int field_number, bool was_packed_on_wire, const ExtensionInfo &extension, io::CodedInputStream *input, FieldSkipper *field_skipper)
bool ParseFieldMaybeLazily(int wire_type, int field_number, io::CodedInputStream *input, ExtensionFinder *extension_finder, MessageSetFieldSkipper *field_skipper)
void WriteVarint(uint64 val, std::string *s)
MessageLite * AddMessage(int number, FieldType type, const MessageLite &prototype, desc)
GLsizei const GLfloat * value
void AddEnum(int number, FieldType type, bool packed, int value, desc)
void SetEnum(int number, FieldType type, int value, desc)
#define GOOGLE_PROTOBUF_PARSER_ASSERT(predicate)
bool ParseField(uint32 tag, io::CodedInputStream *input, ExtensionFinder *extension_finder, FieldSkipper *field_skipper)
libaditof
Author(s):
autogenerated on Wed May 21 2025 02:06:51