| OLD | NEW |
| 1 // Protocol Buffers - Google's data interchange format | 1 // Protocol Buffers - Google's data interchange format |
| 2 // Copyright 2008 Google Inc. All rights reserved. | 2 // Copyright 2008 Google Inc. All rights reserved. |
| 3 // http://code.google.com/p/protobuf/ | 3 // http://code.google.com/p/protobuf/ |
| 4 // | 4 // |
| 5 // Redistribution and use in source and binary forms, with or without | 5 // Redistribution and use in source and binary forms, with or without |
| 6 // modification, are permitted provided that the following conditions are | 6 // modification, are permitted provided that the following conditions are |
| 7 // met: | 7 // met: |
| 8 // | 8 // |
| 9 // * Redistributions of source code must retain the above copyright | 9 // * Redistributions of source code must retain the above copyright |
| 10 // notice, this list of conditions and the following disclaimer. | 10 // notice, this list of conditions and the following disclaimer. |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 // Sanjay Ghemawat, Jeff Dean, and others. | 34 // Sanjay Ghemawat, Jeff Dean, and others. |
| 35 | 35 |
| 36 #ifndef GOOGLE_PROTOBUF_WIRE_FORMAT_LITE_INL_H__ | 36 #ifndef GOOGLE_PROTOBUF_WIRE_FORMAT_LITE_INL_H__ |
| 37 #define GOOGLE_PROTOBUF_WIRE_FORMAT_LITE_INL_H__ | 37 #define GOOGLE_PROTOBUF_WIRE_FORMAT_LITE_INL_H__ |
| 38 | 38 |
| 39 #include <string> | 39 #include <string> |
| 40 #include <google/protobuf/stubs/common.h> | 40 #include <google/protobuf/stubs/common.h> |
| 41 #include <google/protobuf/message_lite.h> | 41 #include <google/protobuf/message_lite.h> |
| 42 #include <google/protobuf/repeated_field.h> | 42 #include <google/protobuf/repeated_field.h> |
| 43 #include <google/protobuf/wire_format_lite.h> | 43 #include <google/protobuf/wire_format_lite.h> |
| 44 #include <google/protobuf/generated_message_util.h> | |
| 45 #include <google/protobuf/io/coded_stream.h> | 44 #include <google/protobuf/io/coded_stream.h> |
| 46 | 45 |
| 47 | 46 |
| 48 namespace google { | 47 namespace google { |
| 49 namespace protobuf { | 48 namespace protobuf { |
| 50 namespace internal { | 49 namespace internal { |
| 51 | 50 |
| 52 // Implementation details of ReadPrimitive. | 51 // Implementation details of ReadPrimitive. |
| 53 | 52 |
| 54 template <> | 53 template <> |
| (...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 742 inline int WireFormatLite::BytesSize(const string& value) { | 741 inline int WireFormatLite::BytesSize(const string& value) { |
| 743 return io::CodedOutputStream::VarintSize32(value.size()) + | 742 return io::CodedOutputStream::VarintSize32(value.size()) + |
| 744 value.size(); | 743 value.size(); |
| 745 } | 744 } |
| 746 | 745 |
| 747 | 746 |
| 748 inline int WireFormatLite::GroupSize(const MessageLite& value) { | 747 inline int WireFormatLite::GroupSize(const MessageLite& value) { |
| 749 return value.ByteSize(); | 748 return value.ByteSize(); |
| 750 } | 749 } |
| 751 inline int WireFormatLite::MessageSize(const MessageLite& value) { | 750 inline int WireFormatLite::MessageSize(const MessageLite& value) { |
| 752 int size = value.ByteSize(); | 751 return LengthDelimitedSize(value.ByteSize()); |
| 753 return io::CodedOutputStream::VarintSize32(size) + size; | |
| 754 } | 752 } |
| 755 | 753 |
| 756 // See comment on ReadGroupNoVirtual to understand the need for this template | 754 // See comment on ReadGroupNoVirtual to understand the need for this template |
| 757 // parameter name. | 755 // parameter name. |
| 758 template<typename MessageType_WorkAroundCppLookupDefect> | 756 template<typename MessageType_WorkAroundCppLookupDefect> |
| 759 inline int WireFormatLite::GroupSizeNoVirtual( | 757 inline int WireFormatLite::GroupSizeNoVirtual( |
| 760 const MessageType_WorkAroundCppLookupDefect& value) { | 758 const MessageType_WorkAroundCppLookupDefect& value) { |
| 761 return value.MessageType_WorkAroundCppLookupDefect::ByteSize(); | 759 return value.MessageType_WorkAroundCppLookupDefect::ByteSize(); |
| 762 } | 760 } |
| 763 template<typename MessageType_WorkAroundCppLookupDefect> | 761 template<typename MessageType_WorkAroundCppLookupDefect> |
| 764 inline int WireFormatLite::MessageSizeNoVirtual( | 762 inline int WireFormatLite::MessageSizeNoVirtual( |
| 765 const MessageType_WorkAroundCppLookupDefect& value) { | 763 const MessageType_WorkAroundCppLookupDefect& value) { |
| 766 int size = value.MessageType_WorkAroundCppLookupDefect::ByteSize(); | 764 return LengthDelimitedSize( |
| 767 return io::CodedOutputStream::VarintSize32(size) + size; | 765 value.MessageType_WorkAroundCppLookupDefect::ByteSize()); |
| 766 } |
| 767 |
| 768 inline int WireFormatLite::LengthDelimitedSize(int length) { |
| 769 return io::CodedOutputStream::VarintSize32(length) + length; |
| 768 } | 770 } |
| 769 | 771 |
| 770 } // namespace internal | 772 } // namespace internal |
| 771 } // namespace protobuf | 773 } // namespace protobuf |
| 772 | 774 |
| 773 } // namespace google | 775 } // namespace google |
| 774 #endif // GOOGLE_PROTOBUF_WIRE_FORMAT_LITE_INL_H__ | 776 #endif // GOOGLE_PROTOBUF_WIRE_FORMAT_LITE_INL_H__ |
| OLD | NEW |