diff options
author | temporal <temporal@630680e5-0e50-0410-840e-4b1c322b438d> | 2008-08-13 03:15:00 +0000 |
---|---|---|
committer | temporal <temporal@630680e5-0e50-0410-840e-4b1c322b438d> | 2008-08-13 03:15:00 +0000 |
commit | 779f61c6a3ce02a119e28e802f229e61b69b9046 (patch) | |
tree | 9131ef5f0acdc3d708a795fc6703488674741ee0 /src/google/protobuf/wire_format.h | |
parent | a0f27fcd96c5bf2509ca88cca54f00b78f7b8bc5 (diff) |
Integrate recent changes from google3.
protoc
- New flags --encode and --decode can be used to convert between protobuf text
format and binary format from the command-line.
- New flag --descriptor_set_out can be used to write FileDescriptorProtos for
all parsed files directly into a single output file. This is particularly
useful if you wish to parse .proto files from programs written in languages
other than C++: just run protoc as a background process and have it output
a FileDescriptorList, then parse that natively.
C++
- Reflection objects are now per-class rather than per-instance. To make this
possible, the Reflection interface had to be changed such that all methods
take the Message instance as a parameter. This change improves performance
significantly in memory-bandwidth-limited use cases, since it makes the
message objects smaller. Note that source-incompatible interface changes
like this will not be made again after the library leaves beta.
Python
- MergeFrom(message) and CopyFrom(message) are now implemented.
- SerializeToString() raises an exception if the message is missing required
fields.
- Code organization improvements.
- Fixed doc comments for RpcController and RpcChannel, which had somehow been
swapped.
Diffstat (limited to 'src/google/protobuf/wire_format.h')
-rw-r--r-- | src/google/protobuf/wire_format.h | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/src/google/protobuf/wire_format.h b/src/google/protobuf/wire_format.h index d59f3fc1..7e8ab5db 100644 --- a/src/google/protobuf/wire_format.h +++ b/src/google/protobuf/wire_format.h @@ -26,7 +26,7 @@ #define GOOGLE_PROTOBUF_WIRE_FORMAT_H__ #include <string> -#include <google/protobuf/message.h> // Message::Reflection +#include <google/protobuf/message.h> #include <google/protobuf/descriptor.h> namespace google { @@ -55,7 +55,7 @@ class LIBPROTOBUF_EXPORT WireFormat { public: // These procedures can be used to implement the methods of Message which // handle parsing and serialization of the protocol buffer wire format - // using only the Message::Reflection interface. When you ask the protocol + // using only the Reflection interface. When you ask the protocol // compiler to optimize for code size rather than speed, it will implement // those methods in terms of these procedures. Of course, these are much // slower than the specialized implementations which the protocol compiler @@ -69,9 +69,8 @@ class LIBPROTOBUF_EXPORT WireFormat { // // Required fields are NOT checked by this method. You must call // IsInitialized() on the resulting message yourself. - static bool ParseAndMergePartial(const Descriptor* descriptor, - io::CodedInputStream* input, - Message::Reflection* message_reflection); + static bool ParseAndMergePartial(io::CodedInputStream* input, + Message* message); // Serialize a message in protocol buffer wire format. // @@ -81,8 +80,7 @@ class LIBPROTOBUF_EXPORT WireFormat { // // These return false iff the underlying stream returns a write error. static bool SerializeWithCachedSizes( - const Descriptor* descriptor, - const Message::Reflection* message_reflection, + const Message& message, int size, io::CodedOutputStream* output); // Implements Message::ByteSize() via reflection. WARNING: The result @@ -90,8 +88,7 @@ class LIBPROTOBUF_EXPORT WireFormat { // will have their ByteSize() methods called, so their sizes will be cached. // Therefore, calling this method is sufficient to allow you to call // WireFormat::SerializeWithCachedSizes() on the same object. - static int ByteSize(const Descriptor* descriptor, - const Message::Reflection* message_reflection); + static int ByteSize(const Message& message); // ----------------------------------------------------------------- // Helpers for dealing with unknown fields @@ -188,13 +185,13 @@ class LIBPROTOBUF_EXPORT WireFormat { static bool ParseAndMergeField( uint32 tag, const FieldDescriptor* field, // May be NULL for unknown - Message::Reflection* message_reflection, + Message* message, io::CodedInputStream* input); // Serialize a single field. static bool SerializeFieldWithCachedSizes( const FieldDescriptor* field, // Cannot be NULL - const Message::Reflection* message_reflection, + const Message& message, io::CodedOutputStream* output); // Compute size of a single field. If the field is a message type, this @@ -202,7 +199,7 @@ class LIBPROTOBUF_EXPORT WireFormat { // its size. static int FieldByteSize( const FieldDescriptor* field, // Cannot be NULL - const Message::Reflection* message_reflection); + const Message& message); // ================================================================= // Methods for reading/writing individual field. The implementations @@ -335,14 +332,14 @@ class LIBPROTOBUF_EXPORT WireFormat { // opion message_set_wire_format = true. static bool ParseAndMergeMessageSetItem( io::CodedInputStream* input, - Message::Reflection* message_reflection); + Message* message); static bool SerializeMessageSetItemWithCachedSizes( const FieldDescriptor* field, - const Message::Reflection* message_reflection, + const Message& message, io::CodedOutputStream* output); static int MessageSetItemByteSize( const FieldDescriptor* field, - const Message::Reflection* message_reflection); + const Message& message); GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(WireFormat); }; |