extension_set_heavy.cc
Go to the documentation of this file.
1 // Protocol Buffers - Google's data interchange format
2 // Copyright 2008 Google Inc. All rights reserved.
3 // https://developers.google.com/protocol-buffers/
4 //
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are
7 // met:
8 //
9 // * Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer.
11 // * Redistributions in binary form must reproduce the above
12 // copyright notice, this list of conditions and the following disclaimer
13 // in the documentation and/or other materials provided with the
14 // distribution.
15 // * Neither the name of Google Inc. nor the names of its
16 // contributors may be used to endorse or promote products derived from
17 // this software without specific prior written permission.
18 //
19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 
31 // Author: kenton@google.com (Kenton Varda)
32 // Based on original Protocol Buffers design by
33 // Sanjay Ghemawat, Jeff Dean, and others.
34 //
35 // Contains methods defined in extension_set.h which cannot be part of the
36 // lite library because they use descriptors or reflection.
37 
39 
52 
53 
54 #include <google/protobuf/port_def.inc>
55 
56 namespace google {
57 namespace protobuf {
58 namespace internal {
59 
60 // A FieldSkipper used to store unknown MessageSet fields into UnknownFieldSet.
62  public:
63  explicit MessageSetFieldSkipper(UnknownFieldSet* unknown_fields)
64  : UnknownFieldSetFieldSkipper(unknown_fields) {}
66 
68  int field_number);
69 };
71  int field_number) {
72  uint32 length;
73  if (!input->ReadVarint32(&length)) return false;
74  if (unknown_fields_ == NULL) {
75  return input->Skip(length);
76  } else {
77  return input->ReadString(unknown_fields_->AddLengthDelimited(field_number),
78  length);
79  }
80 }
81 
82 
83 // Implementation of ExtensionFinder which finds extensions in a given
84 // DescriptorPool, using the given MessageFactory to construct sub-objects.
85 // This class is implemented in extension_set_heavy.cc.
87  public:
89  MessageFactory* factory,
90  const Descriptor* containing_type)
91  : pool_(pool), factory_(factory), containing_type_(containing_type) {}
93 
94  bool Find(int number, ExtensionInfo* output) override;
95 
96  private:
100 };
101 
103  const Descriptor* containing_type, const DescriptorPool* pool,
104  std::vector<const FieldDescriptor*>* output) const {
105  ForEach([containing_type, pool, &output](int number, const Extension& ext) {
106  bool has = false;
107  if (ext.is_repeated) {
108  has = ext.GetSize() > 0;
109  } else {
110  has = !ext.is_cleared;
111  }
112 
113  if (has) {
114  // TODO(kenton): Looking up each field by number is somewhat unfortunate.
115  // Is there a better way? The problem is that descriptors are lazily-
116  // initialized, so they might not even be constructed until
117  // AppendToList() is called.
118 
119  if (ext.descriptor == NULL) {
120  output->push_back(pool->FindExtensionByNumber(containing_type, number));
121  } else {
122  output->push_back(ext.descriptor);
123  }
124  }
125  });
126 }
127 
130  return static_cast<FieldDescriptor::Type>(type);
131 }
132 
135  static_cast<FieldDescriptor::Type>(type));
136 }
137 
140  return static_cast<WireFormatLite::FieldType>(type);
141 }
142 
143 #define GOOGLE_DCHECK_TYPE(EXTENSION, LABEL, CPPTYPE) \
144  GOOGLE_DCHECK_EQ((EXTENSION).is_repeated ? FieldDescriptor::LABEL_REPEATED \
145  : FieldDescriptor::LABEL_OPTIONAL, \
146  FieldDescriptor::LABEL_##LABEL); \
147  GOOGLE_DCHECK_EQ(cpp_type((EXTENSION).type), FieldDescriptor::CPPTYPE_##CPPTYPE)
148 
150  const Descriptor* message_type,
151  MessageFactory* factory) const {
153  if (extension == NULL || extension->is_cleared) {
154  // Not present. Return the default value.
155  return *factory->GetPrototype(message_type);
156  } else {
157  GOOGLE_DCHECK_TYPE(*extension, OPTIONAL, MESSAGE);
158  if (extension->is_lazy) {
159  return extension->lazymessage_value->GetMessage(
160  *factory->GetPrototype(message_type));
161  } else {
162  return *extension->message_value;
163  }
164  }
165 }
166 
168  MessageFactory* factory) {
170  if (MaybeNewExtension(descriptor->number(), descriptor, &extension)) {
171  extension->type = descriptor->type();
173  extension->is_repeated = false;
174  extension->is_packed = false;
175  const MessageLite* prototype =
176  factory->GetPrototype(descriptor->message_type());
177  extension->is_lazy = false;
178  extension->message_value = prototype->New(arena_);
179  extension->is_cleared = false;
180  return extension->message_value;
181  } else {
182  GOOGLE_DCHECK_TYPE(*extension, OPTIONAL, MESSAGE);
183  extension->is_cleared = false;
184  if (extension->is_lazy) {
185  return extension->lazymessage_value->MutableMessage(
186  *factory->GetPrototype(descriptor->message_type()));
187  } else {
188  return extension->message_value;
189  }
190  }
191 }
192 
194  MessageFactory* factory) {
196  if (extension == NULL) {
197  // Not present. Return NULL.
198  return NULL;
199  } else {
200  GOOGLE_DCHECK_TYPE(*extension, OPTIONAL, MESSAGE);
201  MessageLite* ret = NULL;
202  if (extension->is_lazy) {
203  ret = extension->lazymessage_value->ReleaseMessage(
204  *factory->GetPrototype(descriptor->message_type()));
205  if (arena_ == NULL) {
206  delete extension->lazymessage_value;
207  }
208  } else {
209  if (arena_ != NULL) {
210  ret = extension->message_value->New();
211  ret->CheckTypeAndMergeFrom(*extension->message_value);
212  } else {
213  ret = extension->message_value;
214  }
215  }
216  Erase(descriptor->number());
217  return ret;
218  }
219 }
220 
222  const FieldDescriptor* descriptor, MessageFactory* factory) {
224  if (extension == NULL) {
225  // Not present. Return NULL.
226  return NULL;
227  } else {
228  GOOGLE_DCHECK_TYPE(*extension, OPTIONAL, MESSAGE);
229  MessageLite* ret = NULL;
230  if (extension->is_lazy) {
231  ret = extension->lazymessage_value->UnsafeArenaReleaseMessage(
232  *factory->GetPrototype(descriptor->message_type()));
233  if (arena_ == NULL) {
234  delete extension->lazymessage_value;
235  }
236  } else {
237  ret = extension->message_value;
238  }
239  Erase(descriptor->number());
240  return ret;
241  }
242 }
243 
245  const FieldDescriptor* descriptor) {
247  if (MaybeNewExtension(descriptor->number(), descriptor, &extension)) {
248  extension->type = descriptor->type();
250  extension->is_repeated = true;
251  extension->repeated_message_value =
252  Arena::CreateMessage<RepeatedPtrField<MessageLite> >(arena_);
253  } else {
254  GOOGLE_DCHECK_TYPE(*extension, REPEATED, MESSAGE);
255  }
256  return extension;
257 }
258 
260  MessageFactory* factory) {
262 
263  // RepeatedPtrField<Message> does not know how to Add() since it cannot
264  // allocate an abstract object, so we have to be tricky.
265  MessageLite* result =
266  reinterpret_cast<internal::RepeatedPtrFieldBase*>(
267  extension->repeated_message_value)
268  ->AddFromCleared<GenericTypeHandler<MessageLite> >();
269  if (result == NULL) {
270  const MessageLite* prototype;
271  if (extension->repeated_message_value->size() == 0) {
272  prototype = factory->GetPrototype(descriptor->message_type());
273  GOOGLE_CHECK(prototype != NULL);
274  } else {
275  prototype = &extension->repeated_message_value->Get(0);
276  }
277  result = prototype->New(arena_);
278  extension->repeated_message_value->AddAllocated(result);
279  }
280  return result;
281 }
282 
284  MessageLite* new_entry) {
286 
287  extension->repeated_message_value->AddAllocated(new_entry);
288 }
289 
290 static bool ValidateEnumUsingDescriptor(const void* arg, int number) {
291  return reinterpret_cast<const EnumDescriptor*>(arg)->FindValueByNumber(
292  number) != NULL;
293 }
294 
296  const FieldDescriptor* extension =
298  if (extension == NULL) {
299  return false;
300  } else {
301  output->type = extension->type();
302  output->is_repeated = extension->is_repeated();
303  output->is_packed = extension->options().packed();
304  output->descriptor = extension;
305  if (extension->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) {
306  output->message_info.prototype =
307  factory_->GetPrototype(extension->message_type());
308  GOOGLE_CHECK(output->message_info.prototype != nullptr)
309  << "Extension factory's GetPrototype() returned NULL for extension: "
310  << extension->full_name();
311  } else if (extension->cpp_type() == FieldDescriptor::CPPTYPE_ENUM) {
312  output->enum_validity_check.func = ValidateEnumUsingDescriptor;
313  output->enum_validity_check.arg = extension->enum_type();
314  }
315 
316  return true;
317  }
318 }
319 
320 
321 #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
322 bool ExtensionSet::FindExtension(int wire_type, uint32 field,
323  const Message* containing_type,
324  const internal::ParseContext* ctx,
326  bool* was_packed_on_wire) {
327  if (ctx->data().pool == nullptr) {
328  GeneratedExtensionFinder finder(containing_type);
329  if (!FindExtensionInfoFromFieldNumber(wire_type, field, &finder, extension,
330  was_packed_on_wire)) {
331  return false;
332  }
333  } else {
334  DescriptorPoolExtensionFinder finder(ctx->data().pool, ctx->data().factory,
335  containing_type->GetDescriptor());
336  if (!FindExtensionInfoFromFieldNumber(wire_type, field, &finder, extension,
337  was_packed_on_wire)) {
338  return false;
339  }
340  }
341  return true;
342 }
343 
344 const char* ExtensionSet::ParseField(
345  uint64 tag, const char* ptr, const Message* containing_type,
346  internal::InternalMetadataWithArena* metadata,
347  internal::ParseContext* ctx) {
348  int number = tag >> 3;
349  bool was_packed_on_wire;
350  ExtensionInfo extension;
351  if (!FindExtension(tag & 7, number, containing_type, ctx, &extension,
352  &was_packed_on_wire)) {
353  return UnknownFieldParse(tag, metadata->mutable_unknown_fields(), ptr, ctx);
354  }
355  return ParseFieldWithExtensionInfo(number, was_packed_on_wire, extension,
356  metadata, ptr, ctx);
357 }
358 
360  uint64 tag, const char* ptr, const Message* containing_type,
361  internal::InternalMetadataWithArena* metadata,
362  internal::ParseContext* ctx) {
363  return ParseField(tag, ptr, containing_type, metadata, ctx);
364 }
365 
367  const char* ptr, const Message* containing_type,
368  internal::InternalMetadataWithArena* metadata,
369  internal::ParseContext* ctx) {
370  return ParseMessageSetItemTmpl(ptr, containing_type, metadata, ctx);
371 }
372 
373 #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
374 
376  const Message* containing_type,
377  UnknownFieldSet* unknown_fields) {
378  UnknownFieldSetFieldSkipper skipper(unknown_fields);
379  if (input->GetExtensionPool() == NULL) {
380  GeneratedExtensionFinder finder(containing_type);
381  return ParseField(tag, input, &finder, &skipper);
382  } else {
383  DescriptorPoolExtensionFinder finder(input->GetExtensionPool(),
384  input->GetExtensionFactory(),
385  containing_type->GetDescriptor());
386  return ParseField(tag, input, &finder, &skipper);
387  }
388 }
389 
391  const Message* containing_type,
392  UnknownFieldSet* unknown_fields) {
393  MessageSetFieldSkipper skipper(unknown_fields);
394  if (input->GetExtensionPool() == NULL) {
395  GeneratedExtensionFinder finder(containing_type);
396  return ParseMessageSet(input, &finder, &skipper);
397  } else {
398  DescriptorPoolExtensionFinder finder(input->GetExtensionPool(),
399  input->GetExtensionFactory(),
400  containing_type->GetDescriptor());
401  return ParseMessageSet(input, &finder, &skipper);
402  }
403 }
404 
407 }
408 
410  size_t total_size = Size() * sizeof(KeyValue);
411  ForEach([&total_size](int /* number */, const Extension& ext) {
412  total_size += ext.SpaceUsedExcludingSelfLong();
413  });
414  return total_size;
415 }
416 
419  return field->SpaceUsedExcludingSelfLong<GenericTypeHandler<Message> >();
420 }
421 
423  size_t total_size = 0;
424  if (is_repeated) {
425  switch (cpp_type(type)) {
426 #define HANDLE_TYPE(UPPERCASE, LOWERCASE) \
427  case FieldDescriptor::CPPTYPE_##UPPERCASE: \
428  total_size += sizeof(*repeated_##LOWERCASE##_value) + \
429  repeated_##LOWERCASE##_value->SpaceUsedExcludingSelfLong(); \
430  break
431 
432  HANDLE_TYPE(INT32, int32);
433  HANDLE_TYPE(INT64, int64);
434  HANDLE_TYPE(UINT32, uint32);
435  HANDLE_TYPE(UINT64, uint64);
436  HANDLE_TYPE(FLOAT, float);
437  HANDLE_TYPE(DOUBLE, double);
438  HANDLE_TYPE(BOOL, bool);
439  HANDLE_TYPE(ENUM, enum);
440  HANDLE_TYPE(STRING, string);
441 #undef HANDLE_TYPE
442 
444  // repeated_message_value is actually a RepeatedPtrField<MessageLite>,
445  // but MessageLite has no SpaceUsedLong(), so we must directly call
446  // RepeatedPtrFieldBase::SpaceUsedExcludingSelfLong() with a different
447  // type handler.
448  total_size += sizeof(*repeated_message_value) +
450  reinterpret_cast<internal::RepeatedPtrFieldBase*>(
452  break;
453  }
454  } else {
455  switch (cpp_type(type)) {
457  total_size += sizeof(*string_value) +
459  break;
461  if (is_lazy) {
462  total_size += lazymessage_value->SpaceUsedLong();
463  } else {
464  total_size += down_cast<Message*>(message_value)->SpaceUsedLong();
465  }
466  break;
467  default:
468  // No extra storage costs for primitive types.
469  break;
470  }
471  }
472  return total_size;
473 }
474 
475 // The Serialize*ToArray methods are only needed in the heavy library, as
476 // the lite library only generates SerializeWithCachedSizes.
478  int end_field_number,
479  uint8* target) const {
480  return InternalSerializeWithCachedSizesToArray(start_field_number,
481  end_field_number, target);
482 }
483 
485  uint8* target) const {
487 }
488 
490  int start_field_number, int end_field_number, uint8* target) const {
491  if (PROTOBUF_PREDICT_FALSE(is_large())) {
492  const auto& end = map_.large->end();
493  for (auto it = map_.large->lower_bound(start_field_number);
494  it != end && it->first < end_field_number; ++it) {
495  target = it->second.InternalSerializeFieldWithCachedSizesToArray(
496  it->first, target);
497  }
498  return target;
499  }
500  const KeyValue* end = flat_end();
501  for (const KeyValue* it = std::lower_bound(
502  flat_begin(), end, start_field_number, KeyValue::FirstComparator());
503  it != end && it->first < end_field_number; ++it) {
504  target = it->second.InternalSerializeFieldWithCachedSizesToArray(it->first,
505  target);
506  }
507  return target;
508 }
509 
511  uint8* target) const {
512  ForEach([&target](int number, const Extension& ext) {
514  target);
515  });
516  return target;
517 }
518 
520  int number, uint8* target) const {
521  if (is_repeated) {
522  if (is_packed) {
523  if (cached_size == 0) return target;
524 
528 
529  switch (real_type(type)) {
530 #define HANDLE_TYPE(UPPERCASE, CAMELCASE, LOWERCASE) \
531  case FieldDescriptor::TYPE_##UPPERCASE: \
532  for (int i = 0; i < repeated_##LOWERCASE##_value->size(); i++) { \
533  target = WireFormatLite::Write##CAMELCASE##NoTagToArray( \
534  repeated_##LOWERCASE##_value->Get(i), target); \
535  } \
536  break
537 
538  HANDLE_TYPE(INT32, Int32, int32);
539  HANDLE_TYPE(INT64, Int64, int64);
540  HANDLE_TYPE(UINT32, UInt32, uint32);
541  HANDLE_TYPE(UINT64, UInt64, uint64);
542  HANDLE_TYPE(SINT32, SInt32, int32);
543  HANDLE_TYPE(SINT64, SInt64, int64);
544  HANDLE_TYPE(FIXED32, Fixed32, uint32);
545  HANDLE_TYPE(FIXED64, Fixed64, uint64);
546  HANDLE_TYPE(SFIXED32, SFixed32, int32);
547  HANDLE_TYPE(SFIXED64, SFixed64, int64);
548  HANDLE_TYPE(FLOAT, Float, float);
549  HANDLE_TYPE(DOUBLE, Double, double);
550  HANDLE_TYPE(BOOL, Bool, bool);
551  HANDLE_TYPE(ENUM, Enum, enum);
552 #undef HANDLE_TYPE
553 
558  GOOGLE_LOG(FATAL) << "Non-primitive types can't be packed.";
559  break;
560  }
561  } else {
562  switch (real_type(type)) {
563 #define HANDLE_TYPE(UPPERCASE, CAMELCASE, LOWERCASE) \
564  case FieldDescriptor::TYPE_##UPPERCASE: \
565  for (int i = 0; i < repeated_##LOWERCASE##_value->size(); i++) { \
566  target = WireFormatLite::Write##CAMELCASE##ToArray( \
567  number, repeated_##LOWERCASE##_value->Get(i), target); \
568  } \
569  break
570 
571  HANDLE_TYPE(INT32, Int32, int32);
572  HANDLE_TYPE(INT64, Int64, int64);
573  HANDLE_TYPE(UINT32, UInt32, uint32);
574  HANDLE_TYPE(UINT64, UInt64, uint64);
575  HANDLE_TYPE(SINT32, SInt32, int32);
576  HANDLE_TYPE(SINT64, SInt64, int64);
577  HANDLE_TYPE(FIXED32, Fixed32, uint32);
578  HANDLE_TYPE(FIXED64, Fixed64, uint64);
579  HANDLE_TYPE(SFIXED32, SFixed32, int32);
580  HANDLE_TYPE(SFIXED64, SFixed64, int64);
581  HANDLE_TYPE(FLOAT, Float, float);
582  HANDLE_TYPE(DOUBLE, Double, double);
583  HANDLE_TYPE(BOOL, Bool, bool);
584  HANDLE_TYPE(STRING, String, string);
585  HANDLE_TYPE(BYTES, Bytes, string);
586  HANDLE_TYPE(ENUM, Enum, enum);
587 #undef HANDLE_TYPE
588 #define HANDLE_TYPE(UPPERCASE, CAMELCASE, LOWERCASE) \
589  case FieldDescriptor::TYPE_##UPPERCASE: \
590  for (int i = 0; i < repeated_##LOWERCASE##_value->size(); i++) { \
591  target = WireFormatLite::InternalWrite##CAMELCASE##ToArray( \
592  number, repeated_##LOWERCASE##_value->Get(i), target); \
593  } \
594  break
595 
596  HANDLE_TYPE(GROUP, Group, message);
597  HANDLE_TYPE(MESSAGE, Message, message);
598 #undef HANDLE_TYPE
599  }
600  }
601  } else if (!is_cleared) {
602  switch (real_type(type)) {
603 #define HANDLE_TYPE(UPPERCASE, CAMELCASE, VALUE) \
604  case FieldDescriptor::TYPE_##UPPERCASE: \
605  target = WireFormatLite::Write##CAMELCASE##ToArray(number, VALUE, target); \
606  break
607 
608  HANDLE_TYPE(INT32, Int32, int32_value);
609  HANDLE_TYPE(INT64, Int64, int64_value);
610  HANDLE_TYPE(UINT32, UInt32, uint32_value);
611  HANDLE_TYPE(UINT64, UInt64, uint64_value);
612  HANDLE_TYPE(SINT32, SInt32, int32_value);
613  HANDLE_TYPE(SINT64, SInt64, int64_value);
614  HANDLE_TYPE(FIXED32, Fixed32, uint32_value);
615  HANDLE_TYPE(FIXED64, Fixed64, uint64_value);
616  HANDLE_TYPE(SFIXED32, SFixed32, int32_value);
617  HANDLE_TYPE(SFIXED64, SFixed64, int64_value);
618  HANDLE_TYPE(FLOAT, Float, float_value);
619  HANDLE_TYPE(DOUBLE, Double, double_value);
620  HANDLE_TYPE(BOOL, Bool, bool_value);
621  HANDLE_TYPE(STRING, String, *string_value);
622  HANDLE_TYPE(BYTES, Bytes, *string_value);
623  HANDLE_TYPE(ENUM, Enum, enum_value);
624  HANDLE_TYPE(GROUP, Group, *message_value);
625 #undef HANDLE_TYPE
627  if (is_lazy) {
628  target = lazymessage_value->WriteMessageToArray(number, target);
629  } else {
631  number, *message_value, target);
632  }
633  break;
634  }
635  }
636  return target;
637 }
638 
639 uint8*
641  int number, uint8* target) const {
642  if (type != WireFormatLite::TYPE_MESSAGE || is_repeated) {
643  // Not a valid MessageSet extension, but serialize it the normal way.
644  GOOGLE_LOG(WARNING) << "Invalid message set extension.";
645  return InternalSerializeFieldWithCachedSizesToArray(number, target);
646  }
647 
648  if (is_cleared) return target;
649 
650  // Start group.
653  // Write type ID.
656  // Write message.
657  if (is_lazy) {
658  target = lazymessage_value->WriteMessageToArray(
660  } else {
663  }
664  // End group.
667  return target;
668 }
669 
671  int wire_type, int field_number, io::CodedInputStream* input,
672  ExtensionFinder* extension_finder, MessageSetFieldSkipper* field_skipper) {
673  return ParseField(
674  WireFormatLite::MakeTag(field_number,
675  static_cast<WireFormatLite::WireType>(wire_type)),
676  input, extension_finder, field_skipper);
677 }
678 
680  ExtensionFinder* extension_finder,
681  MessageSetFieldSkipper* field_skipper) {
682  while (true) {
683  const uint32 tag = input->ReadTag();
684  switch (tag) {
685  case 0:
686  return true;
688  if (!ParseMessageSetItem(input, extension_finder, field_skipper)) {
689  return false;
690  }
691  break;
692  default:
693  if (!ParseField(tag, input, extension_finder, field_skipper)) {
694  return false;
695  }
696  break;
697  }
698  }
699 }
700 
702  ExtensionFinder* extension_finder,
703  MessageSetFieldSkipper* field_skipper) {
704  struct MSFull {
705  bool ParseField(int type_id, io::CodedInputStream* input) {
706  return me->ParseFieldMaybeLazily(
708  extension_finder, field_skipper);
709  }
710 
712  return field_skipper->SkipField(input, tag);
713  }
714 
715  ExtensionSet* me;
716  ExtensionFinder* extension_finder;
717  MessageSetFieldSkipper* field_skipper;
718  };
719 
721  MSFull{this, extension_finder, field_skipper});
722 }
723 
724 } // namespace internal
725 } // namespace protobuf
726 } // namespace google
google::protobuf.internal::WireFormatLite::MAX_FIELD_TYPE
@ MAX_FIELD_TYPE
Definition: wire_format_lite.h:130
google::protobuf::FieldDescriptor::Type
Type
Definition: src/google/protobuf/descriptor.h:521
google::protobuf.internal::ExtensionSet::Extension::is_repeated
bool is_repeated
Definition: extension_set.h:581
google::protobuf.internal::ExtensionSet::InternalSerializeMessageSetWithCachedSizesToArray
uint8 * InternalSerializeMessageSetWithCachedSizesToArray(uint8 *target) const
Definition: extension_set_heavy.cc:510
Json::UInt64
unsigned long long int UInt64
Definition: json.h:241
google::protobuf.internal::ExtensionSet
Definition: extension_set.h:179
google::protobuf.internal::DescriptorPoolExtensionFinder::Find
bool Find(int number, ExtensionInfo *output) override
Definition: extension_set_heavy.cc:295
google::protobuf::FieldDescriptor::CPPTYPE_ENUM
@ CPPTYPE_ENUM
Definition: src/google/protobuf/descriptor.h:561
google::protobuf.internal::ExtensionSet::MaybeNewExtension
bool MaybeNewExtension(int number, const FieldDescriptor *descriptor, Extension **result)
Definition: extension_set.cc:1498
google::protobuf::EnumValueDescriptor::type
const EnumDescriptor * type() const
google::protobuf::EnumValueDescriptor::options
const EnumValueOptions & options() const
google::protobuf.internal::DescriptorPoolExtensionFinder::factory_
MessageFactory * factory_
Definition: extension_set_heavy.cc:98
google::protobuf::FieldDescriptor::CPPTYPE_STRING
@ CPPTYPE_STRING
Definition: src/google/protobuf/descriptor.h:562
google::protobuf::FieldDescriptor
Definition: src/google/protobuf/descriptor.h:515
google::protobuf.internal.decoder.SkipField
def SkipField
Definition: decoder.py:1016
wire_format_lite.h
google::protobuf.internal::WireFormatLite::WriteUInt32ToArray
static PROTOBUF_ALWAYS_INLINE uint8 * WriteUInt32ToArray(int field_number, uint32 value, uint8 *target)
Definition: wire_format_lite.h:1524
google::protobuf::extension
const Descriptor::ReservedRange const EnumValueDescriptor const MethodDescriptor extension
Definition: src/google/protobuf/descriptor.h:2001
end
GLuint GLuint end
Definition: glcorearb.h:2858
google::protobuf.internal::ExtensionSet::Extension::message_value
MessageLite * message_value
Definition: extension_set.h:565
NULL
NULL
Definition: test_security_zap.cpp:405
Bool
Definition: gtest_pred_impl_unittest.cc:56
google::protobuf::int64
int64_t int64
Definition: protobuf/src/google/protobuf/stubs/port.h:151
google::protobuf.internal::ExtensionSet::SpaceUsedExcludingSelfLong
size_t SpaceUsedExcludingSelfLong() const
Definition: extension_set_heavy.cc:409
google::protobuf.internal::WireFormatLite::InternalWriteMessageToArray
static PROTOBUF_ALWAYS_INLINE uint8 * InternalWriteMessageToArray(int field_number, const MessageType &value, uint8 *target)
length
GLenum GLuint GLenum GLsizei length
Definition: glcorearb.h:2695
input
std::string input
Definition: tokenizer_unittest.cc:197
google::protobuf.internal::real_type
FieldDescriptor::Type real_type(FieldType type)
Definition: extension_set_heavy.cc:128
extension_set.h
google::protobuf::uint8
uint8_t uint8
Definition: protobuf/src/google/protobuf/stubs/port.h:153
FATAL
const int FATAL
Definition: log_severity.h:60
google::protobuf::FieldDescriptor::TYPE_BYTES
@ TYPE_BYTES
Definition: src/google/protobuf/descriptor.h:538
GOOGLE_DCHECK
#define GOOGLE_DCHECK
Definition: logging.h:194
benchmarks.util.result_uploader.metadata
def metadata
Definition: result_uploader.py:97
google::protobuf.internal::WireFormatLite::WriteInt32NoTagToArray
static PROTOBUF_ALWAYS_INLINE uint8 * WriteInt32NoTagToArray(int32 value, uint8 *target)
Definition: wire_format_lite.h:1362
google::protobuf.internal::ExtensionSet::Size
size_t Size() const
Definition: extension_set.h:678
google::protobuf::uint32
uint32_t uint32
Definition: protobuf/src/google/protobuf/stubs/port.h:155
google::protobuf.internal::ParseContext
Definition: parse_context.h:322
google::protobuf.internal::ExtensionSet::FindOrNull
const Extension * FindOrNull(int key) const
Definition: extension_set.cc:1897
google::protobuf.internal::WireFormatLite::kMessageSetTypeIdNumber
static const int kMessageSetTypeIdNumber
Definition: wire_format_lite.h:213
google::protobuf::MessageFactory::GetPrototype
virtual const Message * GetPrototype(const Descriptor *type)=0
google::protobuf.internal::ParseContext::data
Data & data()
Definition: parse_context.h:342
google::protobuf.internal::FromIntSize
size_t FromIntSize(int size)
Definition: message_lite.h:96
google::protobuf.internal::WireFormatLite::kMessageSetItemEndTag
static const int kMessageSetItemEndTag
Definition: wire_format_lite.h:217
if
PHP_PROTO_OBJECT_FREE_END PHP_PROTO_OBJECT_DTOR_END if(!upb_strtable_init(&intern->table, UPB_CTYPE_UINT64))
Definition: php/ext/google/protobuf/map.c:232
google::protobuf::MessageLite
Definition: message_lite.h:183
target
GLenum target
Definition: glcorearb.h:3739
descriptor
Descriptor * descriptor
Definition: php/ext/google/protobuf/protobuf.h:936
google::protobuf.internal::ExtensionSet::Erase
void Erase(int key)
Definition: extension_set.cc:2000
google::protobuf.internal::ExtensionSet::ReleaseMessage
MessageLite * ReleaseMessage(int number, const MessageLite &prototype)
Definition: extension_set.cc:694
google::protobuf::HANDLE_TYPE
HANDLE_TYPE(int32, FieldDescriptor::CPPTYPE_INT32, -1)
testing::internal::Int32
TypeWithSize< 4 >::Int Int32
Definition: gtest-port.h:2241
google::protobuf::MessageFactory
Definition: src/google/protobuf/message.h:1069
google::protobuf.internal::ParseContext::Data::factory
MessageFactory * factory
Definition: parse_context.h:326
google::protobuf.internal::MessageSetFieldSkipper::SkipMessageSetField
virtual bool SkipMessageSetField(io::CodedInputStream *input, int field_number)
Definition: extension_set_heavy.cc:70
Enum
Definition: type.pb.h:797
google::protobuf.internal::ExtensionSet::SpaceUsedExcludingSelf
int SpaceUsedExcludingSelf() const
Definition: extension_set_heavy.cc:405
google::protobuf.internal::ExtensionSet::Extension::lazymessage_value
LazyMessageExtension * lazymessage_value
Definition: extension_set.h:566
google::protobuf.internal::UnknownFieldSetFieldSkipper::unknown_fields_
UnknownFieldSet * unknown_fields_
Definition: wire_format.h:267
testing::internal::Double
FloatingPoint< double > Double
Definition: gtest-internal.h:429
extension_set_inl.h
testing::internal::UInt32
TypeWithSize< 4 >::UInt UInt32
Definition: gtest-port.h:2242
google::protobuf.internal::ValidateEnumUsingDescriptor
static bool ValidateEnumUsingDescriptor(const void *arg, int number)
Definition: extension_set_heavy.cc:290
parse_context.h
message_type
zend_class_entry * message_type
Definition: php/ext/google/protobuf/message.c:45
google::protobuf.internal::ExtensionSet::SerializeMessageSetWithCachedSizesToArray
uint8 * SerializeMessageSetWithCachedSizesToArray(uint8 *target) const
Definition: extension_set_heavy.cc:484
google::protobuf::int32
int32_t int32
Definition: protobuf/src/google/protobuf/stubs/port.h:150
google::protobuf.internal::ExtensionSet::Extension::is_lazy
bool is_lazy
Definition: extension_set.h:596
google::protobuf.internal::GeneratedExtensionFinder
Definition: extension_set.h:149
google::protobuf.internal::WireFormatLite::WriteTagToArray
static PROTOBUF_ALWAYS_INLINE uint8 * WriteTagToArray(int field_number, WireType type, uint8 *target)
Definition: wire_format_lite.h:1356
google::protobuf.internal::ExtensionSet::Extension::InternalSerializeFieldWithCachedSizesToArray
uint8 * InternalSerializeFieldWithCachedSizesToArray(int number, uint8 *target) const
Definition: extension_set_heavy.cc:519
google::protobuf.internal::ExtensionSet::AppendToList
void AppendToList(const Descriptor *containing_type, const DescriptorPool *pool, std::vector< const FieldDescriptor * > *output) const
Definition: extension_set_heavy.cc:102
unknown_field_set.h
google::protobuf.internal::ExtensionSet::Extension::repeated_message_value
RepeatedPtrField< MessageLite > * repeated_message_value
Definition: extension_set.h:577
google::protobuf.internal::field_type
WireFormatLite::FieldType field_type(FieldType type)
Definition: extension_set_heavy.cc:138
google::protobuf.internal::ExtensionSet::Extension::InternalSerializeMessageSetItemWithCachedSizesToArray
uint8 * InternalSerializeMessageSetItemWithCachedSizesToArray(int number, uint8 *target) const
Definition: extension_set_heavy.cc:640
google::protobuf.internal::ExtensionSet::MutableMessage
MessageLite * MutableMessage(int number, FieldType type, const MessageLite &prototype, desc)
testing::internal::Float
FloatingPoint< float > Float
Definition: gtest-internal.h:428
coded_stream.h
google::protobuf.internal::ExtensionSet::ForEach
static KeyValueFunctor ForEach(Iterator begin, Iterator end, KeyValueFunctor func)
Definition: extension_set.h:686
google::protobuf.internal::ParseContext::Data::pool
const DescriptorPool * pool
Definition: parse_context.h:325
google::protobuf.internal::ExtensionSet::KeyValue
Definition: extension_set.h:635
google::protobuf.internal::DescriptorPoolExtensionFinder::pool_
const DescriptorPool * pool_
Definition: extension_set_heavy.cc:97
google::protobuf.internal::ParseMessageSetItemImpl
bool ParseMessageSetItemImpl(io::CodedInputStream *input, MS ms)
Definition: wire_format_lite.h:1788
google::protobuf.internal::ExtensionInfo
Definition: extension_set.h:105
google::protobuf.internal::StringSpaceUsedExcludingSelfLong
size_t StringSpaceUsedExcludingSelfLong(const std::string &str)
Definition: generated_message_util.cc:86
google::protobuf::DescriptorPool
Definition: src/google/protobuf/descriptor.h:1539
google::protobuf.internal::UnknownFieldSetFieldSkipper::SkipField
bool SkipField(io::CodedInputStream *input, uint32 tag) override
Definition: wire_format.cc:71
google::protobuf.internal::WireFormatLite::TYPE_MESSAGE
@ TYPE_MESSAGE
Definition: wire_format_lite.h:122
message.h
google::protobuf.internal::UnknownFieldParse
const char * UnknownFieldParse(uint32 tag, std::string *unknown, const char *ptr, ParseContext *ctx)
Definition: parse_context.cc:545
google::protobuf.internal::ExtensionSet::KeyValue::FirstComparator
Definition: extension_set.h:639
GOOGLE_LOG
#define GOOGLE_LOG(LEVEL)
Definition: logging.h:146
google::protobuf::uint64
uint64_t uint64
Definition: protobuf/src/google/protobuf/stubs/port.h:156
repeated_field.h
google::protobuf.internal::MessageSetFieldSkipper::~MessageSetFieldSkipper
virtual ~MessageSetFieldSkipper()
Definition: extension_set_heavy.cc:65
google::protobuf::WARNING
static const LogLevel WARNING
Definition: protobuf/src/google/protobuf/testing/googletest.h:71
google::protobuf.internal::WireFormatLite::FieldType
FieldType
Definition: wire_format_lite.h:111
google::protobuf::FieldDescriptor::TYPE_STRING
@ TYPE_STRING
Definition: src/google/protobuf/descriptor.h:534
GOOGLE_DCHECK_TYPE
#define GOOGLE_DCHECK_TYPE(EXTENSION, LABEL, CPPTYPE)
Definition: extension_set_heavy.cc:143
google::protobuf.internal::ExtensionSet::Extension::descriptor
const FieldDescriptor * descriptor
Definition: extension_set.h:609
google::protobuf.internal::WireFormatLite::MakeTag
constexpr static uint32 MakeTag(int field_number, WireType type)
Definition: wire_format_lite.h:768
google::protobuf.internal::ExtensionSet::InternalSerializeWithCachedSizesToArray
uint8 * InternalSerializeWithCachedSizesToArray(int start_field_number, int end_field_number, uint8 *target) const
Definition: extension_set_heavy.cc:489
casts.h
field
const FieldDescriptor * field
Definition: parser_unittest.cc:2694
google::protobuf.internal::ExtensionSet::arena_
Arena * arena_
Definition: extension_set.h:840
google::protobuf.internal::MessageSetFieldSkipper::MessageSetFieldSkipper
MessageSetFieldSkipper(UnknownFieldSet *unknown_fields)
Definition: extension_set_heavy.cc:63
google::protobuf.internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED
@ WIRETYPE_LENGTH_DELIMITED
Definition: wire_format_lite.h:104
google::protobuf.internal::ExtensionSet::is_large
bool is_large() const
Definition: extension_set.h:673
google::protobuf.internal::ExtensionSet::AddAllocatedMessage
void AddAllocatedMessage(const FieldDescriptor *descriptor, MessageLite *new_entry)
Definition: extension_set_heavy.cc:283
google::protobuf.internal::ExtensionFinder
Definition: extension_set.h:139
GOOGLE_CHECK
#define GOOGLE_CHECK(EXPRESSION)
Definition: logging.h:153
pool
InternalDescriptorPool * pool
Definition: php/ext/google/protobuf/protobuf.h:798
google::protobuf::UnknownFieldSet::AddLengthDelimited
void AddLengthDelimited(int number, const std::string &value)
Definition: unknown_field_set.h:321
google::protobuf.internal::ExtensionSet::RepeatedMessage_SpaceUsedExcludingSelfLong
static size_t RepeatedMessage_SpaceUsedExcludingSelfLong(RepeatedPtrFieldBase *field)
Definition: extension_set_heavy.cc:417
google::protobuf.internal::UnknownFieldSetFieldSkipper
Definition: wire_format.h:255
google::protobuf::FieldDescriptor::TYPE_MESSAGE
@ TYPE_MESSAGE
Definition: src/google/protobuf/descriptor.h:536
zero_copy_stream_impl_lite.h
google::protobuf.internal::ExtensionSet::LazyMessageExtension::SpaceUsedLong
virtual size_t SpaceUsedLong() const =0
google::protobuf.internal::WireFormatLite::kMessageSetMessageNumber
static const int kMessageSetMessageNumber
Definition: wire_format_lite.h:214
google::protobuf::DescriptorPool::FindExtensionByNumber
const FieldDescriptor * FindExtensionByNumber(const Descriptor *extendee, int number) const
Definition: src/google/protobuf/descriptor.cc:1488
type
GLenum type
Definition: glcorearb.h:2695
google::protobuf::Message
Definition: src/google/protobuf/message.h:205
google::protobuf.internal::ExtensionSet::Extension::string_value
std::string * string_value
Definition: extension_set.h:564
google::protobuf::Message::GetDescriptor
const Descriptor * GetDescriptor() const
Definition: src/google/protobuf/message.h:326
google::protobuf.internal::DescriptorPoolExtensionFinder::containing_type_
const Descriptor * containing_type_
Definition: extension_set_heavy.cc:99
google::protobuf.internal::ExtensionSet::map_
union google::protobuf::internal::ExtensionSet::AllocatedData map_
google::protobuf.internal::ExtensionSet::ParseFieldWithExtensionInfo
bool ParseFieldWithExtensionInfo(int field_number, bool was_packed_on_wire, const ExtensionInfo &extension, io::CodedInputStream *input, FieldSkipper *field_skipper)
Definition: extension_set.cc:1225
google::protobuf::UnknownFieldSet
Definition: unknown_field_set.h:86
google::protobuf::io::CodedInputStream
Definition: coded_stream.h:173
google::protobuf.internal::ExtensionSet::Extension::SpaceUsedExcludingSelfLong
size_t SpaceUsedExcludingSelfLong() const
Definition: extension_set_heavy.cc:422
wire_format.h
google::protobuf.internal::ExtensionSet::ParseFieldMaybeLazily
bool ParseFieldMaybeLazily(int wire_type, int field_number, io::CodedInputStream *input, ExtensionFinder *extension_finder, MessageSetFieldSkipper *field_skipper)
Definition: extension_set_heavy.cc:670
google::protobuf.internal::ExtensionSet::GetMessage
const MessageLite & GetMessage(int number, const MessageLite &default_value) const
Definition: extension_set.cc:572
google::protobuf::Descriptor
Definition: src/google/protobuf/descriptor.h:231
descriptor.h
google::protobuf::FieldDescriptor::TYPE_GROUP
@ TYPE_GROUP
Definition: src/google/protobuf/descriptor.h:535
google::protobuf.internal::DescriptorPoolExtensionFinder
Definition: extension_set_heavy.cc:86
google::protobuf.internal::WireFormatLite::WireType
WireType
Definition: wire_format_lite.h:101
google::protobuf.internal::RepeatedPtrFieldBase
Definition: repeated_field.h:459
google::protobuf.internal::DescriptorPoolExtensionFinder::DescriptorPoolExtensionFinder
DescriptorPoolExtensionFinder(const DescriptorPool *pool, MessageFactory *factory, const Descriptor *containing_type)
Definition: extension_set_heavy.cc:88
google::protobuf::io::CodedOutputStream::WriteTagToArray
static PROTOBUF_ALWAYS_INLINE uint8 * WriteTagToArray(uint32 value, uint8 *target)
Definition: coded_stream.h:1241
google::protobuf.internal::ExtensionSet::AllocatedData::large
LargeMap * large
Definition: extension_set.h:852
google::protobuf.internal::ExtensionSet::ParseMessageSet
bool ParseMessageSet(io::CodedInputStream *input, ExtensionFinder *extension_finder, MessageSetFieldSkipper *field_skipper)
Definition: extension_set_heavy.cc:679
google::protobuf::EnumValueDescriptor::full_name
const std::string & full_name() const
google::protobuf.internal::ExtensionSet::UnsafeArenaReleaseMessage
MessageLite * UnsafeArenaReleaseMessage(int number, const MessageLite &prototype)
Definition: extension_set.cc:723
google::protobuf.internal::ExtensionSet::MaybeNewRepeatedExtension
Extension * MaybeNewRepeatedExtension(const FieldDescriptor *descriptor)
Definition: extension_set_heavy.cc:244
internal
Definition: any.pb.h:40
has
ROSCPP_DECL bool has(const std::string &key)
google::protobuf.internal::ExtensionSet::FindExtensionInfoFromFieldNumber
bool FindExtensionInfoFromFieldNumber(int wire_type, int field_number, ExtensionFinder *extension_finder, ExtensionInfo *extension, bool *was_packed_on_wire)
Definition: extension_set.cc:1162
google::protobuf.internal::ExtensionSet::flat_begin
KeyValue * flat_begin()
Definition: extension_set.h:823
google::protobuf.internal::GenericTypeHandler
Definition: arena.h:91
google::protobuf.internal::ExtensionSet::AddMessage
MessageLite * AddMessage(int number, FieldType type, const MessageLite &prototype, desc)
google::protobuf.internal::ExtensionSet::Extension
Definition: extension_set.h:552
descriptor.pb.h
google::protobuf.internal::ExtensionSet::SerializeWithCachedSizesToArray
uint8 * SerializeWithCachedSizesToArray(int start_field_number, int end_field_number, uint8 *target) const
Definition: extension_set_heavy.cc:477
google::protobuf::FieldDescriptor::CPPTYPE_MESSAGE
@ CPPTYPE_MESSAGE
Definition: src/google/protobuf/descriptor.h:563
output
const upb_json_parsermethod const upb_symtab upb_sink * output
Definition: ruby/ext/google/protobuf_c/upb.h:10503
google::protobuf::FieldDescriptor::TypeToCppType
static CppType TypeToCppType(Type type)
Definition: src/google/protobuf/descriptor.h:2147
google::protobuf::EnumDescriptor
Definition: src/google/protobuf/descriptor.h:918
google::protobuf::MessageLite::CheckTypeAndMergeFrom
virtual void CheckTypeAndMergeFrom(const MessageLite &other)=0
google::protobuf.internal::FieldType
uint8 FieldType
Definition: extension_set.h:87
google::protobuf::FieldDescriptor::MAX_TYPE
@ MAX_TYPE
Definition: src/google/protobuf/descriptor.h:546
google::protobuf.internal::MessageSetFieldSkipper
Definition: extension_set_heavy.cc:61
google::protobuf.internal::WireFormatLite::kMessageSetItemStartTag
static const int kMessageSetItemStartTag
Definition: wire_format_lite.h:215
Json::Int64
long long int Int64
Definition: json.h:240
number
double number
Definition: cJSON.h:326
it
MapIter it
Definition: php/ext/google/protobuf/map.c:205
google::protobuf::FieldDescriptor::CppType
CppType
Definition: src/google/protobuf/descriptor.h:553
google
Definition: data_proto2_to_proto3_util.h:11
message
GLenum GLuint GLenum GLsizei const GLchar * message
Definition: glcorearb.h:2695
google::protobuf.internal::ExtensionSet::ParseMessageSetItem
bool ParseMessageSetItem(io::CodedInputStream *input, ExtensionFinder *extension_finder, MessageSetFieldSkipper *field_skipper)
Definition: extension_set_heavy.cc:701
google::protobuf.internal::ExtensionSet::ParseField
bool ParseField(uint32 tag, io::CodedInputStream *input, ExtensionFinder *extension_finder, FieldSkipper *field_skipper)
Definition: extension_set.cc:1184
google::protobuf.internal::cpp_type
FieldDescriptor::CppType cpp_type(FieldType type)
Definition: extension_set_heavy.cc:133
google::protobuf.internal::DescriptorPoolExtensionFinder::~DescriptorPoolExtensionFinder
~DescriptorPoolExtensionFinder() override
Definition: extension_set_heavy.cc:92
google::protobuf::MessageLite::New
virtual MessageLite * New() const =0
google::protobuf.internal::ExtensionSet::flat_end
KeyValue * flat_end()
Definition: extension_set.h:831
GOOGLE_DCHECK_EQ
#define GOOGLE_DCHECK_EQ
Definition: logging.h:196


libaditof
Author(s):
autogenerated on Wed May 21 2025 02:06:51