Classes | Namespaces | Macros | Functions | Variables
protobuf/src/google/protobuf/wire_format.cc File Reference
#include <google/protobuf/wire_format.h>
#include <stack>
#include <string>
#include <vector>
#include <google/protobuf/stubs/logging.h>
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/stringprintf.h>
#include <google/protobuf/descriptor.pb.h>
#include <google/protobuf/parse_context.h>
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/io/zero_copy_stream.h>
#include <google/protobuf/io/zero_copy_stream_impl.h>
#include <google/protobuf/descriptor.h>
#include <google/protobuf/dynamic_message.h>
#include <google/protobuf/map_field.h>
#include <google/protobuf/map_field_inl.h>
#include <google/protobuf/message.h>
#include <google/protobuf/message_lite.h>
#include <google/protobuf/unknown_field_set.h>
#include <google/protobuf/port_def.inc>
#include <google/protobuf/port_undef.inc>
Include dependency graph for protobuf/src/google/protobuf/wire_format.cc:

Go to the source code of this file.

Classes

class  google::protobuf.internal::MapKeySorter::MapKeyComparator
 
class  google::protobuf.internal::MapKeySorter
 
struct  google::protobuf.internal::WireFormat::MessageSetParser
 

Namespaces

 google
 
 google::protobuf
 
 google.protobuf.internal
 

Macros

#define CASE_TYPE(CppType, CamelCppType)
 
#define CASE_TYPE(FieldType, CamelFieldType, CamelCppType)
 
#define CASE_TYPE(FieldType, CamelFieldType, CamelCppType)
 
#define CASE_TYPE(FieldType, CamelFieldType, CamelCppType)
 
#define CASE_TYPE(FieldType, CamelFieldType, CamelCppType)
 
#define FIXED_CASE_TYPE(FieldType, CamelFieldType)
 
#define FIXED_CASE_TYPE(FieldType, CamelFieldType)
 
#define HANDLE_FIXED_TYPE(TYPE, TYPE_METHOD)
 
#define HANDLE_PACKED_TYPE(TYPE, CPPTYPE, CPPTYPE_METHOD)
 
#define HANDLE_PACKED_TYPE(TYPE, CPPTYPE, CPPTYPE_METHOD)
 
#define HANDLE_PRIMITIVE_TYPE(TYPE, CPPTYPE, TYPE_METHOD, CPPTYPE_METHOD)
 
#define HANDLE_PRIMITIVE_TYPE(TYPE, CPPTYPE, TYPE_METHOD, CPPTYPE_METHOD)
 
#define HANDLE_PRIMITIVE_TYPE(TYPE, CPPTYPE, TYPE_METHOD, CPPTYPE_METHOD)
 
#define HANDLE_TYPE(TYPE, CPPTYPE, CPPTYPE_METHOD)
 
#define HANDLE_TYPE(TYPE, CPPTYPE, CPPTYPE_METHOD)
 
#define HANDLE_TYPE(TYPE, CPPTYPE, CPPTYPE_METHOD)
 
#define HANDLE_TYPE(TYPE, TYPE_METHOD, CPPTYPE_METHOD)
 
#define HANDLE_TYPE(TYPE, TYPE_METHOD, CPPTYPE_METHOD)
 

Functions

size_t google.protobuf.internal::ComputeUnknownFieldsSize (const InternalMetadata &metadata, size_t total_size, CachedSize *cached_size)
 
static uint8_tgoogle.protobuf.internal::InternalSerializeMapEntry (const FieldDescriptor *field, const MapKey &key, const MapValueConstRef &value, uint8_t *target, io::EpsCopyOutputStream *stream)
 
static size_t google.protobuf.internal::MapKeyDataOnlyByteSize (const FieldDescriptor *field, const MapKey &value)
 
static size_t google.protobuf.internal::MapValueRefDataOnlyByteSize (const FieldDescriptor *field, const MapValueConstRef &value)
 
static uint8 * google.protobuf.internal::SerializeMapKeyWithCachedSizes (const FieldDescriptor *field, const MapKey &value, uint8 *target, io::EpsCopyOutputStream *stream)
 
static uint8_tgoogle.protobuf.internal::SerializeMapValueRefWithCachedSizes (const FieldDescriptor *field, const MapValueConstRef &value, uint8_t *target, io::EpsCopyOutputStream *stream)
 
static bool google.protobuf.internal::StrictUtf8Check (const FieldDescriptor *field)
 

Variables

const size_t kMapEntryTagByteSize = 2
 

Macro Definition Documentation

◆ CASE_TYPE [1/5]

#define CASE_TYPE (   CppType,
  CamelCppType 
)
Value:
case FieldDescriptor::CPPTYPE_##CppType: { \
return a.Get##CamelCppType##Value() < b.Get##CamelCppType##Value(); \
}

◆ CASE_TYPE [2/5]

#define CASE_TYPE (   FieldType,
  CamelFieldType,
  CamelCppType 
)
Value:
case FieldDescriptor::TYPE_##FieldType: \
target = WireFormatLite::Write##CamelFieldType##ToArray( \
1, value.Get##CamelCppType##Value(), target); \
break;

◆ CASE_TYPE [3/5]

#define CASE_TYPE (   FieldType,
  CamelFieldType,
  CamelCppType 
)
Value:
case FieldDescriptor::TYPE_##FieldType: \
target = WireFormatLite::Write##CamelFieldType##ToArray( \
2, value.Get##CamelCppType##Value(), target); \
break;

◆ CASE_TYPE [4/5]

#define CASE_TYPE (   FieldType,
  CamelFieldType,
  CamelCppType 
)
Value:
case FieldDescriptor::TYPE_##FieldType: \
return WireFormatLite::CamelFieldType##Size( \
value.Get##CamelCppType##Value());

◆ CASE_TYPE [5/5]

#define CASE_TYPE (   FieldType,
  CamelFieldType,
  CamelCppType 
)
Value:
case FieldDescriptor::TYPE_##FieldType: \
return WireFormatLite::CamelFieldType##Size( \
value.Get##CamelCppType##Value());

◆ FIXED_CASE_TYPE [1/2]

#define FIXED_CASE_TYPE (   FieldType,
  CamelFieldType 
)
Value:
case FieldDescriptor::TYPE_##FieldType: \
return WireFormatLite::k##CamelFieldType##Size;

◆ FIXED_CASE_TYPE [2/2]

#define FIXED_CASE_TYPE (   FieldType,
  CamelFieldType 
)
Value:
case FieldDescriptor::TYPE_##FieldType: \
return WireFormatLite::k##CamelFieldType##Size;

◆ HANDLE_FIXED_TYPE

#define HANDLE_FIXED_TYPE (   TYPE,
  TYPE_METHOD 
)
Value:
case FieldDescriptor::TYPE_##TYPE: \
data_size += count * WireFormatLite::k##TYPE_METHOD##Size; \
break;

◆ HANDLE_PACKED_TYPE [1/2]

#define HANDLE_PACKED_TYPE (   TYPE,
  CPPTYPE,
  CPPTYPE_METHOD 
)
Value:
case FieldDescriptor::TYPE_##TYPE: { \
while (input->BytesUntilLimit() > 0) { \
CPPTYPE value; \
if (!WireFormatLite::ReadPrimitive<CPPTYPE, \
WireFormatLite::TYPE_##TYPE>(input, \
&value)) \
return false; \
message_reflection->Add##CPPTYPE_METHOD(message, field, value); \
} \
break; \
}

◆ HANDLE_PACKED_TYPE [2/2]

#define HANDLE_PACKED_TYPE (   TYPE,
  CPPTYPE,
  CPPTYPE_METHOD 
)
Value:
case FieldDescriptor::TYPE_##TYPE: { \
ptr = internal::Packed##CPPTYPE_METHOD##Parser( \
reflection->MutableRepeatedFieldInternal<CPPTYPE>(msg, field), ptr, \
ctx); \
return ptr; \
}

◆ HANDLE_PRIMITIVE_TYPE [1/3]

#define HANDLE_PRIMITIVE_TYPE (   TYPE,
  CPPTYPE,
  TYPE_METHOD,
  CPPTYPE_METHOD 
)
Value:
case FieldDescriptor::TYPE_##TYPE: { \
auto r = \
message_reflection->GetRepeatedFieldInternal<CPPTYPE>(message, field); \
target = stream->Write##TYPE_METHOD##Packed( \
field->number(), r, FieldDataOnlyByteSize(field, message), target); \
break; \
}

◆ HANDLE_PRIMITIVE_TYPE [2/3]

#define HANDLE_PRIMITIVE_TYPE (   TYPE,
  CPPTYPE,
  TYPE_METHOD,
  CPPTYPE_METHOD 
)
Value:
case FieldDescriptor::TYPE_##TYPE: { \
auto r = \
message_reflection->GetRepeatedFieldInternal<CPPTYPE>(message, field); \
target = stream->WriteFixedPacked(field->number(), r, target); \
break; \
}

◆ HANDLE_PRIMITIVE_TYPE [3/3]

#define HANDLE_PRIMITIVE_TYPE (   TYPE,
  CPPTYPE,
  TYPE_METHOD,
  CPPTYPE_METHOD 
)
Value:
case FieldDescriptor::TYPE_##TYPE: { \
const CPPTYPE value = \
field->is_repeated() \
? message_reflection->GetRepeated##CPPTYPE_METHOD(message, field, \
j) \
: message_reflection->Get##CPPTYPE_METHOD(message, field); \
target = WireFormatLite::Write##TYPE_METHOD##ToArray(field->number(), \
break; \
}

◆ HANDLE_TYPE [1/5]

#define HANDLE_TYPE (   TYPE,
  CPPTYPE,
  CPPTYPE_METHOD 
)
Value:
case FieldDescriptor::TYPE_##TYPE: { \
CPPTYPE value; \
if (!WireFormatLite::ReadPrimitive<CPPTYPE, WireFormatLite::TYPE_##TYPE>( \
input, &value)) \
return false; \
if (field->is_repeated()) { \
message_reflection->Add##CPPTYPE_METHOD(message, field, value); \
} else { \
message_reflection->Set##CPPTYPE_METHOD(message, field, value); \
} \
break; \
}

◆ HANDLE_TYPE [2/5]

#define HANDLE_TYPE (   TYPE,
  CPPTYPE,
  CPPTYPE_METHOD 
)
Value:
case FieldDescriptor::TYPE_##TYPE: { \
CPPTYPE value; \
ptr = VarintParse(ptr, &value); \
if (ptr == nullptr) return nullptr; \
if (field->is_repeated()) { \
reflection->Add##CPPTYPE_METHOD(msg, field, value); \
} else { \
reflection->Set##CPPTYPE_METHOD(msg, field, value); \
} \
return ptr; \
}

◆ HANDLE_TYPE [3/5]

#define HANDLE_TYPE (   TYPE,
  CPPTYPE,
  CPPTYPE_METHOD 
)
Value:
case FieldDescriptor::TYPE_##TYPE: { \
CPPTYPE value; \
value = UnalignedLoad<CPPTYPE>(ptr); \
ptr += sizeof(CPPTYPE); \
if (field->is_repeated()) { \
reflection->Add##CPPTYPE_METHOD(msg, field, value); \
} else { \
reflection->Set##CPPTYPE_METHOD(msg, field, value); \
} \
return ptr; \
}

◆ HANDLE_TYPE [4/5]

#define HANDLE_TYPE (   TYPE,
  TYPE_METHOD,
  CPPTYPE_METHOD 
)
Value:
case FieldDescriptor::TYPE_##TYPE: \
target = WireFormatLite::InternalWrite##TYPE_METHOD( \
field->number(), \
field->is_repeated() \
? (map_entries.empty() \
? message_reflection->GetRepeated##CPPTYPE_METHOD(message, \
field, j) \
: *map_entries[j]) \
: message_reflection->Get##CPPTYPE_METHOD(message, field), \
break;

◆ HANDLE_TYPE [5/5]

#define HANDLE_TYPE (   TYPE,
  TYPE_METHOD,
  CPPTYPE_METHOD 
)
Value:
case FieldDescriptor::TYPE_##TYPE: \
if (field->is_repeated()) { \
for (size_t j = 0; j < count; j++) { \
data_size += WireFormatLite::TYPE_METHOD##Size( \
message_reflection->GetRepeated##CPPTYPE_METHOD(message, field, \
j)); \
} \
} else { \
data_size += WireFormatLite::TYPE_METHOD##Size( \
message_reflection->Get##CPPTYPE_METHOD(message, field)); \
} \
break;

Variable Documentation

◆ kMapEntryTagByteSize

const size_t kMapEntryTagByteSize = 2

Definition at line 60 of file protobuf/src/google/protobuf/wire_format.cc.

ptr
char * ptr
Definition: abseil-cpp/absl/base/internal/low_level_alloc_test.cc:45
google::protobuf.internal::FieldType
uint8 FieldType
Definition: bloaty/third_party/protobuf/src/google/protobuf/extension_set.h:83
absl::str_format_internal::LengthMod::j
@ j
ctx
Definition: benchmark-async.c:30
a
int a
Definition: abseil-cpp/absl/container/internal/hash_policy_traits_test.cc:88
setup.k
k
Definition: third_party/bloaty/third_party/capstone/bindings/python/setup.py:42
message
char * message
Definition: libuv/docs/code/tty-gravity/main.c:12
google::protobuf.internal::VarintParse
const PROTOBUF_MUST_USE_RESULT char * VarintParse(const char *p, T *out)
Definition: bloaty/third_party/protobuf/src/google/protobuf/parse_context.h:471
b
uint64_t b
Definition: abseil-cpp/absl/container/internal/layout_test.cc:53
msg
std::string msg
Definition: client_interceptors_end2end_test.cc:372
value
const char * value
Definition: hpack_parser_table.cc:165
field
const FieldDescriptor * field
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/parser_unittest.cc:2692
testing::internal::posix::Write
int Write(int fd, const void *buf, unsigned int count)
Definition: bloaty/third_party/googletest/googletest/include/gtest/internal/gtest-port.h:2047
count
int * count
Definition: bloaty/third_party/googletest/googlemock/test/gmock_stress_test.cc:96
fix_build_deps.r
r
Definition: fix_build_deps.py:491
input
std::string input
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/tokenizer_unittest.cc:197
TYPE
#define TYPE(u, l)
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.c:8202
Value
struct Value Value
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/protobuf.h:676
setup.target
target
Definition: third_party/bloaty/third_party/protobuf/python/setup.py:179
if
if(p->owned &&p->wrapped !=NULL)
Definition: call.c:42
stream
voidpf stream
Definition: bloaty/third_party/zlib/contrib/minizip/ioapi.h:136


grpc
Author(s):
autogenerated on Fri May 16 2025 03:01:38