| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 part of protobuf; | 5 part of protobuf; |
| 6 | 6 |
| 7 typedef GeneratedMessage CreateBuilderFunc(); | 7 typedef GeneratedMessage CreateBuilderFunc(); |
| 8 typedef MakeDefaultFunc(); | 8 typedef MakeDefaultFunc(); |
| 9 typedef ProtobufEnum ValueOfFunc(int value); | 9 typedef ProtobufEnum ValueOfFunc(int value); |
| 10 | 10 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 | 60 |
| 61 /// Clears all data that was set in this message. | 61 /// Clears all data that was set in this message. |
| 62 /// | 62 /// |
| 63 /// After calling [clear], [getField] will still return default values for | 63 /// After calling [clear], [getField] will still return default values for |
| 64 /// unset fields. | 64 /// unset fields. |
| 65 void clear() => _fieldSet._clear(); | 65 void clear() => _fieldSet._clear(); |
| 66 | 66 |
| 67 // TODO(antonm): move to getters. | 67 // TODO(antonm): move to getters. |
| 68 int getTagNumber(String fieldName) => info_.tagNumber(fieldName); | 68 int getTagNumber(String fieldName) => info_.tagNumber(fieldName); |
| 69 | 69 |
| 70 bool operator ==(other) { | 70 bool operator ==(other) => |
| 71 if (other is! GeneratedMessage) return false; | 71 other is GeneratedMessage ? _fieldSet._equals(other._fieldSet) : false; |
| 72 return _fieldSet._equals(other._fieldSet); | |
| 73 } | |
| 74 | 72 |
| 75 /// Calculates a hash code based on the contents of the protobuf. | 73 /// Calculates a hash code based on the contents of the protobuf. |
| 76 /// | 74 /// |
| 77 /// The hash may change when any field changes (recursively). | 75 /// The hash may change when any field changes (recursively). |
| 78 /// Therefore, protobufs used as map keys shouldn't be changed. | 76 /// Therefore, protobufs used as map keys shouldn't be changed. |
| 79 int get hashCode => _fieldSet._hashCode; | 77 int get hashCode => _fieldSet._hashCode; |
| 80 | 78 |
| 81 /// Returns a String representation of this message. | 79 /// Returns a String representation of this message. |
| 82 /// | 80 /// |
| 83 /// This representation is similar to, but not quite, the Protocol Buffer | 81 /// This representation is similar to, but not quite, the Protocol Buffer |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 if (value == null || !_isUnsigned32(value)) { | 316 if (value == null || !_isUnsigned32(value)) { |
| 319 _fieldSet._$check(tagNumber, value); | 317 _fieldSet._$check(tagNumber, value); |
| 320 } | 318 } |
| 321 _fieldSet._$set(index, tagNumber, value); | 319 _fieldSet._$set(index, tagNumber, value); |
| 322 } | 320 } |
| 323 | 321 |
| 324 /// For generated code only. | 322 /// For generated code only. |
| 325 void $_setInt64(int index, int tagNumber, Int64 value) => | 323 void $_setInt64(int index, int tagNumber, Int64 value) => |
| 326 _fieldSet._$set(index, tagNumber, value); | 324 _fieldSet._$set(index, tagNumber, value); |
| 327 } | 325 } |
| OLD | NEW |