blob: ebd1c920b40965ee0c7994c3f4b24497c2fa0217 [file] [log] [blame]
Yavor Goulishev9c08e842020-04-29 14:03:33 -07001// Copyright 2019 The Cobalt Authors. All Rights Reserved.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#ifndef STARBOARD_ELF_LOADER_FILE_IMPL_H_
16#define STARBOARD_ELF_LOADER_FILE_IMPL_H_
17
Yavor Goulishev9c08e842020-04-29 14:03:33 -070018#include "starboard/elf_loader/file.h"
19#include "starboard/file.h"
20
21namespace starboard {
22namespace elf_loader {
23
24// Starboard implementation for reading a file.
25class FileImpl : public File {
26 public:
27 FileImpl();
28 ~FileImpl() override;
Kaido Kert72bde072021-03-12 15:55:15 -080029 bool Open(const char* name) override;
30 bool ReadFromOffset(int64_t offset, char* buffer, int size) override;
31 void Close() override;
Yavor Goulishev9c08e842020-04-29 14:03:33 -070032
Kaido Kert72bde072021-03-12 15:55:15 -080033 protected:
Yavor Goulishev9c08e842020-04-29 14:03:33 -070034 SbFile file_;
35
Kaido Kertecb76eb2020-11-03 16:50:30 -080036 FileImpl(const FileImpl&) = delete;
37 void operator=(const FileImpl&) = delete;
Yavor Goulishev9c08e842020-04-29 14:03:33 -070038};
39
40} // namespace elf_loader
41} // namespace starboard
42
43#endif // STARBOARD_ELF_LOADER_FILE_IMPL_H_