| 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 22 matching lines...) Expand all Loading... |
| 33 // Based on original Protocol Buffers design by | 33 // Based on original Protocol Buffers design by |
| 34 // Sanjay Ghemawat, Jeff Dean, and others. | 34 // Sanjay Ghemawat, Jeff Dean, and others. |
| 35 // | 35 // |
| 36 // Defines MessageLite, the abstract interface implemented by all (lite | 36 // Defines MessageLite, the abstract interface implemented by all (lite |
| 37 // and non-lite) protocol message objects. | 37 // and non-lite) protocol message objects. |
| 38 | 38 |
| 39 #ifndef GOOGLE_PROTOBUF_MESSAGE_LITE_H__ | 39 #ifndef GOOGLE_PROTOBUF_MESSAGE_LITE_H__ |
| 40 #define GOOGLE_PROTOBUF_MESSAGE_LITE_H__ | 40 #define GOOGLE_PROTOBUF_MESSAGE_LITE_H__ |
| 41 | 41 |
| 42 #include <google/protobuf/stubs/common.h> | 42 #include <google/protobuf/stubs/common.h> |
| 43 #include <google/protobuf/io/coded_stream.h> | |
| 44 | 43 |
| 45 namespace google { | 44 namespace google { |
| 46 namespace protobuf { | 45 namespace protobuf { |
| 47 | 46 |
| 47 namespace io { |
| 48 class CodedInputStream; |
| 49 class CodedOutputStream; |
| 50 class ZeroCopyInputStream; |
| 51 class ZeroCopyOutputStream; |
| 52 } |
| 53 |
| 48 // Interface to light weight protocol messages. | 54 // Interface to light weight protocol messages. |
| 49 // | 55 // |
| 50 // This interface is implemented by all protocol message objects. Non-lite | 56 // This interface is implemented by all protocol message objects. Non-lite |
| 51 // messages additionally implement the Message interface, which is a | 57 // messages additionally implement the Message interface, which is a |
| 52 // subclass of MessageLite. Use MessageLite instead when you only need | 58 // subclass of MessageLite. Use MessageLite instead when you only need |
| 53 // the subset of features which it supports -- namely, nothing that uses | 59 // the subset of features which it supports -- namely, nothing that uses |
| 54 // descriptors or reflection. You can instruct the protocol compiler | 60 // descriptors or reflection. You can instruct the protocol compiler |
| 55 // to generate classes which implement only MessageLite, not the full | 61 // to generate classes which implement only MessageLite, not the full |
| 56 // Message interface, by adding the following line to the .proto file: | 62 // Message interface, by adding the following line to the .proto file: |
| 57 // | 63 // |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 // MergeFromCodedStream(). | 157 // MergeFromCodedStream(). |
| 152 bool MergeFromCodedStream(io::CodedInputStream* input); | 158 bool MergeFromCodedStream(io::CodedInputStream* input); |
| 153 | 159 |
| 154 // Like MergeFromCodedStream(), but succeeds even if required fields are | 160 // Like MergeFromCodedStream(), but succeeds even if required fields are |
| 155 // missing in the input. | 161 // missing in the input. |
| 156 // | 162 // |
| 157 // MergeFromCodedStream() is just implemented as MergePartialFromCodedStream() | 163 // MergeFromCodedStream() is just implemented as MergePartialFromCodedStream() |
| 158 // followed by IsInitialized(). | 164 // followed by IsInitialized(). |
| 159 virtual bool MergePartialFromCodedStream(io::CodedInputStream* input) = 0; | 165 virtual bool MergePartialFromCodedStream(io::CodedInputStream* input) = 0; |
| 160 | 166 |
| 167 |
| 161 // Serialization --------------------------------------------------- | 168 // Serialization --------------------------------------------------- |
| 162 // Methods for serializing in protocol buffer format. Most of these | 169 // Methods for serializing in protocol buffer format. Most of these |
| 163 // are just simple wrappers around ByteSize() and SerializeWithCachedSizes(). | 170 // are just simple wrappers around ByteSize() and SerializeWithCachedSizes(). |
| 164 | 171 |
| 165 // Write a protocol buffer of this message to the given output. Returns | 172 // Write a protocol buffer of this message to the given output. Returns |
| 166 // false on a write error. If the message is missing required fields, | 173 // false on a write error. If the message is missing required fields, |
| 167 // this may GOOGLE_CHECK-fail. | 174 // this may GOOGLE_CHECK-fail. |
| 168 bool SerializeToCodedStream(io::CodedOutputStream* output) const; | 175 bool SerializeToCodedStream(io::CodedOutputStream* output) const; |
| 169 // Like SerializeToCodedStream(), but allows missing required fields. | 176 // Like SerializeToCodedStream(), but allows missing required fields. |
| 170 bool SerializePartialToCodedStream(io::CodedOutputStream* output) const; | 177 bool SerializePartialToCodedStream(io::CodedOutputStream* output) const; |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 virtual int GetCachedSize() const = 0; | 237 virtual int GetCachedSize() const = 0; |
| 231 | 238 |
| 232 private: | 239 private: |
| 233 GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageLite); | 240 GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageLite); |
| 234 }; | 241 }; |
| 235 | 242 |
| 236 } // namespace protobuf | 243 } // namespace protobuf |
| 237 | 244 |
| 238 } // namespace google | 245 } // namespace google |
| 239 #endif // GOOGLE_PROTOBUF_MESSAGE_LITE_H__ | 246 #endif // GOOGLE_PROTOBUF_MESSAGE_LITE_H__ |
| OLD | NEW |