diff options
Diffstat (limited to 'src/google/protobuf/wire_format_lite.h')
-rw-r--r-- | src/google/protobuf/wire_format_lite.h | 57 |
1 files changed, 8 insertions, 49 deletions
diff --git a/src/google/protobuf/wire_format_lite.h b/src/google/protobuf/wire_format_lite.h index 21aa488..e3d5b2d 100644 --- a/src/google/protobuf/wire_format_lite.h +++ b/src/google/protobuf/wire_format_lite.h @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ +// http://code.google.com/p/protobuf/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -41,14 +41,16 @@ #define GOOGLE_PROTOBUF_WIRE_FORMAT_LITE_H__ #include <string> -#include <google/protobuf/stubs/common.h> #include <google/protobuf/message_lite.h> -#include <google/protobuf/io/coded_stream.h> // for CodedOutputStream::Varint32Size namespace google { namespace protobuf { template <typename T> class RepeatedField; // repeated_field.h + namespace io { + class CodedInputStream; // coded_stream.h + class CodedOutputStream; // coded_stream.h + } } namespace protobuf { @@ -163,22 +165,11 @@ class LIBPROTOBUF_EXPORT WireFormatLite { // records to an UnknownFieldSet. static bool SkipField(io::CodedInputStream* input, uint32 tag); - // Skips a field value with the given tag. The input should start - // positioned immediately after the tag. Skipped values are recorded to a - // CodedOutputStream. - static bool SkipField(io::CodedInputStream* input, uint32 tag, - io::CodedOutputStream* output); - // Reads and ignores a message from the input. Skipped values are simply // discarded, not recorded anywhere. See WireFormat::SkipMessage() for a // version that records to an UnknownFieldSet. static bool SkipMessage(io::CodedInputStream* input); - // Reads and ignores a message from the input. Skipped values are recorded - // to a CodedOutputStream. - static bool SkipMessage(io::CodedInputStream* input, - io::CodedOutputStream* output); - // This macro does the same thing as WireFormatLite::MakeTag(), but the // result is usable as a compile-time constant, which makes it usable // as a switch case or a template input. WireFormatLite::MakeTag() is more @@ -239,9 +230,9 @@ class LIBPROTOBUF_EXPORT WireFormatLite { // that file to use these. // Avoid ugly line wrapping -#define input io::CodedInputStream* input_arg -#define output io::CodedOutputStream* output_arg -#define field_number int field_number_arg +#define input io::CodedInputStream* input +#define output io::CodedOutputStream* output +#define field_number int field_number #define INL GOOGLE_ATTRIBUTE_ALWAYS_INLINE // Read fields, not including tags. The assumption is that you already @@ -351,10 +342,6 @@ class LIBPROTOBUF_EXPORT WireFormatLite { static void WriteString(field_number, const string& value, output); static void WriteBytes (field_number, const string& value, output); - static void WriteStringMaybeAliased( - field_number, const string& value, output); - static void WriteBytesMaybeAliased( - field_number, const string& value, output); static void WriteGroup( field_number, const MessageLite& value, output); @@ -490,10 +477,6 @@ class LIBPROTOBUF_EXPORT WireFormatLite { template<typename MessageType> static inline int MessageSizeNoVirtual(const MessageType& value); - // Given the length of data, calculate the byte size of the data on the - // wire if we encode the data as a length delimited field. - static inline int LengthDelimitedSize(int length); - private: // A helper method for the repeated primitive reader. This method has // optimizations for primitive types that have fixed size on the wire, and @@ -505,12 +488,6 @@ class LIBPROTOBUF_EXPORT WireFormatLite { google::protobuf::io::CodedInputStream* input, RepeatedField<CType>* value) GOOGLE_ATTRIBUTE_ALWAYS_INLINE; - // Like ReadRepeatedFixedSizePrimitive but for packed primitive fields. - template <typename CType, enum FieldType DeclaredType> - static inline bool ReadPackedFixedSizePrimitive( - google::protobuf::io::CodedInputStream* input, - RepeatedField<CType>* value) GOOGLE_ATTRIBUTE_ALWAYS_INLINE; - static const CppType kFieldTypeToCppTypeMap[]; static const WireFormatLite::WireType kWireTypeForFieldType[]; @@ -539,24 +516,6 @@ class LIBPROTOBUF_EXPORT FieldSkipper { virtual void SkipUnknownEnum(int field_number, int value); }; -// Subclass of FieldSkipper which saves skipped fields to a CodedOutputStream. - -class LIBPROTOBUF_EXPORT CodedOutputStreamFieldSkipper : public FieldSkipper { - public: - explicit CodedOutputStreamFieldSkipper(io::CodedOutputStream* unknown_fields) - : unknown_fields_(unknown_fields) {} - virtual ~CodedOutputStreamFieldSkipper() {} - - // implements FieldSkipper ----------------------------------------- - virtual bool SkipField(io::CodedInputStream* input, uint32 tag); - virtual bool SkipMessage(io::CodedInputStream* input); - virtual void SkipUnknownEnum(int field_number, int value); - - protected: - io::CodedOutputStream* unknown_fields_; -}; - - // inline methods ==================================================== inline WireFormatLite::CppType |