Roll forward to cl/314549634

Change-Id: I4d1e7eacd5fa4078a094571ad6d5f51e422535ff
This commit is contained in:
Himanshu Jaju
2020-06-03 11:18:32 -07:00
committed by Alexey Polyudov
parent ae1c427b99
commit cffbc04508
92 changed files with 3804 additions and 697 deletions
+46
View File
@@ -0,0 +1,46 @@
#ifndef PLATFORM_IMPL_SHARED_FILE_IMPL_H_
#define PLATFORM_IMPL_SHARED_FILE_IMPL_H_
#include <cstdint>
#include <fstream>
#include "platform/api/input_file.h"
#include "platform/api/output_file.h"
#include "platform/exception.h"
#include "platform/ptr.h"
namespace location {
namespace nearby {
class InputFileImpl final : public InputFile {
public:
InputFileImpl(const std::string& path, std::int64_t size);
~InputFileImpl() override {}
ExceptionOr<ConstPtr<ByteArray>> read(std::int64_t size) override;
std::string getFilePath() const override;
std::int64_t getTotalSize() const override;
void close() override;
private:
std::ifstream file_;
const std::string path_;
const std::int64_t total_size_;
};
class OutputFileImpl final : public OutputFile {
public:
explicit OutputFileImpl(const std::string& path);
~OutputFileImpl() override {}
Exception::Value write(ConstPtr<ByteArray> data) override;
void close() override;
private:
std::ofstream file_;
};
} // namespace nearby
} // namespace location
#endif // PLATFORM_IMPL_SHARED_FILE_IMPL_H_