Debian Codegraph @

src/utils/io/file.hpp

raw
1 #ifndef FILE_HPP
2 #define FILE_HPP
3
4 #include "utils/string_view.hpp"
5 #include "utils/span.hpp"
6 #include "utils/io/base_file.hpp"
7 #include "utils/utils.hpp"
8
9 CPPTRACE_BEGIN_NAMESPACE
10 namespace detail {
11 class file : public base_file {
12 file_wrapper file_obj;
13 std::string object_path;
14
15 file(file_wrapper file_obj, string_view path) : file_obj(std::move(file_obj)), object_path(path) {}
16
17 public:
18 file(file&&) = default;
19 ~file() override = default;
20
21 string_view path() const override;
22
23 static Result<file, internal_error> open(cstring_view object_path);
24
25 virtual Result<monostate, internal_error> read_bytes(bspan buffer, off_t offset) const override;
26 };
27 }
28 CPPTRACE_END_NAMESPACE
29
30 #endif