You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
1.0 KiB

// Copyright 2017 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef LIBBRILLO_BRILLO_PROTO_FILE_IO_H_
#define LIBBRILLO_BRILLO_PROTO_FILE_IO_H_
#include <base/files/file_path.h>
#include <brillo/brillo_export.h>
#include <google/protobuf/message.h>
namespace brillo {
// Simple utilities for serializing and deserializing protobufs in
// text format. For an example of the format, see the docs at
// https://developers.google.com/protocol-buffers/docs/overview#whynotxml
BRILLO_EXPORT bool ReadTextProtobuf(const base::FilePath& proto_file,
google::protobuf::Message* out_proto);
BRILLO_EXPORT bool ReadTextProtobuf(int fd,
google::protobuf::Message* out_proto);
BRILLO_EXPORT bool WriteTextProtobuf(int fd,
const google::protobuf::Message& proto);
} // namespace brillo
#endif // LIBBRILLO_BRILLO_PROTO_FILE_IO_H_