src/google/protobuf/message.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 #include <iostream>
36 #include <stack>
37 #include <unordered_map>
38 
41 
59 
63 
64 #include <google/protobuf/port_def.inc>
65 
66 namespace google {
67 namespace protobuf {
68 
69 namespace internal {
70 
71 // TODO(gerbens) make this factorized better. This should not have to hop
72 // to reflection. Currently uses GeneratedMessageReflection and thus is
73 // defined in generated_message_reflection.cc
74 void RegisterFileLevelMetadata(const DescriptorTable* descriptor_table);
75 
76 } // namespace internal
77 
78 using internal::ReflectionOps;
79 using internal::WireFormat;
80 using internal::WireFormatLite;
81 
82 void Message::MergeFrom(const Message& from) {
85  << ": Tried to merge from a message with a different type. "
86  "to: "
87  << descriptor->full_name()
88  << ", "
89  "from: "
90  << from.GetDescriptor()->full_name();
91  ReflectionOps::Merge(from, this);
92 }
93 
95  MergeFrom(*down_cast<const Message*>(&other));
96 }
97 
98 void Message::CopyFrom(const Message& from) {
101  << ": Tried to copy from a message with a different type. "
102  "to: "
103  << descriptor->full_name()
104  << ", "
105  "from: "
106  << from.GetDescriptor()->full_name();
107  ReflectionOps::Copy(from, this);
108 }
109 
111  return GetDescriptor()->full_name();
112 }
113 
115 
117  return ReflectionOps::IsInitialized(*this);
118 }
119 
120 void Message::FindInitializationErrors(std::vector<std::string>* errors) const {
122 }
123 
125  std::vector<std::string> errors;
127  return Join(errors, ", ");
128 }
129 
131  GOOGLE_CHECK(IsInitialized()) << "Message of type \"" << GetDescriptor()->full_name()
132  << "\" is missing required fields: "
134 }
135 
138 }
139 
140 #if !GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
143 }
144 #endif
145 
146 #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
147 namespace internal {
148 
149 class ReflectionAccessor {
150  public:
151  static void* GetOffset(void* msg, const google::protobuf::FieldDescriptor* f,
153  return static_cast<char*>(msg) + r->schema_.GetFieldOffset(f);
154  }
155 
156  static void* GetRepeatedEnum(const Reflection* reflection,
157  const FieldDescriptor* field, Message* msg) {
158  return reflection->MutableRawRepeatedField(
159  msg, field, FieldDescriptor::CPPTYPE_ENUM, 0, nullptr);
160  }
161 
162  static InternalMetadataWithArena* MutableInternalMetadataWithArena(
163  const Reflection* reflection, Message* msg) {
164  return reflection->MutableInternalMetadataWithArena(msg);
165  }
166 };
167 
168 } // namespace internal
169 
170 void SetField(uint64 val, const FieldDescriptor* field, Message* msg,
171  const Reflection* reflection) {
172 #define STORE_TYPE(CPPTYPE_METHOD) \
173  do \
174  if (field->is_repeated()) { \
175  reflection->Add##CPPTYPE_METHOD(msg, field, value); \
176  } else { \
177  reflection->Set##CPPTYPE_METHOD(msg, field, value); \
178  } \
179  while (0)
180 
181  switch (field->type()) {
182 #define HANDLE_TYPE(TYPE, CPPTYPE, CPPTYPE_METHOD) \
183  case FieldDescriptor::TYPE_##TYPE: { \
184  CPPTYPE value = val; \
185  STORE_TYPE(CPPTYPE_METHOD); \
186  break; \
187  }
188 
189  // Varints
190  HANDLE_TYPE(INT32, int32, Int32)
191  HANDLE_TYPE(INT64, int64, Int64)
192  HANDLE_TYPE(UINT32, uint32, UInt32)
193  HANDLE_TYPE(UINT64, uint64, UInt64)
196  STORE_TYPE(Int32);
197  break;
198  }
201  STORE_TYPE(Int64);
202  break;
203  }
204  HANDLE_TYPE(BOOL, bool, Bool)
205 
206  // Fixed
207  HANDLE_TYPE(FIXED32, uint32, UInt32)
208  HANDLE_TYPE(FIXED64, uint64, UInt64)
209  HANDLE_TYPE(SFIXED32, int32, Int32)
210  HANDLE_TYPE(SFIXED64, int64, Int64)
211 
213  float value;
214  uint32 bit_rep = val;
215  std::memcpy(&value, &bit_rep, sizeof(value));
216  STORE_TYPE(Float);
217  break;
218  }
220  double value;
221  uint64 bit_rep = val;
222  std::memcpy(&value, &bit_rep, sizeof(value));
223  STORE_TYPE(Double);
224  break;
225  }
227  int value = val;
228  if (field->is_repeated()) {
229  reflection->AddEnumValue(msg, field, value);
230  } else {
231  reflection->SetEnumValue(msg, field, value);
232  }
233  break;
234  }
235  default:
236  GOOGLE_LOG(FATAL) << "Error in descriptors, primitve field with field type "
237  << field->type();
238  }
239 #undef STORE_TYPE
240 #undef HANDLE_TYPE
241 }
242 
243 bool ReflectiveValidator(const void* arg, int val) {
244  auto d = static_cast<const EnumDescriptor*>(arg);
245  return d->FindValueByNumber(val) != nullptr;
246 }
247 
248 const char* ParsePackedField(const FieldDescriptor* field, Message* msg,
249  const Reflection* reflection, const char* ptr,
250  internal::ParseContext* ctx) {
251  switch (field->type()) {
252 #define HANDLE_PACKED_TYPE(TYPE, CPPTYPE, METHOD_NAME) \
253  case FieldDescriptor::TYPE_##TYPE: \
254  return internal::Packed##METHOD_NAME##Parser( \
255  reflection->MutableRepeatedField<CPPTYPE>(msg, field), ptr, ctx)
256  HANDLE_PACKED_TYPE(INT32, int32, Int32);
257  HANDLE_PACKED_TYPE(INT64, int64, Int64);
258  HANDLE_PACKED_TYPE(SINT32, int32, SInt32);
259  HANDLE_PACKED_TYPE(SINT64, int64, SInt64);
260  HANDLE_PACKED_TYPE(UINT32, uint32, UInt32);
261  HANDLE_PACKED_TYPE(UINT64, uint64, UInt64);
262  HANDLE_PACKED_TYPE(BOOL, bool, Bool);
264  auto object =
265  internal::ReflectionAccessor::GetRepeatedEnum(reflection, field, msg);
267  return internal::PackedEnumParser(object, ptr, ctx);
268  } else {
270  object, ptr, ctx, ReflectiveValidator, field->enum_type(),
271  internal::ReflectionAccessor::MutableInternalMetadataWithArena(
272  reflection, msg),
273  field->number());
274  }
275  }
276  HANDLE_PACKED_TYPE(FIXED32, uint32, Fixed32);
277  HANDLE_PACKED_TYPE(FIXED64, uint64, Fixed64);
278  HANDLE_PACKED_TYPE(SFIXED32, int32, SFixed32);
279  HANDLE_PACKED_TYPE(SFIXED64, int64, SFixed64);
280  HANDLE_PACKED_TYPE(FLOAT, float, Float);
281  HANDLE_PACKED_TYPE(DOUBLE, double, Double);
282 #undef HANDLE_PACKED_TYPE
283 
284  default:
285  GOOGLE_LOG(FATAL) << "Type is not packable " << field->type();
286  return nullptr; // Make compiler happy
287  }
288 }
289 
290 const char* ParseLenDelim(int field_number, const FieldDescriptor* field,
291  Message* msg, const Reflection* reflection,
292  const char* ptr, internal::ParseContext* ctx) {
296  return ParsePackedField(field, msg, reflection, ptr, ctx);
297  }
298  enum { kNone = 0, kVerify, kStrict } utf8_level = kNone;
299  const char* field_name = nullptr;
300  auto parse_string = [ptr, ctx, &utf8_level, &field_name](std::string* s) {
301  switch (utf8_level) {
302  case kNone:
303  return internal::InlineGreedyStringParser(s, ptr, ctx);
304  case kVerify:
306  field_name);
307  case kStrict:
308  return internal::InlineGreedyStringParserUTF8(s, ptr, ctx, field_name);
309  }
310  };
311  switch (field->type()) {
313  bool enforce_utf8 = true;
314  bool utf8_verification = true;
315  if (enforce_utf8 &&
317  utf8_level = kStrict;
318  } else if (utf8_verification) {
319  utf8_level = kVerify;
320  }
321  field_name = field->full_name().c_str();
322  PROTOBUF_FALLTHROUGH_INTENDED;
323  }
325  if (field->is_repeated()) {
326  int index = reflection->FieldSize(*msg, field);
327  // Add new empty value.
328  reflection->AddString(msg, field, "");
329  if (field->options().ctype() == FieldOptions::STRING ||
330  field->is_extension()) {
331  auto object =
332  reflection->MutableRepeatedPtrField<std::string>(msg, field)
333  ->Mutable(index);
334  return parse_string(object);
335  } else {
336  auto object =
337  reflection->MutableRepeatedPtrField<std::string>(msg, field)
338  ->Mutable(index);
339  return parse_string(object);
340  }
341  } else {
342  // Clear value and make sure it's set.
343  reflection->SetString(msg, field, "");
344  if (field->options().ctype() == FieldOptions::STRING ||
345  field->is_extension()) {
346  // HACK around inability to get mutable_string in reflection
347  std::string* object = &const_cast<std::string&>(
348  reflection->GetStringReference(*msg, field, nullptr));
349  return parse_string(object);
350  } else {
351  // HACK around inability to get mutable_string in reflection
352  std::string* object = &const_cast<std::string&>(
353  reflection->GetStringReference(*msg, field, nullptr));
354  return parse_string(object);
355  }
356  }
357  GOOGLE_LOG(FATAL) << "No other type than string supported";
358  }
360  Message* object;
361  if (field->is_repeated()) {
362  object = reflection->AddMessage(msg, field, ctx->data().factory);
363  } else {
364  object = reflection->MutableMessage(msg, field, ctx->data().factory);
365  }
366  return ctx->ParseMessage(object, ptr);
367  }
368  default:
369  GOOGLE_LOG(FATAL) << "Wrong type for length delim " << field->type();
370  }
371  return nullptr; // Make compiler happy.
372 }
373 
374 Message* GetGroup(int field_number, const FieldDescriptor* field, Message* msg,
375  const Reflection* reflection) {
376  if (field->is_repeated()) {
377  return reflection->AddMessage(msg, field, nullptr);
378  } else {
379  return reflection->MutableMessage(msg, field, nullptr);
380  }
381 }
382 
383 const char* Message::_InternalParse(const char* ptr,
384  internal::ParseContext* ctx) {
385  class ReflectiveFieldParser {
386  public:
387  ReflectiveFieldParser(Message* msg, internal::ParseContext* ctx)
388  : ReflectiveFieldParser(msg, ctx, false) {}
389 
390  void AddVarint(uint32 num, uint64 value) {
391  if (is_item_ && num == 2) {
392  if (!payload_.empty()) {
393  auto field = Field(value, 2);
394  if (field && field->message_type()) {
395  auto child = reflection_->MutableMessage(msg_, field);
396  // TODO(gerbens) signal error
397  child->ParsePartialFromString(payload_);
398  } else {
399  MutableUnknown()->AddLengthDelimited(value)->swap(payload_);
400  }
401  return;
402  }
403  type_id_ = value;
404  return;
405  }
406  auto field = Field(num, 0);
407  if (field) {
408  SetField(value, field, msg_, reflection_);
409  } else {
410  MutableUnknown()->AddVarint(num, value);
411  }
412  }
413  void AddFixed64(uint32 num, uint64 value) {
414  auto field = Field(num, 1);
415  if (field) {
416  SetField(value, field, msg_, reflection_);
417  } else {
418  MutableUnknown()->AddFixed64(num, value);
419  }
420  }
421  const char* ParseLengthDelimited(uint32 num, const char* ptr,
422  internal::ParseContext* ctx) {
423  if (is_item_ && num == 3) {
424  if (type_id_ == 0) {
425  return InlineGreedyStringParser(&payload_, ptr, ctx);
426  }
427  num = type_id_;
428  type_id_ = 0;
429  }
430  auto field = Field(num, 2);
431  if (field) {
432  return ParseLenDelim(num, field, msg_, reflection_, ptr, ctx);
433  } else {
435  MutableUnknown()->AddLengthDelimited(num), ptr, ctx);
436  }
437  }
438  const char* ParseGroup(uint32 num, const char* ptr,
439  internal::ParseContext* ctx) {
440  if (!is_item_ && descriptor_->options().message_set_wire_format() &&
441  num == 1) {
442  is_item_ = true;
443  ptr = ctx->ParseGroup(this, ptr, num * 8 + 3);
444  is_item_ = false;
445  type_id_ = 0;
446  return ptr;
447  }
448  auto field = Field(num, 3);
449  if (field) {
450  auto msg = GetGroup(num, field, msg_, reflection_);
451  return ctx->ParseGroup(msg, ptr, num * 8 + 3);
452  } else {
453  return UnknownFieldParse(num * 8 + 3, MutableUnknown(), ptr, ctx);
454  }
455  }
456  void AddFixed32(uint32 num, uint32 value) {
457  auto field = Field(num, 5);
458  if (field) {
459  SetField(value, field, msg_, reflection_);
460  } else {
461  MutableUnknown()->AddFixed32(num, value);
462  }
463  }
464 
465  const char* _InternalParse(const char* ptr, internal::ParseContext* ctx) {
466  // We're parsing the a MessageSetItem
467  GOOGLE_DCHECK(is_item_);
468  return internal::WireFormatParser(*this, ptr, ctx);
469  }
470 
471  private:
472  Message* msg_;
473  const Descriptor* descriptor_;
474  const Reflection* reflection_;
475  internal::ParseContext* ctx_;
476  UnknownFieldSet* unknown_ = nullptr;
477  bool is_item_ = false;
478  uint32 type_id_ = 0;
479  std::string payload_;
480 
481  ReflectiveFieldParser(Message* msg, internal::ParseContext* ctx,
482  bool is_item)
483  : msg_(msg),
484  descriptor_(msg->GetDescriptor()),
485  reflection_(msg->GetReflection()),
486  ctx_(ctx),
487  is_item_(is_item) {
488  GOOGLE_CHECK(descriptor_) << msg->GetTypeName();
489  GOOGLE_CHECK(reflection_) << msg->GetTypeName();
490  }
491 
492  const FieldDescriptor* Field(int num, int wire_type) {
493  auto field = descriptor_->FindFieldByNumber(num);
494 
495  // If that failed, check if the field is an extension.
496  if (field == nullptr && descriptor_->IsExtensionNumber(num)) {
497  const DescriptorPool* pool = ctx_->data().pool;
498  if (pool == NULL) {
499  field = reflection_->FindKnownExtensionByNumber(num);
500  } else {
501  field = pool->FindExtensionByNumber(descriptor_, num);
502  }
503  }
504  if (field == nullptr) return nullptr;
505 
507  wire_type) {
508  if (field->is_packable()) {
509  if (wire_type ==
511  return field;
512  }
513  }
514  return nullptr;
515  }
516  return field;
517  }
518 
519  UnknownFieldSet* MutableUnknown() {
520  if (unknown_) return unknown_;
521  return unknown_ = reflection_->MutableUnknownFields(msg_);
522  }
523  };
524 
525  ReflectiveFieldParser field_parser(this, ctx);
526  return internal::WireFormatParser(field_parser, ptr, ctx);
527 }
528 #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
529 
532  static_cast<const internal::SerializationTable*>(InternalGetTable());
533  if (table == 0) {
535  } else {
537  }
538 }
539 
540 size_t Message::ByteSizeLong() const {
541  size_t size = WireFormat::ByteSize(*this);
543  return size;
544 }
545 
546 void Message::SetCachedSize(int /* size */) const {
547  GOOGLE_LOG(FATAL) << "Message class \"" << GetDescriptor()->full_name()
548  << "\" implements neither SetCachedSize() nor ByteSize(). "
549  "Must implement one or the other.";
550 }
551 
552 size_t Message::SpaceUsedLong() const {
553  return GetReflection()->SpaceUsedLong(*this);
554 }
555 
556 // =============================================================================
557 // MessageFactory
558 
560 
561 namespace {
562 
563 class GeneratedMessageFactory : public MessageFactory {
564  public:
565  static GeneratedMessageFactory* singleton();
566 
567  void RegisterFile(const google::protobuf::internal::DescriptorTable* table);
568  void RegisterType(const Descriptor* descriptor, const Message* prototype);
569 
570  // implements MessageFactory ---------------------------------------
571  const Message* GetPrototype(const Descriptor* type) override;
572 
573  private:
574  // Only written at static init time, so does not require locking.
575  std::unordered_map<const char*, const google::protobuf::internal::DescriptorTable*,
578 
579  internal::WrappedMutex mutex_;
580  // Initialized lazily, so requires locking.
581  std::unordered_map<const Descriptor*, const Message*> type_map_;
582 };
583 
584 GeneratedMessageFactory* GeneratedMessageFactory::singleton() {
585  static auto instance =
586  internal::OnShutdownDelete(new GeneratedMessageFactory);
587  return instance;
588 }
589 
590 void GeneratedMessageFactory::RegisterFile(
592  if (!InsertIfNotPresent(&file_map_, table->filename, table)) {
593  GOOGLE_LOG(FATAL) << "File is already registered: " << table->filename;
594  }
595 }
596 
597 void GeneratedMessageFactory::RegisterType(const Descriptor* descriptor,
598  const Message* prototype) {
600  << "Tried to register a non-generated type with the generated "
601  "type registry.";
602 
603  // This should only be called as a result of calling a file registration
604  // function during GetPrototype(), in which case we already have locked
605  // the mutex.
606  mutex_.AssertHeld();
607  if (!InsertIfNotPresent(&type_map_, descriptor, prototype)) {
608  GOOGLE_LOG(DFATAL) << "Type is already registered: " << descriptor->full_name();
609  }
610 }
611 
612 
613 const Message* GeneratedMessageFactory::GetPrototype(const Descriptor* type) {
614  {
615  ReaderMutexLock lock(&mutex_);
616  const Message* result = FindPtrOrNull(type_map_, type);
617  if (result != NULL) return result;
618  }
619 
620  // If the type is not in the generated pool, then we can't possibly handle
621  // it.
622  if (type->file()->pool() != DescriptorPool::generated_pool()) return NULL;
623 
624  // Apparently the file hasn't been registered yet. Let's do that now.
625  const internal::DescriptorTable* registration_data =
626  FindPtrOrNull(file_map_, type->file()->name().c_str());
627  if (registration_data == NULL) {
628  GOOGLE_LOG(DFATAL) << "File appears to be in generated pool but wasn't "
629  "registered: "
630  << type->file()->name();
631  return NULL;
632  }
633 
634  WriterMutexLock lock(&mutex_);
635 
636  // Check if another thread preempted us.
637  const Message* result = FindPtrOrNull(type_map_, type);
638  if (result == NULL) {
639  // Nope. OK, register everything.
640  internal::RegisterFileLevelMetadata(registration_data);
641  // Should be here now.
642  result = FindPtrOrNull(type_map_, type);
643  }
644 
645  if (result == NULL) {
646  GOOGLE_LOG(DFATAL) << "Type appears to be in generated pool but wasn't "
647  << "registered: " << type->full_name();
648  }
649 
650  return result;
651 }
652 
653 } // namespace
654 
656  return GeneratedMessageFactory::singleton();
657 }
658 
661  GeneratedMessageFactory::singleton()->RegisterFile(table);
662 }
663 
665  const Descriptor* descriptor, const Message* prototype) {
666  GeneratedMessageFactory::singleton()->RegisterType(descriptor, prototype);
667 }
668 
669 
670 namespace {
671 template <typename T>
672 T* GetSingleton() {
673  static T singleton;
674  return &singleton;
675 }
676 } // namespace
677 
679  const FieldDescriptor* field) const {
680  GOOGLE_CHECK(field->is_repeated());
681  switch (field->cpp_type()) {
682 #define HANDLE_PRIMITIVE_TYPE(TYPE, type) \
683  case FieldDescriptor::CPPTYPE_##TYPE: \
684  return GetSingleton<internal::RepeatedFieldPrimitiveAccessor<type> >();
689  HANDLE_PRIMITIVE_TYPE(FLOAT, float)
690  HANDLE_PRIMITIVE_TYPE(DOUBLE, double)
691  HANDLE_PRIMITIVE_TYPE(BOOL, bool)
693 #undef HANDLE_PRIMITIVE_TYPE
695  switch (field->options().ctype()) {
696  default:
698  return GetSingleton<internal::RepeatedPtrFieldStringAccessor>();
699  }
700  break;
702  if (field->is_map()) {
703  return GetSingleton<internal::MapFieldAccessor>();
704  } else {
705  return GetSingleton<internal::RepeatedPtrFieldMessageAccessor>();
706  }
707  }
708  GOOGLE_LOG(FATAL) << "Should not reach here.";
709  return NULL;
710 }
711 
712 namespace internal {
713 template <>
714 #if defined(_MSC_VER) && (_MSC_VER >= 1800)
715 // Note: force noinline to workaround MSVC compiler bug with /Zc:inline, issue
716 // #240
717 PROTOBUF_NOINLINE
718 #endif
719  Message*
721  Arena* arena) {
722  return prototype->New(arena);
723 }
724 template <>
725 #if defined(_MSC_VER) && (_MSC_VER >= 1800)
726 // Note: force noinline to workaround MSVC compiler bug with /Zc:inline, issue
727 // #240
728 PROTOBUF_NOINLINE
729 #endif
730  Arena*
732  return value->GetArena();
733 }
734 template <>
735 #if defined(_MSC_VER) && (_MSC_VER >= 1800)
736 // Note: force noinline to workaround MSVC compiler bug with /Zc:inline, issue
737 // #240
738 PROTOBUF_NOINLINE
739 #endif
740  void*
742  return value->GetMaybeArenaPointer();
743 }
744 } // namespace internal
745 
746 } // namespace protobuf
747 } // namespace google
google::protobuf::Descriptor::full_name
const std::string & full_name() const
reflection_ops.h
table
upb_strtable table
Definition: php/ext/google/protobuf/protobuf.h:1065
GOOGLE_CHECK_EQ
#define GOOGLE_CHECK_EQ(A, B)
Definition: logging.h:156
Json::UInt64
unsigned long long int UInt64
Definition: json.h:241
google::protobuf::FieldDescriptor::TYPE_SINT64
@ TYPE_SINT64
Definition: src/google/protobuf/descriptor.h:544
google::protobuf::FieldDescriptor::CPPTYPE_ENUM
@ CPPTYPE_ENUM
Definition: src/google/protobuf/descriptor.h:561
google::protobuf::FieldDescriptor::options
const FieldOptions & options() const
google::protobuf::FieldDescriptor::enum_type
const EnumDescriptor * enum_type() const
Definition: src/google/protobuf/descriptor.cc:7235
google::protobuf::value
const Descriptor::ReservedRange value
Definition: src/google/protobuf/descriptor.h:1954
map_util.h
google::protobuf::FieldDescriptor::CPPTYPE_STRING
@ CPPTYPE_STRING
Definition: src/google/protobuf/descriptor.h:562
google::protobuf::MessageFactory::InternalRegisterGeneratedFile
static void InternalRegisterGeneratedFile(const google::protobuf::internal::DescriptorTable *table)
Definition: src/google/protobuf/message.cc:659
google::protobuf::FieldDescriptor
Definition: src/google/protobuf/descriptor.h:515
google::protobuf::Message::SpaceUsedLong
virtual size_t SpaceUsedLong() const
Definition: src/google/protobuf/message.cc:552
wire_format_lite.h
zero_copy_stream_impl.h
google::protobuf.internal::RegisterFileLevelMetadata
void RegisterFileLevelMetadata(const DescriptorTable *table)
Definition: generated_message_reflection.cc:2417
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::FieldDescriptor::is_extension
bool is_extension() const
google::protobuf.internal::InlineGreedyStringParserUTF8Verify
const PROTOBUF_MUST_USE_RESULT char * InlineGreedyStringParserUTF8Verify(std::string *s, const char *ptr, ParseContext *ctx, const char *field_name)
Definition: parse_context.h:613
google::protobuf::MessageLite::GetCachedSize
virtual int GetCachedSize() const =0
map_field_inl.h
google::protobuf::FieldDescriptor::full_name
const std::string & full_name() const
google::protobuf::FieldDescriptor::TYPE_SINT32
@ TYPE_SINT32
Definition: src/google/protobuf/descriptor.h:543
input
std::string input
Definition: tokenizer_unittest.cc:197
type_map_
std::unordered_map< const Descriptor *, const Message * > type_map_
Definition: src/google/protobuf/message.cc:581
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
google::protobuf::FindPtrOrNull
Collection::value_type::second_type FindPtrOrNull(const Collection &collection, const typename Collection::value_type::first_type &key)
Definition: map_util.h:166
s
XmlRpcServer s
google::protobuf::Message::GetReflection
const Reflection * GetReflection() const
Definition: src/google/protobuf/message.h:335
google::protobuf.internal::WireFormat::ByteSize
static size_t ByteSize(const Message &message)
Definition: wire_format.cc:1078
google::protobuf::uint32
uint32_t uint32
Definition: protobuf/src/google/protobuf/stubs/port.h:155
google::protobuf::Message::CopyFrom
virtual void CopyFrom(const Message &from)
Definition: src/google/protobuf/message.cc:98
google::protobuf::MessageFactory::generated_factory
static MessageFactory * generated_factory()
Definition: src/google/protobuf/message.cc:655
errors
const char * errors
Definition: tokenizer_unittest.cc:841
generated_message_reflection.h
string
GLsizei const GLchar *const * string
Definition: glcorearb.h:3083
google::protobuf.internal::SetField
void SetField(MessageLite *msg, uint32 *has_bits, uint32 has_bit_index, int64 offset, Type value)
Definition: generated_message_table_driven_lite.h:142
google::protobuf::Message::FindInitializationErrors
void FindInitializationErrors(std::vector< std::string > *errors) const
Definition: src/google/protobuf/message.cc:120
google::protobuf::MessageLite
Definition: message_lite.h:183
google::protobuf::Reflection
Definition: src/google/protobuf/message.h:400
descriptor
Descriptor * descriptor
Definition: php/ext/google/protobuf/protobuf.h:936
google::protobuf::MessageFactory::~MessageFactory
virtual ~MessageFactory()
Definition: src/google/protobuf/message.cc:559
google::protobuf.internal.python_message._InternalParse
_InternalParse
Definition: python_message.py:1197
google::protobuf::HANDLE_TYPE
HANDLE_TYPE(int32, FieldDescriptor::CPPTYPE_INT32, -1)
google::protobuf::python::cmessage::UnknownFieldSet
static PyObject * UnknownFieldSet(CMessage *self)
Definition: python/google/protobuf/pyext/message.cc:2501
testing::internal::Int32
TypeWithSize< 4 >::Int Int32
Definition: gtest-port.h:2241
google::protobuf::MessageFactory
Definition: src/google/protobuf/message.h:1069
google::protobuf::Reflection::SpaceUsedLong
size_t SpaceUsedLong(const Message &message) const
Definition: generated_message_reflection.cc:241
T
#define T(upbtypeconst, upbtype, ctype, default_value)
google::protobuf::MessageLite::InternalGetTable
virtual const void * InternalGetTable() const
Definition: message_lite.h:482
Descriptor
Definition: ruby/ext/google/protobuf_c/protobuf.h:113
google::protobuf::Message::IsInitialized
bool IsInitialized() const override
Definition: src/google/protobuf/message.cc:116
map_field.h
google::protobuf.internal::InlineGreedyStringParserUTF8
const char * InlineGreedyStringParserUTF8(std::string *s, const char *ptr, ParseContext *ctx, const char *field_name)
Definition: parse_context.cc:368
google::protobuf::FileDescriptor::syntax
Syntax syntax() const
Definition: src/google/protobuf/descriptor.h:2175
google::protobuf::Message::InitializationErrorString
std::string InitializationErrorString() const override
Definition: src/google/protobuf/message.cc:124
google::protobuf::Message::CheckInitialized
void CheckInitialized() const
Definition: src/google/protobuf/message.cc:130
testing::internal::Double
FloatingPoint< double > Double
Definition: gtest-internal.h:429
google::protobuf.internal::ReflectionOps::FindInitializationErrors
static void FindInitializationErrors(const Message &message, const std::string &prefix, std::vector< std::string > *errors)
Definition: reflection_ops.cc:300
reflection_internal.h
testing::internal::UInt32
TypeWithSize< 4 >::UInt UInt32
Definition: gtest-port.h:2242
google::protobuf::MessageFactory::InternalRegisterGeneratedMessage
static void InternalRegisterGeneratedMessage(const Descriptor *descriptor, const Message *prototype)
Definition: src/google/protobuf/message.cc:664
google::protobuf.internal::ReflectionOps::Merge
static void Merge(const Message &from, Message *to)
Definition: reflection_ops.cc:72
parse_context.h
FieldDescriptor
Definition: ruby/ext/google/protobuf_c/protobuf.h:129
google::protobuf.internal::OnShutdownDelete
T * OnShutdownDelete(T *p)
Definition: common.h:185
google::protobuf::int32
int32_t int32
Definition: protobuf/src/google/protobuf/stubs/port.h:150
google::protobuf::Message::SerializeWithCachedSizes
void SerializeWithCachedSizes(io::CodedOutputStream *output) const override
Definition: src/google/protobuf/message.cc:530
google::protobuf::Reflection::RepeatedFieldAccessor
const internal::RepeatedFieldAccessor * RepeatedFieldAccessor(const FieldDescriptor *field) const
Definition: src/google/protobuf/message.cc:678
strutil.h
unknown_field_set.h
google::protobuf::FieldDescriptor::file
const FileDescriptor * file() const
google::protobuf::FileDescriptor::pool
const DescriptorPool * pool() const
google::protobuf::FieldDescriptor::is_packable
bool is_packable() const
Definition: src/google/protobuf/descriptor.h:2071
testing::internal::Float
FloatingPoint< float > Float
Definition: gtest-internal.h:428
coded_stream.h
google::protobuf.internal::PackedEnumParserArg
const char * PackedEnumParserArg(void *object, const char *ptr, ParseContext *ctx, bool(*is_valid)(const void *, int), const void *data, InternalMetadataWithArenaLite *metadata, int field_num)
Definition: parse_context.cc:437
google::protobuf.internal::GenericTypeHandler::GetMaybeArenaPointer
static void * GetMaybeArenaPointer(GenericType *value)
Definition: repeated_field.h:698
google::protobuf.internal::ReflectionOps::DiscardUnknownFields
static void DiscardUnknownFields(Message *message)
Definition: reflection_ops.cc:238
ReaderMutexLock
#define ReaderMutexLock(x)
Definition: glog/src/base/mutex.h:324
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::RepeatedFieldAccessor
Definition: reflection.h:301
google::protobuf::FieldDescriptor::number
int number() const
GOOGLE_LOG
#define GOOGLE_LOG(LEVEL)
Definition: logging.h:146
mutex_
internal::WrappedMutex mutex_
Definition: src/google/protobuf/message.cc:579
google::protobuf::Message::SetCachedSize
virtual void SetCachedSize(int size) const
Definition: src/google/protobuf/message.cc:546
googletest-filter-unittest.child
child
Definition: googletest-filter-unittest.py:62
google::protobuf::uint64
uint64_t uint64
Definition: protobuf/src/google/protobuf/stubs/port.h:156
size
#define size
Definition: glcorearb.h:2944
google::protobuf::FieldDescriptor::TYPE_STRING
@ TYPE_STRING
Definition: src/google/protobuf/descriptor.h:534
google::protobuf.internal::DescriptorTable
Definition: generated_message_reflection.h:266
d
d
EnumDescriptor
Definition: ruby/ext/google/protobuf_c/protobuf.h:137
google::protobuf::FileDescriptor::SYNTAX_PROTO3
@ SYNTAX_PROTO3
Definition: src/google/protobuf/descriptor.h:1394
casts.h
field
const FieldDescriptor * field
Definition: parser_unittest.cc:2694
HANDLE_PRIMITIVE_TYPE
#define HANDLE_PRIMITIVE_TYPE(TYPE, type)
google::protobuf.internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED
@ WIRETYPE_LENGTH_DELIMITED
Definition: wire_format_lite.h:104
GOOGLE_CHECK
#define GOOGLE_CHECK(EXPRESSION)
Definition: logging.h:153
pool
InternalDescriptorPool * pool
Definition: php/ext/google/protobuf/protobuf.h:798
google::protobuf.internal::WireFormat::SerializeWithCachedSizes
static void SerializeWithCachedSizes(const Message &message, int size, io::CodedOutputStream *output)
Definition: wire_format.cc:711
parse_string
static cJSON_bool parse_string(cJSON *const item, parse_buffer *const input_buffer)
Definition: cJSON.c:682
google::protobuf::io::CodedOutputStream
Definition: coded_stream.h:693
google::protobuf::Message::CheckTypeAndMergeFrom
void CheckTypeAndMergeFrom(const MessageLite &other) override
Definition: src/google/protobuf/message.cc:94
google::protobuf::FieldDescriptor::TYPE_MESSAGE
@ TYPE_MESSAGE
Definition: src/google/protobuf/descriptor.h:536
google::protobuf::FieldDescriptor::TYPE_DOUBLE
@ TYPE_DOUBLE
Definition: src/google/protobuf/descriptor.h:522
Field
struct Field Field
Definition: php/ext/google/protobuf/protobuf.h:638
type
GLenum type
Definition: glcorearb.h:2695
google::protobuf::FieldDescriptor::TYPE_FLOAT
@ TYPE_FLOAT
Definition: src/google/protobuf/descriptor.h:523
google::protobuf::Message
Definition: src/google/protobuf/message.h:205
google::protobuf::Message::GetDescriptor
const Descriptor * GetDescriptor() const
Definition: src/google/protobuf/message.h:326
google::protobuf::hash< const char * >
Definition: hash.h:63
HANDLE_PACKED_TYPE
#define HANDLE_PACKED_TYPE(TYPE, CPPTYPE, CPPTYPE_METHOD)
google::protobuf::FieldDescriptor::type
Type type() const
Definition: src/google/protobuf/descriptor.h:2052
file_map_
std::unordered_map< const char *, const google::protobuf::internal::DescriptorTable *, hash< const char * >, streq > file_map_
Definition: src/google/protobuf/message.cc:577
google::protobuf::Message::MergePartialFromCodedStream
bool MergePartialFromCodedStream(io::CodedInputStream *input) override
Definition: src/google/protobuf/message.cc:141
google::protobuf.internal::GenericTypeHandler::GetArena
static Arena * GetArena(GenericType *value)
Definition: repeated_field.h:695
google::protobuf.internal::ToCachedSize
int ToCachedSize(size_t size)
Definition: message_lite.h:89
google::protobuf.internal::PackedEnumParser
const char * PackedEnumParser(void *object, const char *ptr, ParseContext *ctx)
Definition: parse_context.cc:419
common.h
google::protobuf.internal::SerializationTable
Definition: generated_message_table_driven.h:234
google::protobuf.internal::GenericTypeHandler::NewFromPrototype
static GenericType * NewFromPrototype(const GenericType *prototype, Arena *arena=NULL)
Definition: repeated_field.h:711
google::protobuf::Message::GetTypeName
std::string GetTypeName() const override
Definition: src/google/protobuf/message.cc:110
size
GLsizeiptr size
Definition: glcorearb.h:2943
stl_util.h
google::protobuf.internal::WireFormat::WireTypeForFieldType
static WireFormatLite::WireType WireTypeForFieldType(FieldDescriptor::Type type)
Definition: wire_format.h:281
google::protobuf::DescriptorPool::generated_pool
static const DescriptorPool * generated_pool()
Definition: src/google/protobuf/descriptor.cc:1346
FieldOptions::ctype
PROTOBUF_NAMESPACE_ID::FieldOptions_CType ctype() const
Definition: descriptor.pb.h:10566
google::protobuf::io::CodedInputStream
Definition: coded_stream.h:173
wire_format.h
logging.h
google::protobuf::Message::MergeFrom
virtual void MergeFrom(const Message &from)
Definition: src/google/protobuf/message.cc:82
google::protobuf::Descriptor::file
const FileDescriptor * file() const
r
GLboolean r
Definition: glcorearb.h:3228
google::protobuf.internal::WireFormat::ParseAndMergePartial
static bool ParseAndMergePartial(io::CodedInputStream *input, Message *message)
Definition: wire_format.cc:384
google::protobuf::Descriptor
Definition: src/google/protobuf/descriptor.h:231
descriptor.h
google::protobuf.internal::TableSerialize
void TableSerialize(const MessageLite &msg, const SerializationTable *table, io::CodedOutputStream *output)
Definition: generated_message_table_driven.h:244
google::protobuf::Message::ByteSizeLong
size_t ByteSizeLong() const override
Definition: src/google/protobuf/message.cc:540
google::protobuf::Message::New
Message * New() const override=0
hash.h
generated_message_util.h
google::protobuf.internal::ReflectionOps::Copy
static void Copy(const Message &from, Message *to)
Definition: reflection_ops.cc:66
FieldOptions::STRING
static constexpr CType STRING
Definition: descriptor.pb.h:4197
google::protobuf.internal::WireFormatLite::ZigZagDecode64
static int64 ZigZagDecode64(uint64 n)
Definition: wire_format_lite.h:870
internal
Definition: any.pb.h:40
WriterMutexLock
#define WriterMutexLock(x)
Definition: glog/src/base/mutex.h:325
val
GLuint GLfloat * val
Definition: glcorearb.h:3604
google::protobuf::Join
void Join(Iterator start, Iterator end, const char *delim, string *result)
Definition: strutil.h:769
f
GLfloat f
Definition: glcorearb.h:3964
value
GLsizei const GLfloat * value
Definition: glcorearb.h:3093
google::protobuf.internal::ReflectionOps::IsInitialized
static bool IsInitialized(const Message &message)
Definition: reflection_ops.cc:177
descriptor_
const Descriptor * descriptor_
Definition: field_comparator_test.cc:56
descriptor.pb.h
google::protobuf.internal::InlineGreedyStringParser
const char * InlineGreedyStringParser(std::string *s, const char *ptr, ParseContext *ctx)
Definition: parse_context.cc:361
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::Message::DiscardUnknownFields
virtual void DiscardUnknownFields()
Definition: src/google/protobuf/message.cc:136
google::protobuf::FieldDescriptor::TYPE_ENUM
@ TYPE_ENUM
Definition: src/google/protobuf/descriptor.h:540
false
#define false
Definition: cJSON.c:70
DescriptorPool
Definition: ruby/ext/google/protobuf_c/protobuf.h:109
index
GLuint index
Definition: glcorearb.h:3055
google::protobuf::Message::Message
Message()
Definition: src/google/protobuf/message.h:207
google::protobuf.internal::WireFormatParser
const PROTOBUF_MUST_USE_RESULT char * WireFormatParser(T &field_parser, const char *ptr, ParseContext *ctx)
Definition: parse_context.h:684
google::protobuf::FieldDescriptor::is_repeated
bool is_repeated() const
Definition: src/google/protobuf/descriptor.h:2067
Json::Int64
long long int Int64
Definition: json.h:240
google::protobuf::InsertIfNotPresent
bool InsertIfNotPresent(Collection *const collection, const typename Collection::value_type &vt)
Definition: map_util.h:321
google
Definition: data_proto2_to_proto3_util.h:11
google::protobuf::streq
Definition: hash.h:114
google::protobuf.internal::WireFormatLite::ZigZagDecode32
static int32 ZigZagDecode32(uint32 n)
Definition: wire_format_lite.h:859
google::protobuf.internal::ReflectionOps::Clear
static void Clear(Message *message)
Definition: reflection_ops.cc:165
GOOGLE_DCHECK_EQ
#define GOOGLE_DCHECK_EQ
Definition: logging.h:196
google::protobuf::Message::Clear
void Clear() override
Definition: src/google/protobuf/message.cc:114


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