Yavor Goulishev | 9c08e84 | 2020-04-29 14:03:33 -0700 | [diff] [blame] | 1 | // 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 Goulishev | 9c08e84 | 2020-04-29 14:03:33 -0700 | [diff] [blame] | 18 | #include "starboard/elf_loader/file.h" |
| 19 | #include "starboard/file.h" |
| 20 | |
| 21 | namespace starboard { |
| 22 | namespace elf_loader { |
| 23 | |
| 24 | // Starboard implementation for reading a file. |
| 25 | class FileImpl : public File { |
| 26 | public: |
| 27 | FileImpl(); |
| 28 | ~FileImpl() override; |
Kaido Kert | 72bde07 | 2021-03-12 15:55:15 -0800 | [diff] [blame] | 29 | bool Open(const char* name) override; |
| 30 | bool ReadFromOffset(int64_t offset, char* buffer, int size) override; |
| 31 | void Close() override; |
Yavor Goulishev | 9c08e84 | 2020-04-29 14:03:33 -0700 | [diff] [blame] | 32 | |
Kaido Kert | 72bde07 | 2021-03-12 15:55:15 -0800 | [diff] [blame] | 33 | protected: |
Yavor Goulishev | 9c08e84 | 2020-04-29 14:03:33 -0700 | [diff] [blame] | 34 | SbFile file_; |
| 35 | |
Kaido Kert | ecb76eb | 2020-11-03 16:50:30 -0800 | [diff] [blame] | 36 | FileImpl(const FileImpl&) = delete; |
| 37 | void operator=(const FileImpl&) = delete; |
Yavor Goulishev | 9c08e84 | 2020-04-29 14:03:33 -0700 | [diff] [blame] | 38 | }; |
| 39 | |
| 40 | } // namespace elf_loader |
| 41 | } // namespace starboard |
| 42 | |
| 43 | #endif // STARBOARD_ELF_LOADER_FILE_IMPL_H_ |