Unravel Engine C++ Reference
Loading...
Searching...
No Matches
file_istream.h
Go to the documentation of this file.
1#pragma once
2
3
4
6
7#include "filesystem.h"
8
9
10
11#include <iosfwd>
12
13#include <istream>
14
15#include <memory>
16
17
18
19namespace fs
20
21{
22
23
24
26
28
29class file_istream : public std::istream
30
31{
32
33public:
34
36
37 explicit file_istream(const path& file_path,
38
39 std::ios_base::openmode mode = default_file_read_mode);
40
41 explicit file_istream(const std::string& absolute_path,
42
43 std::ios_base::openmode mode = default_file_read_mode);
44
46
47
48
49 file_istream(const file_istream&) = delete;
50
51 auto operator=(const file_istream&) -> file_istream& = delete;
52
53 file_istream(file_istream&& other) noexcept;
54
55 auto operator=(file_istream&& other) noexcept -> file_istream&;
56
57 ~file_istream() override;
58
59
60
61 void open(const path& file_path, std::ios_base::openmode mode = default_file_read_mode);
62
63 void open(const std::string& absolute_path, std::ios_base::openmode mode = default_file_read_mode);
64
65
66
67 auto is_open() const -> bool;
68
69 auto native_handle() const -> FILE*;
70
71 auto tell() const -> long long;
72
73 auto file_size() const -> long long;
74
75 auto seek(long long offset, int whence = SEEK_SET) -> bool;
76
77 void close();
78
79
80
81private:
82
83 struct impl;
84
85 std::unique_ptr<impl> impl_;
86
87};
88
89
90
91} // namespace fs
92
93
stdio-backed input stream. Accepts std::ios open flags (e.g. std::ios::binary) when opening a
auto seek(long long offset, int whence=SEEK_SET) -> bool
file_istream(const file_istream &)=delete
void open(const path &file_path, std::ios_base::openmode mode=default_file_read_mode)
auto file_size() const -> long long
auto is_open() const -> bool
auto tell() const -> long long
auto native_handle() const -> FILE *
auto operator=(const file_istream &) -> file_istream &=delete
~file_istream() override
Definition cache.hpp:11
constexpr std::ios_base::openmode default_file_read_mode
file_stream_ownership
Whether a file stream wrapper should fclose its FILE* on destruction.
Hash specialization for batch_key to enable use in std::unordered_map.