generated_message_table_driven.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 
32 
33 #include <type_traits>
34 
42 
43 namespace google {
44 namespace protobuf {
45 namespace internal {
46 
47 namespace {
48 
49 UnknownFieldSet* MutableUnknownFields(MessageLite* msg, int64 arena_offset) {
50  return Raw<InternalMetadataWithArena>(msg, arena_offset)
51  ->mutable_unknown_fields();
52 }
53 
54 struct UnknownFieldHandler {
55  // TODO(mvels): consider renaming UnknownFieldHandler to (TableDrivenTraits?),
56  // and conflating InternalMetaData into it, simplifying the template.
57  static constexpr bool IsLite() { return false; }
58 
59  static bool Skip(MessageLite* msg, const ParseTable& table,
60  io::CodedInputStream* input, int tag) {
61  GOOGLE_DCHECK(table.unknown_field_set);
62 
63  return WireFormat::SkipField(input, tag,
64  MutableUnknownFields(msg, table.arena_offset));
65  }
66 
67  static void Varint(MessageLite* msg, const ParseTable& table, int tag,
68  int value) {
69  GOOGLE_DCHECK(table.unknown_field_set);
70 
71  MutableUnknownFields(msg, table.arena_offset)
72  ->AddVarint(WireFormatLite::GetTagFieldNumber(tag), value);
73  }
74 
75  static bool ParseExtension(MessageLite* msg, const ParseTable& table,
76  io::CodedInputStream* input, int tag) {
77  ExtensionSet* extensions = GetExtensionSet(msg, table.extension_offset);
78  if (extensions == NULL) {
79  return false;
80  }
81 
82  const Message* prototype =
83  down_cast<const Message*>(table.default_instance());
84 
85  GOOGLE_DCHECK(prototype != NULL);
86  GOOGLE_DCHECK(table.unknown_field_set);
87  UnknownFieldSet* unknown_fields =
88  MutableUnknownFields(msg, table.arena_offset);
89 
90  return extensions->ParseField(tag, input, prototype, unknown_fields);
91  }
92 };
93 
94 } // namespace
95 
98  return MergePartialFromCodedStreamImpl<UnknownFieldHandler,
100  input);
101 }
102 
103 } // namespace internal
104 } // namespace protobuf
105 } // namespace google
table
upb_strtable table
Definition: php/ext/google/protobuf/protobuf.h:1065
google::protobuf::IsLite
static bool IsLite(const FileDescriptor *file)
Definition: src/google/protobuf/descriptor.cc:5791
google::protobuf.internal::GetExtensionSet
ExtensionSet * GetExtensionSet(MessageLite *msg, int64 extension_offset)
Definition: generated_message_table_driven_lite.h:94
wire_format_lite.h
google::protobuf.internal::InternalMetadataWithArena
Definition: metadata.h:52
NULL
NULL
Definition: test_security_zap.cpp:405
google::protobuf.internal::MergePartialFromCodedStreamImpl
bool MergePartialFromCodedStreamImpl(MessageLite *msg, const ParseTable &table, io::CodedInputStream *input)
Definition: generated_message_table_driven_lite.h:880
google::protobuf::int64
int64_t int64
Definition: protobuf/src/google/protobuf/stubs/port.h:151
input
std::string input
Definition: tokenizer_unittest.cc:197
GOOGLE_DCHECK
#define GOOGLE_DCHECK
Definition: logging.h:194
google::protobuf::MessageLite
Definition: message_lite.h:183
google::protobuf::python::cmessage::UnknownFieldSet
static PyObject * UnknownFieldSet(CMessage *self)
Definition: python/google/protobuf/pyext/message.cc:2501
google::protobuf.internal::MergePartialFromCodedStream
bool MergePartialFromCodedStream(MessageLite *msg, const ParseTable &table, io::CodedInputStream *input)
Definition: generated_message_table_driven.cc:96
repeated_field.h
generated_message_table_driven.h
casts.h
google::protobuf.internal::WireFormatLite::GetTagFieldNumber
static int GetTagFieldNumber(uint32 tag)
Definition: wire_format_lite.h:777
zero_copy_stream_impl_lite.h
generated_message_table_driven_lite.h
pump.Skip
def Skip(lines, pos, regex)
Definition: pump.py:261
google::protobuf::io::CodedInputStream
Definition: coded_stream.h:173
wire_format.h
metadata.h
google::protobuf.internal::ParseTable
Definition: generated_message_table_driven.h:183
internal
Definition: any.pb.h:40
value
GLsizei const GLfloat * value
Definition: glcorearb.h:3093
google
Definition: data_proto2_to_proto3_util.h:11
google::protobuf.internal::WireFormat::SkipField
static bool SkipField(io::CodedInputStream *input, uint32 tag, UnknownFieldSet *unknown_fields)
Definition: wire_format.cc:84


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