blob: 2bb7a6eb5e29b50502591b0c6ba6a2c0d9607cb1 [file] [log] [blame]
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "mojo/common/common_custom_types_struct_traits.h"
#include <iterator>
#include "base/version.h"
namespace mojo {
// static
const std::vector<uint32_t>&
StructTraits<mojo::common::mojom::Version, base::Version>::components(
const base::Version& version) {
return version.components();
// static
bool StructTraits<mojo::common::mojom::Version, base::Version>::Read(
mojo::common::mojom::VersionDataView data,
base::Version* out) {
std::vector<uint32_t> components;
if (!data.ReadComponents(&components))
return false;
*out = base::Version(base::Version(std::move(components)));
return out->IsValid();
} // namespace mojo