Go to the documentation of this file.
46 #include <google/protobuf/port_def.inc>
53 #if !defined(_MSC_VER) || _MSC_VER >= 1900
65 io::CodedOutputStream::StaticVarintSize32<
67 io::CodedOutputStream::StaticVarintSize32<
69 io::CodedOutputStream::StaticVarintSize32<
71 io::CodedOutputStream::StaticVarintSize32<
76 static_cast<CppType
>(0),
127 if (!
input->ReadVarint64(&
value))
return false;
132 if (!
input->ReadLittleEndian64(&
value))
return false;
142 if (!
input->IncrementRecursionDepth())
return false;
144 input->DecrementRecursionDepth();
146 if (!
input->LastTagWas(
158 if (!
input->ReadLittleEndian32(&
value))
return false;
174 if (!
input->ReadVarint64(&
value))
return false;
175 output->WriteVarint32(tag);
181 if (!
input->ReadLittleEndian64(&
value))
return false;
182 output->WriteVarint32(tag);
189 output->WriteVarint32(tag);
193 if (!
input->ReadString(&temp,
length))
return false;
194 output->WriteString(temp);
198 output->WriteVarint32(tag);
199 if (!
input->IncrementRecursionDepth())
return false;
201 input->DecrementRecursionDepth();
203 if (!
input->LastTagWas(
215 if (!
input->ReadLittleEndian32(&
value))
return false;
216 output->WriteVarint32(tag);
257 output->WriteVarint32(tag);
299 while (
input->BytesUntilLimit() > 0) {
301 if (!ReadPrimitive<int, WireFormatLite::TYPE_ENUM>(
input, &
value)) {
304 if (is_valid ==
NULL || is_valid(
value)) {
313 input->PopLimit(limit);
317 #if !defined(PROTOBUF_LITTLE_ENDIAN)
320 void EncodeFixedSizeValue(
float v,
uint8*
dest) {
324 void EncodeFixedSizeValue(
double v,
uint8*
dest) {
344 void EncodeFixedSizeValue(
bool v,
uint8*
dest) {
349 #endif // !defined(PROTOBUF_LITTLE_ENDIAN)
351 template <
typename CType>
353 #if defined(PROTOBUF_LITTLE_ENDIAN)
354 output->WriteRaw(
reinterpret_cast<const char*
>(
a),
n *
sizeof(
a[0]));
356 const int kAtATime = 128;
357 uint8 buf[
sizeof(CType) * kAtATime];
358 for (
int i = 0;
i <
n;
i += kAtATime) {
359 int to_do = std::min(kAtATime,
n -
i);
361 for (
int j = 0; j < to_do; j++) {
362 EncodeFixedSizeValue(
a[
i + j], ptr);
527 if (!
output->IsSerializationDeterministic()) {
578 bool emit_stacktrace) {
581 if (field_name !=
nullptr) {
584 GOOGLE_LOG(
ERROR) <<
"String field" << quoted_field_name <<
" contains invalid "
585 <<
"UTF-8 data when " << operation_str <<
" a protocol "
586 <<
"buffer. Use the 'bytes' type if you intend to send raw "
587 <<
"bytes. " << stacktrace;
591 const char* field_name) {
593 const char* operation_str =
NULL;
596 operation_str =
"parsing";
599 operation_str =
"serializing";
611 template <
bool ZigZag,
bool SignExtended,
typename T>
613 #if __cplusplus >= 201103L
614 static_assert(
sizeof(
T) == 4,
"This routine only works for 32 bit integers");
618 "Cannot ZigZag encode unsigned types");
622 "Cannot SignExtended unsigned types");
623 static_assert(!(SignExtended && ZigZag),
624 "Cannot SignExtended and ZigZag on the same type");
628 for (
int i = 0;
i <
n;
i++) {
632 }
else if (SignExtended) {
640 if (
x > 0x3FFF) sum++;
641 if (
x > 0x1FFFFF) sum++;
642 if (
x > 0xFFFFFFF) sum++;
644 if (SignExtended) sum += msb_sum * 5;
648 template <
bool ZigZag,
typename T>
650 #if __cplusplus >= 201103L
651 static_assert(
sizeof(
T) == 8,
"This routine only works for 64 bit integers");
654 "Cannot ZigZag encode unsigned types");
657 for (
int i = 0;
i <
n;
i++) {
669 if (
x > 0x3FFF) sum++;
670 if (
x > 0x1FFFFF) sum++;
671 if (
x > 0xFFFFFFF) sum++;
680 #if defined(__SSE__) && defined(__clang__)
682 return VarintSize<false, true>(
value.data(),
value.size());
686 return VarintSize<false, false>(
value.data(),
value.size());
690 return VarintSize<true, false>(
value.data(),
value.size());
695 return VarintSize<false, true>(
value.data(),
value.size());
698 #else // !(defined(__SSE4_1__) && defined(__clang__))
702 const int n =
value.size();
703 for (
int i = 0;
i <
n;
i++) {
711 const int n =
value.size();
712 for (
int i = 0;
i <
n;
i++) {
720 const int n =
value.size();
721 for (
int i = 0;
i <
n;
i++) {
729 const int n =
value.size();
730 for (
int i = 0;
i <
n;
i++) {
742 #define USE_SSE_FOR_64_BIT_INTEGER_ARRAYS 0
743 #if USE_SSE_FOR_64_BIT_INTEGER_ARRAYS
745 return VarintSize64<false>(
value.data(),
value.size());
749 return VarintSize64<false>(
value.data(),
value.size());
753 return VarintSize64<true>(
value.data(),
value.size());
760 const int n =
value.size();
761 for (
int i = 0;
i <
n;
i++) {
769 const int n =
value.size();
770 for (
int i = 0;
i <
n;
i++) {
778 const int n =
value.size();
779 for (
int i = 0;
i <
n;
i++) {
const Descriptor::ReservedRange value
static size_t VarintSize(const T *data, const int n)
GLenum GLuint GLenum GLsizei length
void WriteVarint64(uint64 value)
GLsizei const GLchar *const * string
#define T(upbtypeconst, upbtype, ctype, default_value)
static size_t VarintSize64(const T *data, const int n)
GLenum GLsizei GLsizei GLint * values
#define GOOGLE_LOG(LEVEL)
static PROTOBUF_ALWAYS_INLINE bool ReadBytesToString(io::CodedInputStream *input, std::string *value)
virtual void SkipUnknownEnum(int field_number, int value)
string StringPrintf(const char *format,...)
#define GOOGLE_CHECK_LE(A, B)
GLenum GLuint GLenum GLsizei const GLchar * buf
static const LogLevel ERROR
void PrintUTF8ErrorLog(const char *field_name, const char *operation_str, bool emit_stacktrace)
virtual bool SkipMessage(io::CodedInputStream *input)
bool SkipMessage(io::CodedInputStream *input) override
static const int32 kint32max
virtual bool SkipField(io::CodedInputStream *input, uint32 tag)
bool SkipField(io::CodedInputStream *input, uint32 tag) override
PROTOBUF_EXPORT bool IsStructurallyValidUTF8(const char *buf, int len)
static void WriteArray(const CType *a, int n, io::CodedOutputStream *output)
const PROTOBUF_EXPORT std::string & GetEmptyStringAlreadyInited()
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
void SkipUnknownEnum(int field_number, int value) override
GLsizei const GLfloat * value
io::CodedOutputStream * unknown_fields_
const upb_json_parsermethod const upb_symtab upb_sink * output
GLboolean GLboolean GLboolean GLboolean a
void WriteVarint32(uint32 value)
libaditof
Author(s):
autogenerated on Wed May 21 2025 02:07:01