Go to the documentation of this file.
40 #ifndef GOOGLE_PROTOBUF_WIRE_FORMAT_LITE_H__
41 #define GOOGLE_PROTOBUF_WIRE_FORMAT_LITE_H__
45 #include <google/protobuf/stubs/common.h>
46 #include <google/protobuf/stubs/logging.h>
47 #include <google/protobuf/io/coded_stream.h>
48 #include <google/protobuf/arenastring.h>
49 #include <google/protobuf/message_lite.h>
50 #include <google/protobuf/port.h>
51 #include <google/protobuf/repeated_field.h>
52 #include <google/protobuf/stubs/casts.h>
56 #define GOOGLE_PROTOBUF_UTF8_VALIDATION_ENABLED
70 #include <google/protobuf/port_def.inc>
85 class PROTOBUF_EXPORT WireFormatLite {
145 CPPTYPE_MESSAGE = 10,
155 return kWireTypeForFieldType[
type];
159 static constexpr
int kTagTypeBits = 3;
161 static constexpr
uint32_t kTagTypeMask = (1 << kTagTypeBits) - 1;
174 static inline size_t TagSize(
int field_number,
203 #define GOOGLE_PROTOBUF_WIRE_FORMAT_MAKE_TAG(FIELD_NUMBER, TYPE) \
204 static_cast<uint32_t>((static_cast<uint32_t>(FIELD_NUMBER) << 3) | (TYPE))
213 static constexpr
int kMessageSetItemNumber = 1;
214 static constexpr
int kMessageSetTypeIdNumber = 2;
215 static constexpr
int kMessageSetMessageNumber = 3;
226 static const size_t kMessageSetItemTagsSize;
256 template <
typename CType, enum FieldType DeclaredType>
263 template <
typename CType, enum FieldType DeclaredType>
264 PROTOBUF_NDEBUG_INLINE
static bool ReadRepeatedPrimitive(
270 template <
typename CType, enum FieldType DeclaredType>
271 static bool ReadRepeatedPrimitiveNoInline(
int tag_size,
uint32_t tag,
280 template <
typename CType, enum FieldType DeclaredType>
281 PROTOBUF_NDEBUG_INLINE
static const uint8_t* ReadPrimitiveFromArray(
287 template <
typename CType, enum FieldType DeclaredType>
288 PROTOBUF_NDEBUG_INLINE
static bool ReadPackedPrimitive(
293 template <
typename CType, enum FieldType DeclaredType>
300 bool (*is_valid)(
int),
306 static bool ReadPackedEnumPreserveUnknowns(
331 const char* field_name);
333 template <
typename MessageType>
337 template <
typename MessageType>
341 template <
typename MessageType>
343 MessageType*
value) {
350 PROTOBUF_NDEBUG_INLINE
static void WriteTag(
int field_number, WireType
type,
354 PROTOBUF_NDEBUG_INLINE
static void WriteInt32NoTag(
356 PROTOBUF_NDEBUG_INLINE
static void WriteInt64NoTag(
358 PROTOBUF_NDEBUG_INLINE
static void WriteUInt32NoTag(
360 PROTOBUF_NDEBUG_INLINE
static void WriteUInt64NoTag(
362 PROTOBUF_NDEBUG_INLINE
static void WriteSInt32NoTag(
364 PROTOBUF_NDEBUG_INLINE
static void WriteSInt64NoTag(
366 PROTOBUF_NDEBUG_INLINE
static void WriteFixed32NoTag(
368 PROTOBUF_NDEBUG_INLINE
static void WriteFixed64NoTag(
370 PROTOBUF_NDEBUG_INLINE
static void WriteSFixed32NoTag(
372 PROTOBUF_NDEBUG_INLINE
static void WriteSFixed64NoTag(
374 PROTOBUF_NDEBUG_INLINE
static void WriteFloatNoTag(
376 PROTOBUF_NDEBUG_INLINE
static void WriteDoubleNoTag(
378 PROTOBUF_NDEBUG_INLINE
static void WriteBoolNoTag(
380 PROTOBUF_NDEBUG_INLINE
static void WriteEnumNoTag(
384 static void WriteFloatArray(
const float* a,
int n,
386 static void WriteDoubleArray(
const double* a,
int n,
388 static void WriteFixed32Array(
const uint32_t* a,
int n,
390 static void WriteFixed64Array(
const uint64_t* a,
int n,
392 static void WriteSFixed32Array(
const int32_t* a,
int n,
394 static void WriteSFixed64Array(
const int64_t* a,
int n,
396 static void WriteBoolArray(
const bool* a,
int n,
408 static void WriteSInt32(
int field_number,
int32_t value,
410 static void WriteSInt64(
int field_number,
int64_t value,
416 static void WriteSFixed32(
int field_number,
int32_t value,
418 static void WriteSFixed64(
int field_number,
int64_t value,
420 static void WriteFloat(
int field_number,
float value,
422 static void WriteDouble(
int field_number,
double value,
424 static void WriteBool(
int field_number,
bool value,
426 static void WriteEnum(
int field_number,
int value,
433 static void WriteStringMaybeAliased(
int field_number,
436 static void WriteBytesMaybeAliased(
int field_number,
const std::string&
value,
445 static void WriteGroupMaybeToArray(
int field_number,
const MessageLite&
value,
447 static void WriteMessageMaybeToArray(
int field_number,
454 template <
typename MessageType>
455 static inline void WriteGroupNoVirtual(
int field_number,
456 const MessageType&
value,
458 template <
typename MessageType>
459 static inline void WriteMessageNoVirtual(
int field_number,
460 const MessageType&
value,
464 PROTOBUF_NDEBUG_INLINE
static uint8_t* WriteTagToArray(
int field_number,
469 PROTOBUF_NDEBUG_INLINE
static uint8_t* WriteInt32NoTagToArray(
471 PROTOBUF_NDEBUG_INLINE
static uint8_t* WriteInt64NoTagToArray(
473 PROTOBUF_NDEBUG_INLINE
static uint8_t* WriteUInt32NoTagToArray(
475 PROTOBUF_NDEBUG_INLINE
static uint8_t* WriteUInt64NoTagToArray(
477 PROTOBUF_NDEBUG_INLINE
static uint8_t* WriteSInt32NoTagToArray(
479 PROTOBUF_NDEBUG_INLINE
static uint8_t* WriteSInt64NoTagToArray(
481 PROTOBUF_NDEBUG_INLINE
static uint8_t* WriteFixed32NoTagToArray(
483 PROTOBUF_NDEBUG_INLINE
static uint8_t* WriteFixed64NoTagToArray(
485 PROTOBUF_NDEBUG_INLINE
static uint8_t* WriteSFixed32NoTagToArray(
487 PROTOBUF_NDEBUG_INLINE
static uint8_t* WriteSFixed64NoTagToArray(
489 PROTOBUF_NDEBUG_INLINE
static uint8_t* WriteFloatNoTagToArray(
491 PROTOBUF_NDEBUG_INLINE
static uint8_t* WriteDoubleNoTagToArray(
493 PROTOBUF_NDEBUG_INLINE
static uint8_t* WriteBoolNoTagToArray(
bool value,
495 PROTOBUF_NDEBUG_INLINE
static uint8_t* WriteEnumNoTagToArray(
int value,
499 template <
typename T>
500 PROTOBUF_NDEBUG_INLINE
static uint8_t* WritePrimitiveNoTagToArray(
503 template <
typename T>
504 PROTOBUF_NDEBUG_INLINE
static uint8_t* WriteFixedNoTagToArray(
508 PROTOBUF_NDEBUG_INLINE
static uint8_t* WriteInt32NoTagToArray(
510 PROTOBUF_NDEBUG_INLINE
static uint8_t* WriteInt64NoTagToArray(
512 PROTOBUF_NDEBUG_INLINE
static uint8_t* WriteUInt32NoTagToArray(
514 PROTOBUF_NDEBUG_INLINE
static uint8_t* WriteUInt64NoTagToArray(
516 PROTOBUF_NDEBUG_INLINE
static uint8_t* WriteSInt32NoTagToArray(
518 PROTOBUF_NDEBUG_INLINE
static uint8_t* WriteSInt64NoTagToArray(
520 PROTOBUF_NDEBUG_INLINE
static uint8_t* WriteFixed32NoTagToArray(
522 PROTOBUF_NDEBUG_INLINE
static uint8_t* WriteFixed64NoTagToArray(
524 PROTOBUF_NDEBUG_INLINE
static uint8_t* WriteSFixed32NoTagToArray(
526 PROTOBUF_NDEBUG_INLINE
static uint8_t* WriteSFixed64NoTagToArray(
528 PROTOBUF_NDEBUG_INLINE
static uint8_t* WriteFloatNoTagToArray(
530 PROTOBUF_NDEBUG_INLINE
static uint8_t* WriteDoubleNoTagToArray(
532 PROTOBUF_NDEBUG_INLINE
static uint8_t* WriteBoolNoTagToArray(
534 PROTOBUF_NDEBUG_INLINE
static uint8_t* WriteEnumNoTagToArray(
538 PROTOBUF_NDEBUG_INLINE
static uint8_t* WriteInt32ToArray(
int field_number,
541 PROTOBUF_NDEBUG_INLINE
static uint8_t* WriteInt64ToArray(
int field_number,
544 PROTOBUF_NDEBUG_INLINE
static uint8_t* WriteUInt32ToArray(
int field_number,
547 PROTOBUF_NDEBUG_INLINE
static uint8_t* WriteUInt64ToArray(
int field_number,
550 PROTOBUF_NDEBUG_INLINE
static uint8_t* WriteSInt32ToArray(
int field_number,
553 PROTOBUF_NDEBUG_INLINE
static uint8_t* WriteSInt64ToArray(
int field_number,
556 PROTOBUF_NDEBUG_INLINE
static uint8_t* WriteFixed32ToArray(
int field_number,
559 PROTOBUF_NDEBUG_INLINE
static uint8_t* WriteFixed64ToArray(
int field_number,
562 PROTOBUF_NDEBUG_INLINE
static uint8_t* WriteSFixed32ToArray(
int field_number,
565 PROTOBUF_NDEBUG_INLINE
static uint8_t* WriteSFixed64ToArray(
int field_number,
568 PROTOBUF_NDEBUG_INLINE
static uint8_t* WriteFloatToArray(
int field_number,
571 PROTOBUF_NDEBUG_INLINE
static uint8_t* WriteDoubleToArray(
int field_number,
574 PROTOBUF_NDEBUG_INLINE
static uint8_t* WriteBoolToArray(
int field_number,
577 PROTOBUF_NDEBUG_INLINE
static uint8_t* WriteEnumToArray(
int field_number,
581 template <
typename T>
582 PROTOBUF_NDEBUG_INLINE
static uint8_t* WritePrimitiveToArray(
586 PROTOBUF_NDEBUG_INLINE
static uint8_t* WriteInt32ToArray(
588 PROTOBUF_NDEBUG_INLINE
static uint8_t* WriteInt64ToArray(
590 PROTOBUF_NDEBUG_INLINE
static uint8_t* WriteUInt32ToArray(
592 PROTOBUF_NDEBUG_INLINE
static uint8_t* WriteUInt64ToArray(
594 PROTOBUF_NDEBUG_INLINE
static uint8_t* WriteSInt32ToArray(
596 PROTOBUF_NDEBUG_INLINE
static uint8_t* WriteSInt64ToArray(
598 PROTOBUF_NDEBUG_INLINE
static uint8_t* WriteFixed32ToArray(
600 PROTOBUF_NDEBUG_INLINE
static uint8_t* WriteFixed64ToArray(
602 PROTOBUF_NDEBUG_INLINE
static uint8_t* WriteSFixed32ToArray(
604 PROTOBUF_NDEBUG_INLINE
static uint8_t* WriteSFixed64ToArray(
606 PROTOBUF_NDEBUG_INLINE
static uint8_t* WriteFloatToArray(
608 PROTOBUF_NDEBUG_INLINE
static uint8_t* WriteDoubleToArray(
610 PROTOBUF_NDEBUG_INLINE
static uint8_t* WriteBoolToArray(
612 PROTOBUF_NDEBUG_INLINE
static uint8_t* WriteEnumToArray(
615 PROTOBUF_NDEBUG_INLINE
static uint8_t* WriteStringToArray(
617 PROTOBUF_NDEBUG_INLINE
static uint8_t* WriteBytesToArray(
625 template <
typename MessageType>
626 PROTOBUF_NDEBUG_INLINE
static uint8_t* InternalWriteGroup(
629 template <
typename MessageType>
630 PROTOBUF_NDEBUG_INLINE
static uint8_t* InternalWriteMessage(
637 template <
typename MessageType>
638 PROTOBUF_NDEBUG_INLINE
static uint8_t* InternalWriteGroupNoVirtualToArray(
640 template <
typename MessageType>
641 PROTOBUF_NDEBUG_INLINE
static uint8_t* InternalWriteMessageNoVirtualToArray(
650 value.GetCachedSize() +
652 static_cast<uint32_t>(field_number) << 3)),
662 static_cast<uint32_t>(field_number) << 3) +
678 static inline size_t EnumSize(
int value);
685 static inline size_t EnumSizePlusOne(
int value);
696 static constexpr
size_t kFixed32Size = 4;
697 static constexpr
size_t kFixed64Size = 8;
698 static constexpr
size_t kSFixed32Size = 4;
699 static constexpr
size_t kSFixed64Size = 8;
700 static constexpr
size_t kFloatSize = 4;
701 static constexpr
size_t kDoubleSize = 8;
702 static constexpr
size_t kBoolSize = 1;
707 template <
typename MessageType>
708 static inline size_t GroupSize(
const MessageType&
value);
709 template <
typename MessageType>
710 static inline size_t MessageSize(
const MessageType&
value);
715 template <
typename MessageType>
716 static inline size_t GroupSizeNoVirtual(
const MessageType&
value);
717 template <
typename MessageType>
718 static inline size_t MessageSizeNoVirtual(
const MessageType&
value);
722 static inline size_t LengthDelimitedSize(
size_t length);
728 template <
typename CType, enum FieldType DeclaredType>
729 PROTOBUF_NDEBUG_INLINE
static bool ReadRepeatedFixedSizePrimitive(
734 template <
typename CType, enum FieldType DeclaredType>
735 PROTOBUF_NDEBUG_INLINE
static bool ReadPackedFixedSizePrimitive(
738 static const CppType kFieldTypeToCppTypeMap[];
765 virtual void SkipUnknownEnum(
int field_number,
int value);
770 class PROTOBUF_EXPORT CodedOutputStreamFieldSkipper :
public FieldSkipper {
773 : unknown_fields_(unknown_fields) {}
779 void SkipUnknownEnum(
int field_number,
int value)
override;
818 return bit_cast<uint32_t>(
value);
822 return bit_cast<float>(
value);
826 return bit_cast<uint64_t>(
value);
830 return bit_cast<double>(
value);
865 return static_cast<int32_t>((
n >> 1) ^ (~(n & 1) + 1));
876 return static_cast<int64_t>((
n >> 1) ^ (~(n & 1) + 1));
894 io::EpsCopyOutputStream*
stream) {
895 return stream->WriteRaw(unknown_fields.data(),
896 static_cast<int>(unknown_fields.size()),
target);
901 return unknown_fields.size();
907 inline bool WireFormatLite::ReadPrimitive<int32_t, WireFormatLite::TYPE_INT32>(
910 if (!
input->ReadVarint32(&
temp))
return false;
915 inline bool WireFormatLite::ReadPrimitive<int64_t, WireFormatLite::TYPE_INT64>(
918 if (!
input->ReadVarint64(&
temp))
return false;
924 WireFormatLite::ReadPrimitive<uint32_t, WireFormatLite::TYPE_UINT32>(
930 WireFormatLite::ReadPrimitive<uint64_t, WireFormatLite::TYPE_UINT64>(
935 inline bool WireFormatLite::ReadPrimitive<int32_t, WireFormatLite::TYPE_SINT32>(
938 if (!
input->ReadVarint32(&
temp))
return false;
943 inline bool WireFormatLite::ReadPrimitive<int64_t, WireFormatLite::TYPE_SINT64>(
946 if (!
input->ReadVarint64(&
temp))
return false;
952 WireFormatLite::ReadPrimitive<uint32_t, WireFormatLite::TYPE_FIXED32>(
958 WireFormatLite::ReadPrimitive<uint64_t, WireFormatLite::TYPE_FIXED64>(
964 WireFormatLite::ReadPrimitive<int32_t, WireFormatLite::TYPE_SFIXED32>(
967 if (!
input->ReadLittleEndian32(&
temp))
return false;
973 WireFormatLite::ReadPrimitive<int64_t, WireFormatLite::TYPE_SFIXED64>(
976 if (!
input->ReadLittleEndian64(&
temp))
return false;
981 inline bool WireFormatLite::ReadPrimitive<float, WireFormatLite::TYPE_FLOAT>(
984 if (!
input->ReadLittleEndian32(&
temp))
return false;
989 inline bool WireFormatLite::ReadPrimitive<double, WireFormatLite::TYPE_DOUBLE>(
992 if (!
input->ReadLittleEndian64(&
temp))
return false;
997 inline bool WireFormatLite::ReadPrimitive<bool, WireFormatLite::TYPE_BOOL>(
1000 if (!
input->ReadVarint64(&
temp))
return false;
1005 inline bool WireFormatLite::ReadPrimitive<int, WireFormatLite::TYPE_ENUM>(
1008 if (!
input->ReadVarint32(&
temp))
return false;
1015 WireFormatLite::ReadPrimitiveFromArray<uint32_t, WireFormatLite::TYPE_FIXED32>(
1021 WireFormatLite::ReadPrimitiveFromArray<uint64_t, WireFormatLite::TYPE_FIXED64>(
1027 WireFormatLite::ReadPrimitiveFromArray<int32_t, WireFormatLite::TYPE_SFIXED32>(
1036 WireFormatLite::ReadPrimitiveFromArray<int64_t, WireFormatLite::TYPE_SFIXED64>(
1045 WireFormatLite::ReadPrimitiveFromArray<float, WireFormatLite::TYPE_FLOAT>(
1054 WireFormatLite::ReadPrimitiveFromArray<double, WireFormatLite::TYPE_DOUBLE>(
1062 template <
typename CType, enum WireFormatLite::FieldType DeclaredType>
1067 if (!ReadPrimitive<CType, DeclaredType>(
input, &
value))
return false;
1069 int elements_already_reserved =
values->Capacity() -
values->size();
1070 while (elements_already_reserved > 0 &&
input->ExpectTag(
tag)) {
1071 if (!ReadPrimitive<CType, DeclaredType>(
input, &
value))
return false;
1073 elements_already_reserved--;
1078 template <
typename CType, enum WireFormatLite::FieldType DeclaredType>
1084 if (!ReadPrimitive<CType, DeclaredType>(
input, &
value))
return false;
1096 const void* void_pointer;
1098 input->GetDirectBufferPointerInline(&void_pointer, &
size);
1102 const int per_value_size = tag_size +
static_cast<int>(
sizeof(
value));
1105 int elements_available =
1108 while (num_read < elements_available &&
1115 const int read_bytes = num_read * per_value_size;
1125 #define READ_REPEATED_FIXED_SIZE_PRIMITIVE(CPPTYPE, DECLARED_TYPE) \
1127 inline bool WireFormatLite::ReadRepeatedPrimitive< \
1128 CPPTYPE, WireFormatLite::DECLARED_TYPE>( \
1129 int tag_size, uint32_t tag, io::CodedInputStream* input, \
1130 RepeatedField<CPPTYPE>* values) { \
1131 return ReadRepeatedFixedSizePrimitive<CPPTYPE, \
1132 WireFormatLite::DECLARED_TYPE>( \
1133 tag_size, tag, input, values); \
1143 #undef READ_REPEATED_FIXED_SIZE_PRIMITIVE
1145 template <
typename CType, enum WireFormatLite::FieldType DeclaredType>
1149 return ReadRepeatedPrimitive<CType, DeclaredType>(tag_size,
tag,
input,
1153 template <
typename CType, enum WireFormatLite::FieldType DeclaredType>
1157 if (!
input->ReadVarintSizeAsInt(&
length))
return false;
1159 while (
input->BytesUntilLimit() > 0) {
1161 if (!ReadPrimitive<CType, DeclaredType>(
input, &
value))
return false;
1164 input->PopLimit(limit);
1168 template <
typename CType, enum WireFormatLite::FieldType DeclaredType>
1172 if (!
input->ReadVarintSizeAsInt(&
length))
return false;
1173 const int old_entries =
values->size();
1174 const int new_entries =
length /
static_cast<int>(
sizeof(CType));
1175 const int new_bytes = new_entries *
static_cast<int>(
sizeof(CType));
1176 if (new_bytes !=
length)
return false;
1189 int64_t bytes_limit =
input->BytesUntilTotalBytesLimit();
1190 if (bytes_limit == -1) {
1191 bytes_limit =
input->BytesUntilLimit();
1197 if (bytes_limit >= new_bytes) {
1199 #if defined(PROTOBUF_LITTLE_ENDIAN)
1200 values->Resize(old_entries + new_entries, 0);
1202 void*
dest =
reinterpret_cast<void*
>(
values->mutable_data() + old_entries);
1204 values->Truncate(old_entries);
1208 values->Reserve(old_entries + new_entries);
1210 for (
int i = 0;
i < new_entries; ++
i) {
1211 if (!ReadPrimitive<CType, DeclaredType>(
input, &
value))
return false;
1220 for (
int i = 0;
i < new_entries; ++
i) {
1221 if (!ReadPrimitive<CType, DeclaredType>(
input, &
value))
return false;
1230 #define READ_REPEATED_PACKED_FIXED_SIZE_PRIMITIVE(CPPTYPE, DECLARED_TYPE) \
1233 WireFormatLite::ReadPackedPrimitive<CPPTYPE, WireFormatLite::DECLARED_TYPE>( \
1234 io::CodedInputStream * input, RepeatedField<CPPTYPE> * values) { \
1235 return ReadPackedFixedSizePrimitive<CPPTYPE, \
1236 WireFormatLite::DECLARED_TYPE>( \
1247 #undef READ_REPEATED_PACKED_FIXED_SIZE_PRIMITIVE
1249 template <
typename CType, enum WireFormatLite::FieldType DeclaredType>
1252 return ReadPackedPrimitive<CType, DeclaredType>(
input,
values);
1256 template <
typename MessageType>
1259 MessageType*
value) {
1260 if (!
input->IncrementRecursionDepth())
return false;
1261 if (!
value->MergePartialFromCodedStream(
input))
return false;
1262 input->UnsafeDecrementRecursionDepth();
1269 template <
typename MessageType>
1271 MessageType*
value) {
1273 if (!
input->ReadVarintSizeAsInt(&
length))
return false;
1274 std::pair<io::CodedInputStream::Limit, int>
p =
1275 input->IncrementRecursionDepthAndPushLimit(
length);
1276 if (
p.second < 0 || !
value->MergePartialFromCodedStream(
input))
return false;
1279 return input->DecrementRecursionDepthAndPopLimit(
p.first);
1348 template <
typename MessageType_WorkAroundCppLookupDefect>
1350 int field_number,
const MessageType_WorkAroundCppLookupDefect&
value,
1353 value.MessageType_WorkAroundCppLookupDefect::SerializeWithCachedSizes(
output);
1356 template <
typename MessageType_WorkAroundCppLookupDefect>
1358 int field_number,
const MessageType_WorkAroundCppLookupDefect&
value,
1362 value.MessageType_WorkAroundCppLookupDefect::GetCachedSize());
1363 value.MessageType_WorkAroundCppLookupDefect::SerializeWithCachedSizes(
output);
1438 template <
typename T>
1442 const int n =
value.size();
1445 const T* ii =
value.data();
1454 template <
typename T>
1458 #if defined(PROTOBUF_LITTLE_ENDIAN)
1461 const int n =
value.size();
1464 const T* ii =
value.data();
1465 const int bytes =
n *
static_cast<int>(
sizeof(ii[0]));
1612 template <
typename T>
1616 const int n =
value.size();
1621 const T* ii =
value.data();
1708 template <
typename MessageType>
1717 template <
typename MessageType>
1729 template <
typename MessageType_WorkAroundCppLookupDefect>
1731 int field_number,
const MessageType_WorkAroundCppLookupDefect&
value,
1734 target =
value.MessageType_WorkAroundCppLookupDefect::
SerializeWithCachedSizesToArray(
target);
1737 template <
typename MessageType_WorkAroundCppLookupDefect>
1739 int field_number,
const MessageType_WorkAroundCppLookupDefect&
value,
1744 value.MessageType_WorkAroundCppLookupDefect::GetCachedSize()),
1747 .MessageType_WorkAroundCppLookupDefect::SerializeWithCachedSizesToArray(
1805 template <
typename MessageType>
1807 return value.ByteSizeLong();
1809 template <
typename MessageType>
1816 template <
typename MessageType_WorkAroundCppLookupDefect>
1818 const MessageType_WorkAroundCppLookupDefect&
value) {
1819 return value.MessageType_WorkAroundCppLookupDefect::ByteSizeLong();
1821 template <
typename MessageType_WorkAroundCppLookupDefect>
1823 const MessageType_WorkAroundCppLookupDefect&
value) {
1825 value.MessageType_WorkAroundCppLookupDefect::ByteSizeLong());
1837 template <
typename MS>
1849 enum class State { kNoTag, kHasType, kHasPayload, kDone };
1850 State
state = State::kNoTag;
1854 if (
tag == 0)
return false;
1859 if (!
input->ReadVarint32(&type_id))
return false;
1860 if (
state == State::kNoTag) {
1861 last_type_id = type_id;
1862 state = State::kHasType;
1863 }
else if (
state == State::kHasPayload) {
1869 sub_input.SetRecursionLimit(
input->RecursionBudget());
1870 if (!ms.ParseField(type_id, &sub_input)) {
1874 state = State::kDone;
1881 if (
state == State::kHasType) {
1883 if (!ms.ParseField(last_type_id,
input)) {
1886 state = State::kDone;
1887 }
else if (
state == State::kNoTag) {
1898 state = State::kHasPayload;
1900 if (!ms.SkipField(
tag,
input))
return false;
1911 if (!ms.SkipField(
tag,
input))
return false;
1921 #include <google/protobuf/port_undef.inc>
1923 #endif // GOOGLE_PROTOBUF_WIRE_FORMAT_LITE_H__
const Descriptor::ReservedRange value
size_t ComputeUnknownMessageSetItemsSize(const UnknownFieldSet &unknown_fields)
#define GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(TypeName)
static uint8 * WriteStringWithSizeToArray(const std::string &str, uint8 *target)
static uint8 * WriteVarint64ToArray(uint64 value, uint8 *target)
static uint8 * WriteVarint32SignExtendedToArray(int32 value, uint8 *target)
static size_t VarintSize64(uint64 value)
static bool IsDefaultSerializationDeterministic()
static uint8 * WriteLittleEndian64ToArray(uint64 value, uint8 *target)
#define T(upbtypeconst, upbtype, ctype, default_value)
static size_t VarintSize64PlusOne(uint64_t value)
memcpy(mem, inblock.get(), min(CONTAINING_RECORD(inblock.get(), MEMBLOCK, data) ->size, size))
static void * tag(intptr_t t)
static size_t VarintSize32PlusOne(uint32_t value)
unsigned __int64 uint64_t
bool ParseMessageSetItemImpl(io::CodedInputStream *input, MS ms)
GRPC_CUSTOM_CODEDINPUTSTREAM CodedInputStream
static size_t VarintSize32(uint32 value)
static size_t VarintSize32SignExtended(int32 value)
static PROTOBUF_ALWAYS_INLINE uint8 * WriteTagToArray(uint32 value, uint8 *target)
static int read_bytes(int fd, char *buf, size_t read_size, int spin)
GRPC_CUSTOM_CODEDOUTPUTSTREAM CodedOutputStream
void * message_data(MessageHeader *msg)
static uint8_t * WriteVarint32ToArrayOutOfLine(uint32_t value, uint8_t *target)
~CodedOutputStreamFieldSkipper() override
CodedOutputStreamFieldSkipper(io::CodedOutputStream *unknown_fields)
std::array< int64_t, Size > values
static uint8 * WriteVarint32ToArray(uint32 value, uint8 *target)
absl::string_view ReadBytes(size_t bytes, absl::string_view *data)
static size_t VarintSize32SignExtendedPlusOne(int32_t value)
static uint8 * WriteLittleEndian32ToArray(uint32 value, uint8 *target)
uint8 * InternalSerializeUnknownMessageSetItemsToArray(const UnknownFieldSet &unknown_fields, uint8 *target, io::EpsCopyOutputStream *stream)
grpc
Author(s):
autogenerated on Fri May 16 2025 03:00:54