| OLD | NEW |
| (Empty) |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "blimp/helium/serializable_struct.h" | |
| 6 | |
| 7 namespace blimp { | |
| 8 namespace helium { | |
| 9 | |
| 10 SerializableStruct::SerializableStruct() {} | |
| 11 | |
| 12 SerializableStruct::~SerializableStruct() {} | |
| 13 | |
| 14 bool SerializableStruct::Parse( | |
| 15 google::protobuf::io::CodedInputStream* input_stream) { | |
| 16 for (auto* field : fields_) { | |
| 17 if (!field->Parse(input_stream)) { | |
| 18 return false; | |
| 19 } | |
| 20 } | |
| 21 return true; | |
| 22 } | |
| 23 | |
| 24 void SerializableStruct::Serialize( | |
| 25 google::protobuf::io::CodedOutputStream* output_stream) const { | |
| 26 for (const auto* field : fields_) { | |
| 27 field->Serialize(output_stream); | |
| 28 } | |
| 29 } | |
| 30 | |
| 31 SerializableStruct::FieldBase::FieldBase() {} | |
| 32 | |
| 33 SerializableStruct::FieldBase::~FieldBase() {} | |
| 34 | |
| 35 void SerializableStruct::FieldBase::RegisterWith( | |
| 36 SerializableStruct* container) { | |
| 37 container->fields_.push_back(this); | |
| 38 } | |
| 39 | |
| 40 } // namespace helium | |
| 41 } // namespace blimp | |
| OLD | NEW |